 
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}
function popitup(url,w,h){
	window.open(url, 'help', 'width='+w+',height='+h+',resizable,scrollbars=yes');
}
function show(object) {
    if (document.getElementById) {
		node = document.getElementById(object).style.visibility='visible';
	} else if (document.layers) {
		document.layers[object].visibility = 'visible';
	} else if (document.all) {
		document.all[object].style.visibility = 'visible';
	}
}
function hide(object) {
    if (document.getElementById) {
		node = document.getElementById(object).style.visibility='hidden';
	} else if (document.layers) {
		document.layers[object].visibility = 'hidden';
	} else if (document.all) {
		document.all[object].style.visibility = 'hidden';
	}
}
function showblock(object) {
    if (document.getElementById) {
		node = document.getElementById(object).style.display='block';
	} else if (document.layers) {
		document.layers[object].display = 'block';
	} else if (document.all) {
		document.all[object].style.display = 'block';
	}
}
function hideblock(object) {
    if (document.getElementById) {
		node = document.getElementById(object).style.display='none';
	} else if (document.layers) {
		document.layers[object].display = 'none';
	} else if (document.all) {
		document.all[object].style.display = 'none';
	}
}
function showCompletely(object) {
    show(object);
	showblock(object);
}

function hideCompletely(object) {
    hide(object);
	hideblock(object);
}
function toggleSearch(object){
	if(document.getElementById('_tires'))
	{
		hide('_tires');
		hideblock('_tires');
	}
	if(document.getElementById('_wheels'))
	{
		hide('_wheels');
		hideblock('_wheels');
	}
	if(document.getElementById('_packages'))
	{
		hide('_packages');
		hideblock('_packages');
	}
	if(document.getElementById(object))
	{
		showblock(object);
		show(object);
	}
	return;
}
function change(changeplace,getinfofrom){
	var newdata = document.getElementById(getinfofrom).innerHTML
	document.getElementById(changeplace).innerHTML = newdata;
}
function setCookie(name, value, expires){
	document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString());
}
function getCookie (name) {
  var dc = document.cookie;
  var cname = name + "=";

  if (dc.length > 0) {
	begin = dc.indexOf(cname);
	if (begin != -1) {
	  begin += cname.length;
	  end = dc.indexOf("", begin);
	  if (end == -1) end = dc.length;
	  return unescape(dc.substring(begin, end));
	}
  }
  return null;
}


/* Now, make the new Date object and set it 30 days ahead: */
var exp = new Date();     //set new date object
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30));     //set it 30 days ahead 

function sendInfoToSubmit(checkarea,itemsid) {
	
//	alert(checkarea);
//	alert(itemsid);

	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			
			{ 
				if(req.status !== 200){
					//alertcontetns = "Error: returned status <br />code " + req.status + " " + req.statusText;
			}
			} 
		};
		req.open("GET", "quickcheck.php?checksession="+checkarea+"&itemID="+itemsid , true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 

}

function sendInfoToSubmitLink(checkarea,itemsid,linktogoto) {
	
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			
			{ 
				if(req.status !== 200){
					//alertcontetns = "Error: returned status <br />code " + req.status + " " + req.statusText;
				} else {
//					alert(linktogoto);
					document.location.href=linktogoto
				}
			} 
		};
		req.open("GET", "quickcheck.php?checksession="+checkarea+"&itemID="+itemsid , true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 

}

function ckeckforoptions (checkarea, comparenumber) {

//	alert(checkarea);
	if (comparenumber == '0') {
		document.forms.addcart.submit();	
	} else {
		
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
				
				numbercount = req.responseText;
				
				if (numbercount == comparenumber) {
				document.forms.addcart.submit();			
				} else {
					
//					alert(numbercount);
					
					alert('Please choose the options for this item');
				}
				
			}
			else {
					alert("Error: returned status <br />code " + req.status + " " + req.statusText);
				}
			} 
		};
		req.open("GET", "quickcheck.php?getsession="+checkarea , true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
	}
}

var OPTION_ADDON_COSTS=new Array();


function swapProdOptionDivs(prodID, optionTypeID, onOrOff, priceToAdd, optionID) {
	editbutton = 'editbutton' + optionTypeID; 
	swatches = 'swatches' + optionTypeID; 
	if(onOrOff == 1) {
		showblock(editbutton);
		hideblock(swatches);
		
		d = document.getElementById('val_baseprice');
		var baseprice = d.value * 1;
		
		OPTION_ADDON_COSTS[optionTypeID] = priceToAdd;
		
		var addlPrice = 0;
		for( var TYPEID in OPTION_ADDON_COSTS ) {
			addlPrice = addlPrice + OPTION_ADDON_COSTS[TYPEID] * 1;
		} 
	
		d = document.getElementById('val_currentprice');
		var newtotalcost = baseprice + addlPrice;
		newtotalcost = newtotalcost.toFixed(2);
		d.value = newtotalcost;
		
		d = document.getElementById('val_optionType_'+optionTypeID);
		d.value = optionID;
		
		d = document.getElementById('price');
		d.innerHTML = '$<b>' + newtotalcost + '<\/b>';
	
	} else {
		hideblock(editbutton);
		showblock(swatches);
	}
	//alert(prodID + ' - ' + optionTypeID);
  	var cookiename = 'optionsArray[' + prodID + '][' + optionTypeID + ']';
	var exp = new Date();     //set new date object
	exp.setTime(exp.getTime() + (1000 * 60));     //set it 1 minute ahead
  	setCookie(cookiename, optionID, exp);
}





/*
function setBasePrice(newPrice) {
  alert(newPrice);
	d = document.getElementById('val_baseprice');
	d.value = newPrice;

	var baseprice = newPrice;
	var addlPrice = 0;
	for( var TYPEID in OPTION_ADDON_COSTS ) {
	  addlPrice = addlPrice + OPTION_ADDON_COSTS[TYPEID] * 1;
	} 

	var newtotalcost = baseprice + addlPrice;
	newtotalcost = newtotalcost.toFixed(2);

	d = document.getElementById('price');
	d.innerHTML = '$<b>' + newtotalcost + '<\/b>';
	alert(newtotalcost);
}
*/



function switchWillCall()
{
  if(document.checkoutform.willcall.options[1].selected == true) {
	show('willcallprice');
	show('willCallInfo');
	show('grandtotalwillcall');
	show('purchasememowillcall');
	hide('shipprice');
	hide('shippingAddress');
	hide('grandtotal');
	hide('purchasememo');
		
  } else {
	hide('willcallprice');
	hide('willCallInfo');
	hide('grandtotalwillcall');
	hide('purchasememowillcall');
	show('shipprice');
	show('shippingAddress');
	show('grandtotal');
	show('purchasememo');
  }
}



function fillLoupe(loupeNumber, newImage, htmlToWrite) {
  var loupeName = 'loupe' + loupeNumber; 
  var loupeHTML = 'loupedesc' + loupeNumber; 
  document[loupeName].src=newImage;
  d = document.getElementById(loupeHTML)
  d.innerHTML = htmlToWrite;
}

function clearLoupe(loupeNumber) {
  var loupeName = 'loupe' + loupeNumber;
  var loupeHTML = 'loupedesc' + loupeNumber; 
  document[loupeName].src='images/blank.gif';
  d = document.getElementById(loupeHTML)
  d.innerHTML = '';
}


function getModel (wherto, make, model, year, typeofsearch) {
	var extendedmake;
	
	var makenumber = document.getElementById(make);
	var modelnumber = document.getElementById(model);
	var yearnumber = document.getElementById(year);
	
//var sIndex = makenumber.selectedIndex;
//alert("Index: " + sIndex);
//alert("V: " + makenumber.options[makenumber.selectedIndex].value);

	if (makenumber.options[makenumber.selectedIndex].value == 'null') {

		makeIntoNothing('model');
		makeIntoNothing('year');
		//makeIntoNothing('options');
	}else if (modelnumber.options[modelnumber.selectedIndex].value == 'null') {

		makeIntoNothing('year');
		//makeIntoNothing('options');
	}else if (yearnumber.options[yearnumber.selectedIndex].value == 'null') {

		//makeIntoNothing('options');
	}else {

		

	
	extendedmake ='';
	
	if (makenumber.selectedIndex != '0') {
		makename = makenumber.options[makenumber.selectedIndex].value;
		extendedmake += "make=" + makename;
	} else {
		extendedmake += "make=";
	}
	
	
	if (modelnumber.selectedIndex != '0') {
		modelname = modelnumber.options[modelnumber.selectedIndex].value;
		extendedmake += "&model=" + modelname;
	} else {
		if (wherto == 'year') {
			extendedmake += "&model="+modelnumber.options[1].value;	
		} else {
			extendedmake += "&model=";
		}
		
	}
	

	if (yearnumber.selectedIndex != '0') {
		yearname = yearnumber.options[yearnumber.selectedIndex].value;
		extendedmake += "&year=" + yearname;
	} else {
		extendedmake += "&year=";
	}
	
	if (typeofsearch == "car") {
		extendedmake += '&search=car'
	} else {
		extendedmake += '&search=wheel'		
	}
	
//	alert(extendedmake)	;
	
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
//					alert(req.responseText);
					
					getstr = req.responseText
					var getarray = getstr.split("*");
					var strLength =  getarray.length;
					document.getElementById(wherto).options.length = 0;
					
					
						for(var i=0; i < strLength; i++) {
							var temparray = getarray[i].split(":");
							var secondvalue = temparray[0];
							var firstvalue = temparray[1];
							document.getElementById(wherto).options[ i ] = new Option(firstvalue,secondvalue);
						}
						
						if (wherto == 'year') {
							//document.getElementById('submit').removeAttribute('disabled');
						}

						if (wherto == 'year2') {
							//document.getElementById('submit2').removeAttribute('disabled');
						}
//	uncomment the bottom line to view the str in the screen
//
//					document.getElementById('errors').innerHTML = req.responseText ;
					document.getElementById(wherto).removeAttribute('disabled');
				}else {
					document.getElementById('errors').innerHTML="Error: returned status <br />code " + req.status + " " + req.statusText;
				}
			} 
		};
		req.open("GET", "option_populater.php?" + extendedmake, true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
	} 
	
}
function getModel2 (wherto, make, model, year, typeofsearch) {
	var extendedmake;
	
	var makenumber = document.getElementById(make);
	var modelnumber = document.getElementById(model);
	var yearnumber = document.getElementById(year);
	
//var sIndex = makenumber.selectedIndex;
//alert("Index: " + sIndex);
//alert("V: " + makenumber.options[makenumber.selectedIndex].value);

	if (makenumber.options[makenumber.selectedIndex].value == 'null') {

		makeIntoNothing('model');
		makeIntoNothing('year');
		//makeIntoNothing('options');
	}else if (modelnumber.options[modelnumber.selectedIndex].value == 'null') {

		makeIntoNothing('year');
		//makeIntoNothing('options');
	}else if (yearnumber.options[yearnumber.selectedIndex].value == 'null') {

		//makeIntoNothing('options');
	}else {

		

	
	extendedmake ='';
	
	if (makenumber.selectedIndex != '0') {
		makename = makenumber.options[makenumber.selectedIndex].value;
		extendedmake += "make=" + makename;
	} else {
		extendedmake += "make=";
	}
	
	
	if (modelnumber.selectedIndex != '0') {
		modelname = modelnumber.options[modelnumber.selectedIndex].value;
		extendedmake += "&model=" + modelname;
	} else {
		if (wherto == 'year') {
			extendedmake += "&model="+modelnumber.options[1].value;	
		} else {
			extendedmake += "&model=";
		}
		
	}
	

	if (yearnumber.selectedIndex != '0') {
		yearname = yearnumber.options[yearnumber.selectedIndex].value;
		extendedmake += "&year=" + yearname;
	} else {
		extendedmake += "&year=";
	}
	
	if (typeofsearch == "car") {
		extendedmake += '&search=car'
	} else {
		extendedmake += '&search=wheel'		
	}
	
//	alert(extendedmake)	;
	
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
//					alert(req.responseText);
					
					getstr = req.responseText
					var getarray = getstr.split("*");
					var strLength =  getarray.length;
					document.getElementById(wherto).options.length = 0;
					
					
						for(var i=0; i < strLength; i++) {
							var temparray = getarray[i].split(":");
							var secondvalue = temparray[0];
							var firstvalue = temparray[1];
							document.getElementById(wherto).options[ i ] = new Option(firstvalue,secondvalue);
						}
						
						if (wherto == 'year') {
							//document.getElementById('submit').removeAttribute('disabled');
						}

						if (wherto == 'year2') {
							//document.getElementById('submit2').removeAttribute('disabled');
						}
//	uncomment the bottom line to view the str in the screen
//
//					document.getElementById('errors').innerHTML = req.responseText ;
					document.getElementById(wherto).removeAttribute('disabled');
				}else {
					document.getElementById('errors').innerHTML="Error: returned status <br />code " + req.status + " " + req.statusText;
				}
			} 
		};
		req.open("GET", "../../option_populater.php?" + extendedmake, true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
	} 
	
}

function bringbacktozero(placeThatNeedsZero) {
	document.getElementById(placeThatNeedsZero).selectedIndex = '0';
//	document.getElementById(placeThatNeedsZero).options.length = 0;
}



function makeIntoNothing(thatnothing) {
//	prrrp = document.getElementById(thatnothing).options.length;
//	alert (prrrp);
	document.getElementById(thatnothing).options.length = 0;
	for (i=0 ; i < 4; i++) {
		document.getElementById(thatnothing).options[i] = new Option('------',i);
		document.getElementById(thatnothing).setAttribute('disabled','disabled');
	}
}

function removedisabled(removedisabledlink) {
	document.getElementById(removedisabledlink).removeAttribute('disabled')
}

// function for only the year button , to prevent false sending of '-----' lines
function removedashedlines(whichbox,removalbox) {
	yearbox = document.getElementById(whichbox)
	whichyearboxvalue = yearbox.options[0].value;
	if (whichyearboxvalue == "null") {
		//remove option value, else nothing.
		yearbox.options[0] = null;
	} 
	
	removedisabled(removalbox);
}


function makedisabled(disabledlink) {
	document.getElementById(disabledlink).setAttribute('disabled','disabled');
}

function sendzip(getzip) {
	
	getzipvalue =  document.getElementById(getzip).value;

	if (getzipvalue != '') {
	
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
					
					findzipstr = req.responseText;
					//alert(findzipstr);
					
					if (findzipstr.length > '3' ) {													// error message - error
						var ziparray = findzipstr.split(":");
						document.getElementById('errors').innerHTML = ziparray[1];

					}else if(findzipstr.length == '2') {											// out of zipcode range, not socal - no
						//switches out the search menu display
                        document.getElementById('search_menu_display1').style.display = 'none';
                        document.getElementById('search_menu_display3').style.display = 'inline';
                        
						document.getElementById('zip_locater').style.display ='none';
						document.getElementById('search_box').style.display ='inline';
						
						document.getElementById('socal_only').style.display ='none';
						//document.getElementById('errors').innerHTML = "thanks!";
						
						/* Remove this comment block to show old roadhazard ads
						// Show RoadHazard Image
                        document.getElementById('roadhazard').style.display = 'inline';
                        document.getElementById('roadhazard').style.visibility = 'visible';
						// Show RoadHazard Footer
                        document.getElementById('roadhazard_footer').style.display = 'inline';
                        document.getElementById('roadhazard_footer').style.visibility = 'visible';
						// Hide History Image
                        document.getElementById('history').style.display = 'none';
                        document.getElementById('history').style.visibility = 'hidden';
						*/
						
						// Hide Maintenance Image
                  //      document.getElementById('maintenance').style.display = 'none';
                  //      document.getElementById('maintenance').style.visibility = 'hidden';
						// Hide Maintenance Footer
                        document.getElementById('maintenance_footer').style.display = 'none';
                        document.getElementById('maintenance_footer').style.visibility = 'hidden';
					}else { 																		// in zipcode range, is socal - yes
                        document.getElementById('search_menu_display1').style.display = 'none';
                        document.getElementById('search_menu_display2').style.display = 'inline';
						
						document.getElementById('zip_locater').style.display ='none';
						document.getElementById('search_box').style.display ='inline';
						
						//document.getElementById('_storesinside').innerHTML = retreive_stores();
						document.getElementById('errors').innerHTML = "thanks!";
                 //       document.getElementById('roadImage').src = 'images/layout/socal.png';
                 //       document.getElementById('roadLink').href = '';

						/* Remove this comment block to show old roadhazard ads
                        // Show Maintenance Image
                  //      document.getElementById('maintenance').style.display = 'inline';
                  //      document.getElementById('maintenance').style.visibility = 'visible';
						// Hide RoadHazard Image
                        document.getElementById('roadhazard').style.display = 'none';
                        document.getElementById('roadhazard').style.visibility = 'hidden';
						// Hide History Image
                        document.getElementById('history').style.display = 'none';
                        document.getElementById('history').style.visibility = 'hidden';
						*/
						
                        // Show Maintenance Footer
                        document.getElementById('maintenance_footer').style.display = 'inline';
                        document.getElementById('maintenance_footer').style.visibility = 'visible';
						// Hide RoadHazard Footer
                        document.getElementById('roadhazard_footer').style.display = 'none';
                        document.getElementById('roadhazard_footer').style.visibility = 'hidden';

					}
					window.location.href='index.php';
				}else {
					document.getElementById('errors').innerHTML="Error: returned status <br />code " + req.status + " " + req.statusText;
				}
			} 
		};
		req.open("GET", "option_populater.php?zip=" + getzipvalue, true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
		
	}else{ 
		document.getElementById('errors').innerHTML = " Please enter a value";
    }
	
}


function retreive_stores() {
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
				
				document.getElementById('_storesinside').innerHTML = req.responseText
				
				}else {
					document.getElementById('errors').innerHTML="Error: returned status <br />code " + req.status + " " + req.statusText;
				}
			} 
		};
		req.open("GET", "option_populater.php?getstores=yes", true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
		
	
}

function openwheel(wheelplace, placeofnumber, wheelcount, selectedcolor, presentlocation) {
	
			if (document.getElementById(wheelplace+placeofnumber).style.display == 'none') {
			document.getElementById(wheelplace+placeofnumber).style.display = 'block';
			
			document.getElementById(presentlocation).className = 'colorchange_over';
						
			for(i=0 ; i < wheelcount; i++) {
			document.getElementById(wheelplace+i).style.display = 'none'
			document.getElementById('whl_'+i+'_'+selectedcolor).className = 'colorchange';
				if (document.getElementById(wheelplace+placeofnumber).style.display == 'none') {
					document.getElementById(wheelplace+placeofnumber).style.display = 'block';
					document.getElementById(presentlocation).className = 'colorchange_over';
				}
				
			}
		} else {
			document.getElementById(wheelplace+placeofnumber).style.display = 'none';
			document.getElementById(presentlocation).className = 'colorchange';
		}
}

function getimage (matrix, neo, zion, anderson) {
	
	var nebuchadnezzar = document.getElementById(matrix)
	var entermatrix = matrix
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
					the_redpill = req.responseText;
					nebuchadnezzar.style.display = 'block';
					if (the_redpill == '') {
					nebuchadnezzar.innerHTML = '<div><a href="product_detail.php?c='+anderson+'&amp;prodID='+neo+'"><img src="images/images_products/'+ zion+'/normal/notire.png" width="150" /></a><br />click for more details<br />';
					} else {
					nebuchadnezzar.innerHTML = '<div><a href="product_detail.php?c='+anderson+'&amp;prodID='+neo+'"><img src="images/images_products/'+ zion+'/normal/'+the_redpill+'" width="150" /></a><br />click for more details<br />';
					}
				
					
				}else {
					document.getElementById('errors').innerHTML="Error: returned status <br />code " + req.status + " " + req.statusText;
				}
			} 
		};
		req.open("GET", "option_populater.php?imagecheck=" + neo + "&whichDB=" + zion, true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
}

function closeimage (realworld) {
	document.getElementById(realworld).style.display = 'none';
}

function checkenter(theinputboxinquestion, sendwhat) {

var keynum;
	
if(window.event) { //if IE
	keynum = theinputboxinquestion.keyCode
} else if(theinputboxinquestion.which) { // Netscape/Firefox/Opera
	keynum = theinputboxinquestion.which
}

if (keynum == '13') {
	sendzip(sendwhat);
}
	
}


function clearvalues (getvalue) {
	document.getElementById(getvalue).removeAttribute('checked');
}

function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
//		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(33.844814, -117.953810), 11);
		
		var geocoder = new GClientGeocoder();

		var latitude_arr = new Array();
		latitude_arr[0] = '33.940707';
latitude_arr[1] = '33.831563';
latitude_arr[2] = '33.957438';
latitude_arr[3] = '33.847237';
latitude_arr[4] = '33.859737';
latitude_arr[5] = '33.782463';
latitude_arr[6] = '33.782832';
latitude_arr[7] = '33.715907';
latitude_arr[8] = '33.787763';
latitude_arr[9] = '33.644718';
latitude_arr[10] = '33.859620';
latitude_arr[11] = '33.715565';

		var longitude_arr = new Array();
		longitude_arr[0] = '-118.139249';
longitude_arr[1] = '-118.046651';
longitude_arr[2] = '-118.022370';
longitude_arr[3] = '-118.126360';
longitude_arr[4] = '-117.890633';
longitude_arr[5] = '-118.153023';
longitude_arr[6] = '-118.189134';
longitude_arr[7] = '-117.850782';
longitude_arr[8] = '-117.869750';
longitude_arr[9] = '-117.914867';
longitude_arr[10] = '-117.928892';
longitude_arr[11] = '-117.996414';
		
		var location_arr = new Array();
		location_arr[0] = '<span style="font-size:12px;">11432 Paramount Blvd.<br />Downey 90241<br />Phone: 562-372-4238<br />fax: 562-319-0200<br />12.5 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=1">click here to view more details</a>';
location_arr[1] = '<span style="font-size:12px;">5051 E. Lincoln Ave.<br />Cypress 90630<br />Phone: 714-252-4864<br />fax: 714-995-0697<br />5.4 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=11">click here to view more details</a>';
location_arr[2] = '<span style="font-size:12px;">14101 E. Whittier Blvd.<br />Whittier 90605<br />Phone: 562-321-5016<br />fax: 562-945-8145<br />8.7 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=14">click here to view more details</a>';
location_arr[3] = '<span style="font-size:12px;">5453 E. Del Amo Blvd.<br />Lakewood 90713<br />Phone: 562-239-3961<br />fax: 562-867-4446<br />9.9 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=16">click here to view more details</a>';
location_arr[4] = '<span style="font-size:12px;">2341 East Orangethorpe Ave<br />Fullerton 92831<br />Phone: 714-451-7045<br />fax: 714-526-7798<br />3.8 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=35">click here to view more details</a>';
location_arr[5] = '<span style="font-size:12px;">3340 E. Anaheim Ave.<br />Long Beach 90804<br />Phone: 562-286-6448<br />fax: 562-742-0455<br />12.2 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=36">click here to view more details</a>';
location_arr[6] = '<span style="font-size:12px;">1310 Long Beach Blvd.<br />Long Beach 90813<br />Phone: 562-606-1610<br />fax: 562-599-3273<br />14.2 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=37">click here to view more details</a>';
location_arr[7] = '<span style="font-size:12px;">1409 E. Warner Ave.<br />Santa Ana 92705<br />Phone: 657-212-2336<br />fax: 714-751-6758<br />10.7 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=39">click here to view more details</a>';
location_arr[8] = '<span style="font-size:12px;">1640 W. Chapman Ave.<br />Orange 92868<br />Phone: 714-602-4667<br />fax: 714-978-6296<br />6.2 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=40">click here to view more details</a>';
location_arr[9] = '<span style="font-size:12px;">1950 Newport Blvd.<br />Costa Mesa 92627<br />Phone: 949-612-9081<br />fax: 949-258-0441<br />14 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=41">click here to view more details</a>';
location_arr[10] = '<span style="font-size:12px;">301 W. Orangethorpe Ave<br />Fullerton 92831<br />Phone: 714-451-7012<br />fax: 714-738-0278<br />1.8 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=42">click here to view more details</a>';
location_arr[11] = '<span style="font-size:12px;">7582-A Warner Ave.<br />Huntington Beach 92647<br />Phone: 714-842-0239<br />fax: 714-842-3608<br />9.3 miles distance from 92801</span><br /><a style="font-size:12px; color:#5C2E91" href=" store_locations.php?viewstore=53">click here to view more details</a>';
		
		
        
// this is the icon section 
        
        var icon = new GIcon();
		icon.image = "/images/icon.png";
		icon.iconSize = new GSize(39, 38);
		icon.shadowSize = new GSize(39, 39);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);

		var homeicon = new GIcon();
		homeicon.image = "/images/homeicon.png";
		homeicon.iconSize = new GSize(39, 21);
		homeicon.shadowSize = new GSize(39, 39);
		homeicon.iconAnchor = new GPoint(6, 20);
		homeicon.infoWindowAnchor = new GPoint(5, 1);
        
// Creates a marker at the given point with the given number label
		function createMarker(point,location) {
		var marker = new GMarker(point, icon);
		
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml("Discount Tire Centers<br />" + location);
		}
		);
		  return marker;
		}
		
		

// puts the icon on the map
		
		for (i = 0; i<12; i++) {
		var point = new GLatLng(latitude_arr[i], longitude_arr[i]);
		map.addOverlay(createMarker(point,location_arr[i]));	
			
		}

		var points = new GLatLng(33.844814, -117.953810);
		var markers = new GMarker(points,homeicon);
		GEvent.addListener(markers, "click", function() {
			markers.openInfoWindowHtml("<span style=\"font-size:12px\"><strong>Your zipcode point</strong><br /><br /> Click the corner to close this window<br /> click on any of the Discount Tire Centers icons<br />on the map to get more information</span>");
		}
		);
		map.addOverlay(markers);
		map.openInfoWindowHtml(points,"<span style=\"font-size:12px\"><strong>Your zipcode point</strong><br /><br /> Click the corner to close this window<br /> click on any of the Discount Tire Centers icons<br />on the map to get more information</span>");	
      }
    }

    
function set_store(store_number) {
	if(window.XMLHttpRequest)
	req = new XMLHttpRequest(); 
		else if (window.ActiveXObject)
			req  = new ActiveXObject('Microsoft.XMLHTTP'); 
		req.onreadystatechange = function()
		{ if(req.readyState == 4)
			{ if(req.status == 200){
				var store = req.responseText;
					alert(store);
	//				setTimeout(function() { window.location.href='store_locations.php?viewstore='+store_number}, 2000);
				} else {
					document.getElementById('errors').innerHTML="Error: returned status <br />code " + req.status + " " + req.statusText;
				}
			} 
		};
		req.open("GET", "option_populater.php?setstores=" + store_number, true); 
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		req.send(null); 
}

function clickypop(popitem) {
	if (document.getElementById(popitem).style.display == 'none') {
		document.getElementById(popitem).style.display = 'block';
	} else {
		document.getElementById(popitem).style.display = 'none';
	}
}





//function used in the tell a friend button
function tellFriendPopup(prodID)
{
	window.open('tell_friend.php?prodID='+prodID,'tellFriend','menubar=0,resizeable=0,location=0,status=1,scrollbars=0,width=500,height=450');
	return;
}
									




//-->
