// JavaScript Document
$(document).ready(function() {
			$("img[@src*=png]").pngfix({sizingMethod: "scale"});
			$("ul#menu li.drop").hover(function(){$(this).children("ul").css({ display: "block"});$(this).children("a").css({ color: "#FFFFFF"})},function(){$(this).children("ul").css({ display: "none"});$(this).children("a").css({ color: "#FFFFFF"})});	
			});


var r=1;
function check_box_pic()
{
	if(r==1)
	{
	document.getElementById("check_box_pic").className="menuon";
	document.getElementById("chkAgree").checked="checked";
	r++;
	}
	else
	{
	document.getElementById("check_box_pic").className="menuoff";
	document.getElementById("chkAgree").checked="";
	r=1;
	}
	//alert (r);
}


function countdown_clock(year, month, day, hour, minute, format)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
         //html_code = '<div id="countdown"></div>';
         
         //document.write(html_code);
         
         countdown(year, month, day, hour, minute, format);                
         }
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth();                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();                                 
         Target_Date = (new Date(year, month - 1, day, hour, minute, 00)).getTime();                  
         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    hps = '0'; mps = '0'; sps = '0';
                    if(hours >= 10) hps ='';
                    if(minutes >= 10) mps ='';
                    if(seconds >= 10) sps ='';
                    
                    document.getElementById('countdown').innerHTML = days + '';
                    //document.getElementById('countdown').innerHTML += hps+hours + ':';
                    //document.getElementById('countdown').innerHTML += mps+minutes + ':';
                    //document.getElementById('countdown').innerHTML += sps+seconds;
                    break;
               default: 
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }


    function showVid(whatVid) {    
		var so = new SWFObject("/clients/cdjq209/videos/resources/flvPlayer.swf?file="+whatVid, "sotester", "320", "240", "8", "#000000");
		so.write("flashcontent");    
        document.getElementById('txt').style.display="none";            
	}


function formatMoney(whatVal) {
 var i = parseInt(whatVal);
 if (i > 45000)
   i = 45000
 document.write(formatCurrency(i));	
}

function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
return (((sign)?'':'-') + '$' + num);
}



var thisDomain = document.domain;

if ( thisDomain.search(/jeep/i) >0){
  document.title = "Jeep";
}
if ( thisDomain.search(/dodge/i)>0){
  document.title = "Dodge";
}
if ( thisDomain.search(/chrysler/i)>0) {
  document.title = "Chrysler";
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}



