function show_search_box(e)
{
	var posi = new Array();
	posi=trackClick(e);
	var search_box='<form name="search_box" onsubmit="return validatebox(this);">';
		search_box+='<table border="0" cellpadding="0" cellspacing="0" width="275" style="border: 1px solid #C40C0C; padding: 3px;" bgcolor="#FCE8E8">';
		search_box+='<tr><td width="75%" height="25" class="normbldtxt">Find by IA Listing ID</td><td width="25%" align="right"><a href="javascript:;" onclick="hide_search_div(\'div_search\');" class="linktxt3">Close</a>&nbsp;</td></tr>';
		search_box+='<tr><td colspan="2" class="normtxt">If you know the vehicles listing ID, enter it below to go directly to that vehicle.</td></tr>';
		search_box+='<tr><td class="normbldtxt" height="25">IA Listing ID: <input type="text" name="listid" value="IA" style="width: 100px;"></td><td><input type="image" src="images/submit.gif" /></td></tr>';
		search_box+='</table>';
		search_box+='</form>';
	document.getElementById("div_search").style.visibility="visible";
	/*document.getElementById("div_search").style.left=posi[0]+"px";	
	document.getElementById("div_search").style.top=posi[1]+"px";	*/
	document.getElementById("div_search").innerHTML=search_box;
}
function hide_search_div(div_name)
{
	document.getElementById("div_search").style.visibility="hidden";
}

function validatebox(frm)
{
	var listval=frm.listid.value;
	var ll=listval.substr(2,6);
	
	if(listval=="")
	{
		alert("Please enter the listing id.");
		frm.listid.focus();
		return false;
	}
	
	if(listval.substr(0,2) != "IA" || listval.length<8)
	{
		alert("Please enter valid listing id.");
		frm.listid.focus();
		return false;
	}
	
	if(isNaN(ll))
	{
		alert("Please enter valid listing id.");
		frm.listid.focus();
		return false;
	}
	
	send_search(listval);
	return false;
}

function send_search(listval)
{
	var searchurl="http://cars.indiaautomobile.com/usedcars/"+listval;
	document.location.href= searchurl;
	return false;
}

function handlersendsearchHttpResponse()
{
	if(http.readyState == 4)
	{
		var return_str=http.responseText;
		document.getElementById("div_search").innerHTML=return_str;
	}
}

function trackClick(e) {
	var posi = new Array();
	//if (arguments.length == 0) e = event;
	/*if(navigator.appName.indexOf("Internet Explorer") != -1)
	{
		e=event;
	}
	else
	{
		e=window.event;
	}*/
	if (document.layers)
	{
		posi[0]=e.pageX;
		posi[1]=e.pageY;
	}
	else
	{
		posi[0]=e.clientX+document.body.scrollLeft;
		posi[1]=e.clientY+document.body.scrollTop;
		/*posi[0]=e.clientX+document.body.scrollLeft;
		posi[1]=e.clientY+document.body.scrollTop; */
	}
	return posi;
}

function getHTTPObject()
{
	var xmlhttp;
	try
	{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (e)
	{
		try 
		{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	
		}
		catch (E)
		{
			xmlhttp = false;
		}
	
	}
	
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		try
		{
			xmlhttp = new XMLHttpRequest();
		}
		catch (e)
		{
			xmlhttp = false;
		}
	}
	
	return xmlhttp;
}

//preloader starts


 // Time in seconds to wait before giving up on preload (broken 
  // images can cause the load to never get to 100%).
  
  var bt_timeout = 8;
  
  
  // Array of images to load; feel free to make this as long or
  // as short as you want. First element is filename (include path
  // to file), second is size of images in kB.
  
 
  // Text to use for when loading has finished
  var bt_text_finished = '';
  
  // Text to prefix the percentage
  var bt_text_prefix = '';
  
  
  function bt_done() {
    // stub function called when script is finished, put your JS here.
    // (you could use a javascript to redirect the user)
    
    }
//preloader ends
