function preloadImages()
{
var d=document; if(d.images){ if(!d.p) d.p=new Array();
var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function findObj(n, d)
{
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function swapImage()
{
var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function swapImgRestore()
{
var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function spawnWindow(theURL,winName,features,posX,posY)
{
myWindow=window.open(theURL,winName,features);
if (!myWindow.opener) myWindow.opener = self;
myWindow.focus();
if(posX || posY)
{
myWindow.moveTo(posX,posY);
}
}
function getWinSize()
{
if ((document.layers||document.getElementById)&&(!document.all))
{
winWidth = innerWidth;
winHeight = innerHeight;
}
if (document.all)
{
winWidth = document.body.clientWidth;
winHeight = document.body.clientHeight-3;
}
}
function setCookie(name, value, expires, path, domain, secure)
{
var curCookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires.toGMTString() : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
document.cookie = curCookie;
}
function getCookie(name)
{
var dc = document.cookie;
var prefix = name + "=";
var begin = dc.indexOf("; " + prefix);
if (begin == -1)
{
begin = dc.indexOf(prefix);
if (begin != 0) return null;
}
else
{
begin += 2;
var end = document.cookie.indexOf(";", begin);
if (end == -1)
end = dc.length;
return unescape(dc.substring(begin + prefix.length, end));
}
}
function deleteCookie(name, path, domain)
{
if (getCookie(name))
{
document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
}
function addEvent(obj, evType, fn)
{
if (obj.addEventListener)
{
obj.addEventListener(evType, eval(fn), false);
return true;
}
else if (obj.attachEvent)
{
var r = obj.attachEvent("on"+evType, eval(fn));
return r;
}
else
{
return false;
}
}
function rblur(val,obj)
{
if(val == 13)
{
$(obj).blur();
}
}
function oneHundredPercenter()
{
var ContentHeight = $('shell').offsetHeight;
var WindowHeight = top.window.innerHeightif(ContentHeight < WindowHeight)
{
SetHeight = (WindowHeight - 37 );
}
else
{
SetHeight = ContentHeight;
}
$('cl').style.height = SetHeight;
}function trim(stringToTrim)
{
return stringToTrim.replace(/^\s+|\s+$/g,"");
}function ltrim(stringToTrim)
{
return stringToTrim.replace(/^\s+/,"");
}function rtrim(stringToTrim)
{
return stringToTrim.replace(/\s+$/,"");
}function formtrim(el)
{
if($(el))
{
$(el).value = trim($(el).value);
}
}
function InventoryList(arg,objID)
{
if(arg == 1 && $('VehicleStartPoint').value){$('VehicleStartPoint').value = '';}
if(objID){objDest = objID;} else {objDest = cmain;}
advAJAX.get({
url: "/AJAX.php",
parameters : {
"query" :"inventory",
"SearchCategory":($('SearchCategory') ? $('SearchCategory').value : ''),
"VehicleStartPoint":($('VehicleStartPoint') ? $('VehicleStartPoint').value : ''),
"SearchText":($('SearchText') ? $('SearchText').value : ''),
"SearchMake":($('SearchMake') ? $('SearchMake').value : ''),
"SearchModel":($('SearchModel') ? $('SearchModel').value : ''),
"ShowWreck":($('ShowWreck') ? ($('ShowWreck').checked ? 1 : '') : ''),
"arg":(arg ? arg : ''),
"objID":(objID ? objID : '')
},
onInitialization : function() {
if(arg != 'home')
{
$(objDest).innerHTML = '<div align="center" style="padding: 15 0 15 0px"><img src="/images/waitbl.gif" width="16" height="16" style="padding-right: 7px" /><b>Searching Inventory - Please Wait...</b></div>';
}
},
onSuccess : function(obj) {
$(objDest).innerHTML = obj.responseText;
},
onError : function(obj) {
$(objDest).innerHTML = "<p>Error retrieving data - retrying...</p>";
},
retry: 5,
retryDelay: 1000
});
}
function VehicleFilter()
{
advAJAX.get({
url: "/AJAX.php",
parameters : {
"query" :"filter",
"SearchCategory":($('SearchCategory') ? $('SearchCategory').value : ''),
"SearchText":($('SearchText') ? $('SearchText').value : ''),
"SearchMake":($('SearchMake') ? $('SearchMake').value : ''),
"SearchModel":($('SearchModel') ? $('SearchModel').value : ''),
"ShowWreck":($('ShowWreck') ? ($('ShowWreck').checked ? 1 : '') : '')
},
onSuccess : function(obj) {
searchfilter.innerHTML = obj.responseText;
oneHundredPercenter();
},
onError : function(obj) {
searchfilter.innerHTML = "<p>Error retrieving data - retrying...</p>";
},
retry: 5,
retryDelay: 1000
});
}
function View(id)
{
Effect.Appear('waitspin', {duration: .02});
if(id)
{
scrollTo(0,0);
advAJAX.get({
url: "/AJAX.php",
parameters : {
"query" :"view",
"Vehicle":id
},
onSuccess : function(obj) {
var pagePos = $('shell').viewportOffset('left');
var offSetLeft = pagePos[0] - 13;
$('vdetail').setStyle({left: (offSetLeft < 0 ? 0 : offSetLeft), marginTop: '65px'});
$('shade').setStyle({height: ($('shell').getHeight() + $('ftr').getHeight()) });
$('shade').show();
Effect.Fade('shell', { duration: 0, from: 1.0, to: 0.4 });
$('vdetailwin').innerHTML = obj.responseText;
if($('vdetail') && $('vdetail').style.display == 'none')
{
Effect.toggle('vdetail','appear', {duration: .2});
var myTabs = new YAHOO.widget.TabView("DetailTabs");
}
Effect.Fade('waitspin',{duration: .5});
oneHundredPercenter();
},
onError : function(obj) {
vdetailwin.innerHTML = "<p>Error retrieving data - retrying...</p>";
},
retry: 5,
retryDelay: 1000
});
}
}
function Close()
{
if($('vdetail') && $('vdetail').style.display == '')
{
Effect.toggle('vdetail','appear', {duration: .5});
}
setTimeout("$('shade').hide()",600);
setTimeout("Effect.Appear('shell', { duration: 0, from: 0.4, to: 1.0 });",600);
}
function Photo(hash,objid)
{
if(hash)
{
$('pload').style.display = '';
imgDiv = 'lp'+objid;
advAJAX.get({
url: "/AJAX.php",
parameters : {
"query" :"photo",
"Hash":hash
},
onSuccess : function(obj) {
$(imgDiv).innerHTML = obj.responseText;
$('pload').style.display = 'none';
},
onError : function(obj) {
$(imgDiv).innerHTML = "<p>Error retrieving data - retrying...</p>";
},
retry: 5,
retryDelay: 1000
});
}
}
function MoreInfo(objid)
{
advAJAX.post({
url: "/AJAX.php?query=moreinfo",
parameters : {
"Name" :($('Name') ? $('Name').value : ''),
"EMail" :($('EMail') ? $('EMail').value : ''),
"Comment" :($('Comment') ? $('Comment').value : ''),
"Vehicle" :($('Vehicle') ? $('Vehicle').value : ''),
"Attention" :($('Attention') ? $('Attention').value : '')
},
onSuccess : function(obj) {
$('MoreInfo').innerHTML = '<h2>Information Request Sent</h2><p>Thank you for your comments/questions. An Argo representative will follow up with you shortly, if applicable.</p>';
},
retry: 5,
retryDelay: 1000
});
}
function fpphoto(photo,area)
{
preloadImages('/images/'+area+'-'+photo+'.gif');
$(photo).style.display = 'none';
$(photo).innerHTML = '<a href="/Browse.php"><img src="/images/'+area+'-'+photo+'.gif" /></a>';
Effect.toggle(photo,'appear', {duration: .5});
}function phcr(){setTimeout('fpphoto(\'cruiser\',\'bikes\')',1500);}
function phsp(){setTimeout('fpphoto(\'sport\',\'bikes\')',1000);}
function phcal(){setTimeout('fpphoto(\'left\',\'car\')',1000);}
function phcar(){setTimeout('fpphoto(\'right\',\'car\')',1500);}function backButtonOverride()
{
setTimeout("backButtonOverrideBody()", 1);
}function backButtonOverrideBody()
{
try
{
history.forward();
}
catch (e)
{
}
setTimeout("backButtonOverrideBody()", 500);
}