// JavaScript Document

function showThisMenu(thisMenu){
	//alert("Hi");
	var foundMenu = thisMenu;
	document.getElementById(foundMenu).style.display = 'block';
}

function hideThisMenu(thisMenu){
	//alert("Hi");
	var foundMenu = thisMenu;
	document.getElementById(foundMenu).style.display = 'none';
}

function showThisMenu(thisMenu){
	//alert("Hi");
	var foundMenu = thisMenu;
	document.getElementById(foundMenu).style.display = 'block';
}

function alignFlash(obj)
{
		iWidth = (!navigator.appName=="Netscape")?window.innerWidth:document.body.clientWidth; 
		iHeight = (!navigator.appName=="Netscape")?window.innerHeight:document.body.clientHeight;
		
		if((iWidth-1000) % 2 == 0){
		x=1000;
		} else {
		x=999;
		}
		
		if(!navigator.appName=="Netscape"){
			pos= (iWidth-x) / 2;
		}else{
			pos= (iWidth-x) / 2;
		}
		if(obj=='home')
	{
document.getElementById('carContainer').style.display='block';
var d2=pos;
if(document.all)
{
	d2+=261;
}
else
{
	d2+=262;
}
d2+="px";
document.getElementById('carContainer').style.left=d2;
	}
}

//added for appending commas to the price value

function commaAppend(obj1) {
	obj1 = obj1.toString();
	var len = obj1.length;
	var tempString = "";
	switch(len){
			case 4:
				tempString = obj1.substring(0,1) + "," + obj1.substring(1);
				break;
			case 5:
				tempString = obj1.substring(0,2) + "," + obj1.substring(2);
				break;
			case 6:
				tempString = obj1.substring(0,1) + "," + obj1.substring(1,3) + "," + obj1.substring(3);
				break;
			case 7:
				tempString = obj1.substring(0,2) + "," + obj1.substring(2,4) + "," +obj1.substring(4);
				break;
			default:
				tempString = obj1;
				break;
		}
	return tempString;
}

String.prototype.ucfirst = function()
{
	var str = this;
	var firstChar;
	var secondChar;
	var thirdChar;
	var finalStr ="";
	var initialChar = str.charAt(0).toUpperCase();
	
	for(var i = 1; i < str.length; i++)
	{
		var firstChar = str.charAt(i);
		if((firstChar == ",") || (firstChar == ".") || (firstChar == " "))
		{
			if(str.charAt(i+1) == " "){
				secondChar = str.charAt(i+1);
				var thirdChar = (str.charAt(i+2)).toUpperCase();
				firstChar = firstChar + secondChar + thirdChar;
				i=i+2;
			}
			else {
				var secondChar = (str.charAt(i+1)).toUpperCase();
				firstChar = firstChar + secondChar;
				i = i+1;
			}
		}
		finalStr=finalStr + firstChar; 
	}
	   return initialChar + finalStr;
};

if(document.images){

pic1=new Image(132,23);
pic1.src='../images/buttons/config-deal-mo.gif';
pic2=new Image(26,19);
pic2.src="../images/buttons/go-mo.gif";
pic3=new Image(114,21);
pic3.src="../images/buttons/booktestdrive-mo.gif";
pic4=new Image(130,39);
pic4.src="../images/buttons/tradein-cd-mo.gif";
pic5=new Image(130,21);
pic5.src="../images/buttons/accessories-mo.gif";
pic6=new Image(130,21);
pic6.src="../images/buttons/accessories-normal.gif";
pic7=new Image(81,25);
pic7.src="../images/buttons/cu-submit-mo.jpg";
pic8=new Image(81,25);
pic8.src="../images/buttons/cu-reset-mo.jpg";
pic9=new Image(123,22);
pic9.src="../images/online/os-getmoredetails-mo.jpg";
pic10=new Image(98,20);
pic10.src="../images/usedcars/contact-seller.gif";
pic11=new Image();
pic11.src="../images/usedcars/uc-submit-mo.jpg";
pic12=new Image(241,67);
pic12="../PPC01/UsedCars/ppc_images/uc_submit_mo.jpg";
pic13=new Image(241,67);
pic13="../PPC01/NewCars/ppc_images/uc_submit_mo.jpg";
pic14=new Image(81,25);
pic14.src="../images/contactus/cu-submit-mo.jpg";
pic15=new Image(80,25);
pic15.src="../images/accessories/uc-submit-mo.jpg";
pic16=new Image(130,21);
pic16.src="../images/buttons/loan-mo.gif";
}

