// JavaScript Document
function populate1(o)
			{
				d=document.getElementById('brandlist');
				if(!d){return;}			
				var mitems=new Array();
				mitems['Car']=['--select--','Audi','Bentley','BMW','Chevrolet','Fiat','Ford','Hindustan Motors','Honda','Hyundai','ICML','Lamborghini','Mahindra','Mahindra-Renault','Maruti Suzuki','Maini-Reva','Maybach','Mercedes-Benz','Mitsubishi','Nissan','Porsche','Rolls-Royce','San','Skoda','Tata','Toyota','Volkswagen','Volvo'];
				mitems['Bike']=['--select--','Bajaj Auto','Hero Honda','Kinetic Motor','LML India','Royal Enfield','TVS Motor','Honda','Suzuki Motor','Yamaha Motor'];
	
				d.options.length=0;
				cur=mitems[o.options[o.selectedIndex].value];
				if(!cur){return;}
				d.options.length=cur.length;
				for(var i=0;i<cur.length;i++)
				{
					d.options[i].text=cur[i];
					d.options[i].value=cur[i];
				}
			
			 		
			}
			
			function populate2(o)
			{
				d=document.getElementById('budgetlist');
				if(!d){return;}			
				var mitems=new Array();
				mitems['Car']=['--select--','Below 1,00,000','1,00,000 to 5,00,000','5,00,001 to 10,00,000','10,00,001 to 15,00,000','15,00,001 to 20,00,000','20,00,001 to 25,00,000','25,00,001 to 30,00,000','30,00,001 to 40,00,000','Above 40,00,001'];
				mitems['Bike']=['--select--','Below 10,000','10,000 to 20,000','20,001 to 35,000','35,001 to 55,000','55,001 to 75,000','75,001 to 1,00,000','Above 1,00,001'];
	
				d.options.length=0;
				cur=mitems[o.options[o.selectedIndex].value];
				if(!cur){return;}
				d.options.length=cur.length;
				for(var i=0;i<cur.length;i++)
				{
					d.options[i].text=cur[i];
					d.options[i].value=cur[i];
				}
				
				
			}
			
			function populate3(o)
			{
				d=document.getElementById('bodydesign');
				if(!d){return;}			
				var mitems=new Array();
				mitems['Car']=['--select--','Sedan','Coupe','Hatchback','Minivan-Van','Convertible','SUV','Truck','Station Wagon','MUV'];
				mitems['Bike']=['--select--','Below 150 CC','151 CC to 200 CC','201 CC to 250 CC','251 CC to 350 CC','Above 350 CC'];
	
				d.options.length=0;
				cur=mitems[o.options[o.selectedIndex].value];
				if(!cur){return;}
				d.options.length=cur.length;
				for(var i=0;i<cur.length;i++)
				{
					d.options[i].text=cur[i];
					d.options[i].value=cur[i];
				}
				
				
			}
		
		
		
		
		/* Second Box */
		
		function populate4(o)
			{
				d=document.getElementById('brandlist2');
				if(!d){return;}			
				var mitems=new Array();
				mitems['Car']=['--select--','Audi','Bentley','BMW','Chevrolet','Fiat','Ford','Hindustan Motors','Honda','Hyundai','ICML','Lamborghini','Mahindra','Mahindra-Renault','Maruti Suzuki','Maini-Reva','Maybach','Mercedes-Benz','Mitsubishi','Nissan','Porsche','Rolls-Royce','San','Skoda','Tata','Toyota','Volkswagen','Volvo'];
				mitems['Bike']=['--select--','BAJAJ AUTO LIMITED','Hero Honda','Kinetic Motor','LML India','Royal Enfield','TVS','Honda','Suzuki','Yamaha', 'Yo Bikes'];
	
				d.options.length=0;
				cur=mitems[o.options[o.selectedIndex].value];
				if(!cur){return;}
				d.options.length=cur.length;
				for(var i=0;i<cur.length;i++)
				{
					d.options[i].text=cur[i];
					d.options[i].value=cur[i];
				}
			
			 		
			}
			
			function populate5(o)
			{
				d=document.getElementById('budgetlist2');
				if(!d){return;}			
				var mitems=new Array();
				mitems['Car']=['--select--','Below 1,00,000','1,00,000 to 5,00,000','5,00,001 to 10,00,000','10,00,001 to 15,00,000','15,00,001 to 20,00,000','20,00,001 to 25,00,000','25,00,001 to 30,00,000','30,00,001 to 40,00,000','Above 40,00,001'];
				mitems['Bike']=['--select--','Below 10,000','10,000 to 20,000','20,001 to 35,000','35,001 to 55,000','55,001 to 75,000','75,001 to 1,00,000','Above 1,00,001'];
	
				d.options.length=0;
				cur=mitems[o.options[o.selectedIndex].value];
				if(!cur){return;}
				d.options.length=cur.length;
				for(var i=0;i<cur.length;i++)
				{
					d.options[i].text=cur[i];
					d.options[i].value=cur[i];
				}
				
				
			}
			
			function populate6(o)
			{
				d=document.getElementById('bodydesign2');
				if(!d){return;}			
				var mitems=new Array();
				mitems['Car']=['--select--','Sedan','Coupe','Hatchback','Minivan-Van','Convertible','SUV','Truck','Station Wagon','MUV'];
				/*mitems['Bike']=['--select--','Below 150 CC','151 CC to 200 CC','201 CC to 250 CC','251 CC to 350 CC','Above 350 CC'];*/
				mitems['Bike']=[''];
				
				d.options.length=0;
				cur=mitems[o.options[o.selectedIndex].value];
				if(!cur){return;}
				d.options.length=cur.length;
				for(var i=0;i<cur.length;i++)
				{
					d.options[i].text=cur[i];
					d.options[i].value=cur[i];
				}
				
				
			}
				
      
//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="#">New Cars</a>'
menu1[1]='<a href="#">Old Cars</a>'
menu1[2]='<a href="#">Modify Car</a>'
menu1[3]='<a href="#">Car Spares</a>'
menu1[4]='<a href="#">Upcoming Cars</a>'
menu1[5]='<a href="#">Sell Car</a>'
menu1[6]='<a href="#">Compare Cars</a>'


var menu2=new Array()
menu2[0]='<a href="#">New Bikes</a>'
menu2[1]='<a href="#">Old Bikes</a>'
menu2[2]='<a href="#">Modify Bike</a>'
menu2[3]='<a href="#">Bike Spares</a>'
menu2[4]='<a href="#">Upcoming Bikes</a>'
menu2[5]='<a href="#">Sell Bike</a>'
menu2[6]='<a href="#">Compare Bikes</a>'

//Contents for menu 2, and so on
var menu3=new Array()
menu3[0]='<a href="#">Cars</a>'
menu3[1]='<a href="#">Bikes</a>'

var menu4=new Array()
menu4[0]='<a href="#">Cars</a>'
menu4[1]='<a href="#">Bikes</a>'

var menu5=new Array()
menu5[0]='<a href="sell.php">Cars</a>'
menu5[1]='<a href="sellbike.php">Bikes</a>'

var menu6=new Array()
menu6[0]='<a href="expert.php">Used Car Pricing</a>'
menu6[1]='<a href="new_car_price.php">New Car Pricing</a>'
menu6[2]='<a href="question.php">General Query</a>'
menu6[3]='<a href="bike_price.php">New Bike Pricing</a>'

var menu7=new Array()
menu7[0]='<a href="#">Cars</a>'
menu7[1]='<a href="#">Bikes</a>'

var menu8=new Array()
menu8[0]='<a href="used_cars.php">Used Cars</a>'
menu8[1]='<a href="used_bikes.php">Used Bikes</a>'




		
var menuwidth='165px' //default menu width
var menubgcolor='white'  //menu bgcolor

var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top="-500px"
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")

}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)



dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
document.onclick=hidemenu

function anyCheck(f){
var t=0;
var c=f['compare[]'];
for(var i=0;i<c.length;i++){
c[i].checked?t++:null;
}
	if(t<5 && t>1)
	{
	 document.getElementById('limit').value = t;
	 document.car_compare.submit();
	}
	else
	{
	 alert('You can compare only minimum 2 and maximum 4 cars');
	} 
}

<!------------------ COMpare multiple select for index.php -------------------------->
						
						function restrictQty(listObj) {
						
						
						
						var listArray = new Array();
						var limit = 4;
						var count=0;
						
						for (var i=0; i<listObj.length; i++) {
						if (listObj.options[i].selected) {
						count++;
						if (count > limit) {
						alert("Limit Exceeded");
						break;
						}
						else {
						if (listArray.length < limit) {
						listArray[listArray.length] = listObj.options[i].value;
						}
						}
						}
						}
						
						for (var i=0; i<listObj.length; i++) {
						listObj.options[i].selected = false;
						for (var j=0; j<listArray.length; j++) {
						if (listArray[j] == listObj.options[i].value) {
						listObj.options[i].selected = true;
						}
						}
						}
						}
						
						<!------------------ End COMpare multiple select for index.php -------------------------->

function validate_form1(listObj)
 {
  
     if(document.listObj["compare[]"].value == "")
	 {
	 alert('Please choose a widget for Question #2!');
	 return false; 
	 }
	
}


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

/* Screen resolution check*/

function writeCookie(name, value, days){
    var expire = "";
    
        expire = new Date((new Date()).getTime() + days * 24 * 3600000);
        expire = "; expires=" + expire.toGMTString();
    
    document.cookie = name + "=" + escape(value) + expire;
}
writeCookie('screenWidth', screen.width, 365);
writeCookie('screenHeight', screen.height, 365);


