function DoCallback(data)
{
	// branch for native XMLHttpRequest object
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open('POST', url, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.send(data);
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		req = new ActiveXObject('Microsoft.XMLHTTP')
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open('POST', url, true);
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			req.send(data);
		}
	}
}
function processReqChange() {
	// only if req shows 'loaded'
	if (req.readyState == 4) {
		// only if 'OK'
		if (req.status == 200) {
			eval(what);
		} else {
			alert('There was a problem retrieving the XML data:\n' +
				req.responseText);
		}
	}
}
function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
	document.getElementById('asdf').href=whichpic.href;
  }
  return false;
 } else {
  return true;
 }
}
function showTruckPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
  } else {
   document.getElementById('main_img_link').href=whichpic.href;
  }
  return false;
 } else {
  return true;
 }
}
function chBg(obj) {
		obj.bgColor = "#ADAAEC";
}
function chBg2(obj) {
		obj.bgColor = "#C3C1F1";
}
function PageJumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function makeHttpRequest(url, callback_function, return_xml) {
   var http_request = false;

   if (window.XMLHttpRequest) { // Mozilla, Safari,...
       http_request = new XMLHttpRequest();
       if (http_request.overrideMimeType) {
           http_request.overrideMimeType('text/xml');
       }

   } else if (window.ActiveXObject) { // IE
       try {
           http_request = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
           try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
           } catch (e) {}
       }
   }

   if (!http_request) {
       alert('Unfortunatelly you browser doesn\'t support this feature.');
       return false;
   }
   http_request.onreadystatechange = function() {
       if (http_request.readyState == 4) {
           if (http_request.status == 200) {
               if (return_xml) {
                   eval(callback_function + '(http_request.responseXML)');
               } else {
                   eval(callback_function + '(http_request.responseText)');
               }
           } else {
               //alert('There was a problem with the request.(Code: ' + http_request.status + ')');
           }
       }
   }
   http_request.open('GET', url, true);
   http_request.send(null);
}
function loadBanner(xml)
{
    var html_content = xml.getElementsByTagName('content').item(0).firstChild.nodeValue;
    var reload_after = xml.getElementsByTagName('reload').item(0).firstChild.nodeValue;
    document.getElementById('ajax-banner').innerHTML = html_content;
    try {
        clearTimeout(to);
    } catch (e) {}
    to = setTimeout("nextAd()", parseInt(reload_after));
}
function nextAd()
{
    var now = new Date();
    var url = 'ajax-banner.php?ts=' + now.getTime();
    makeHttpRequest(url, 'loadBanner', true);
}
window.onload = nextAd;
var url = "country.php";
var what = "SetStates(req.responseText)";
function GetStatesQuick(Country)
{
	var url = "quick_country.php";	
	DoCallback("country="+Country);
}
function GetStates(Country)
{	
	if(document.QForm.car.checked == true)
	{
		var car = document.QForm.car.value;
	}
	else
	{
		var car = "";
	}
	if(document.QForm.truck.checked == true)
	{
		var truck = document.QForm.truck.value;
	}
	else
	{
		var truck = "";
	}
	if(document.QForm.suv.checked == true)
	{
		var suv = document.QForm.suv.value;
	}
	else
	{
		var suv = "";
	}
	if(document.QForm.van.checked == true)
	{
		var van = document.QForm.van.value;
	}
	else
	{
		var van = "";
	}
	DoCallback("country="+Country+"&car="+car+"&truck="+truck+"&suv="+suv+"&van="+van);
}
function SetStates(States)
{
	var stateBox = document.getElementById("state");
	stateBox.options.length = 0;
	if(States != "")
	{
		var arrStates = States.split(",");
		for(i = 0; i < arrStates.length; i++)
		{
			if(arrStates[i] != "")
			{
				stateBox.options[stateBox.options.length] = new Option(arrStates[i], arrStates[i]);
			}
		}
	}
}
