function trim(s)
{   var i;
    var returnString = "";
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function getComputedHeight(theElt){
	if(navigator.appName=='Microsoft Internet Explorer'){
		tmphght = document.getElementById(theElt).offsetHeight;
	}
	else{
		docObj = document.getElementById(theElt);
		var tmphght1 = document.defaultView.getComputedStyle(docObj, "").getPropertyValue("height");
		tmphght = tmphght1.split('px');
		tmphght = tmphght[0];
	}
	return tmphght;
}

temp=0;mell=0;
function move_v (obj,start,end,time,ease,stopper,y)
{			
			if(navigator.appName=='Microsoft Internet Explorer'){time=time/4;}
			var k="bihy" + Math.ceil(Math.random() * 1000000)
			eval(k+"=new Object();");eval(k+".id=obj;");var count=Math.ceil(time/0.04);			
			var icount=1/count;
			var count2=0;var temp2378578945=start;var dist3474y4ty4=end-start; var interval=dist3474y4ty4/count;
			  eval(k+".handleSize=function(){ if(ease==0){start = temp2378578945 + dist3474y4ty4 * count2*icount;this.id.style.top=start+'px';count2 ++;}			else { start =temp2378578945 + dist3474y4ty4 * Math.sin(Math.PI * count2 * icount * 0.5);this.id.style.top=start+'px';count2 ++;"+y +"=start;} if(count2 <=count && "+stopper +"!=1){setTimeout('"+k+".handleSize()',40); }}");
			eval("setTimeout('"+k+".handleSize()',40);");
}

var sliderwidth="1000"
var sliderheight="50"
var slidespeed=1
var copyspeed=slidespeed;
var slidebgcolor="#FFFF99"
var actualwidth=2579

function fillup(x1, x2, wrap)
{
	var y=document.getElementById? document.getElementById(x1) : document.all.x1
	var z=document.getElementById? document.getElementById(x2) : document.all.x2
	z.style.left=actualwidth+"px"
	slideleft(y,z)
	//lefttime=setInterval("checkDirection('cross_slide','cross_slide2','test2','test3',0)", 90);
}


function slideleft(y,z)
{
	if(actualwidth>sliderwidth)
	{
		if(copyspeed > 0 )
		{
			if (parseInt(y.style.left)>(actualwidth*(-1)+copyspeed))
			y.style.left=parseInt(y.style.left)-copyspeed+"px"
			else
			y.style.left=parseInt(z.style.left)+actualwidth-copyspeed+"px"
			if (parseInt(z.style.left)>(actualwidth*(-1)+copyspeed))
			z.style.left=parseInt(z.style.left)-copyspeed+"px"
			else
			z.style.left=parseInt(y.style.left)+actualwidth-copyspeed+"px"
		}
		setTimeout(function (){slideleft(y, z);}, 25);
	}
}

function request(){	if(window.XMLHttpRequest){return new XMLHttpRequest();}	else if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHttp");}else{	document.getElementById("status").innerHTML = 'Your browser does not support this chat facility.' + ' Consider upgrading your browser.';}}

var loadReq=request();

function loadmodels()
{
	var v = document.getElementById('listmakes').value;
	if(v != '')
	{
		if(loadReq.readyState==4 || loadReq.readyState==0)
		{
			loadReq.open("GET", 'ajax.php?make='+v, true);
			loadReq.onreadystatechange = this.handleLoad;
			loadReq.send(null);
		}
	}
}

function handleLoad()
{
	if(loadReq.readyState==4  || loadReq.readyState==0)
	{
		var j='^_!*';
		var xmldoc = loadReq.responseXML;
		var msg = xmldoc.getElementsByTagName('message');
		var model_node = msg[0].getElementsByTagName('model');
		var model = model_node[0].firstChild.nodeValue;
		var m = model.split(j);
		var sel=document.getElementById('model'); var n=m.length;
		sel.options.length=0;
		var anOption = document.createElement("option") ;
		var txt=document.createTextNode('All Models');
		anOption.appendChild(txt);
		anOption.value='';
		sel.options.add(anOption);
		for (var i=0; i < n; i++)
		{
			var anOption = document.createElement("option") ;
			var txt=document.createTextNode(m[i]);
			anOption.appendChild(txt);
			sel.options.add(anOption); 
		}
	}
}

function countkids(parxml)
{
	var realKids = 0;var kids;var i=0;
	kids = parxml.childNodes.length;
	while(i < kids){
		if(parxml.childNodes[i].nodeType != 3){
			realKids++;
		}
		i++;
	}
	return realKids;
}

function runme () {fillup('logo', 'logo2', 'logo_div2');}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(runme);
