




function KAWMainPhotofader(nm, mainDiv, imgArr){

	this.name	= nm;
	this.imgArr = imgArr;
	this.curImg = 0;
	this.curDiv = 1;
	this.delayInterval = 1;
	var mainDv = document.getElementById(mainDiv);
	document.pfObj = this;
	this.delayInterval = this.imgArr[2];
	document.write("<style type='text/css'>\n");
	document.write("#pf_photo1 img { visibility:hidden; }\n");
	document.write("#pf_photo1 { position:absolute; z-index: 1; }\n");
	document.write("#pf_photo2 { position:absolute; z-index: 0; }\n");
	document.write("</style>");

	this.initImages = function() {
		document.write("<scr");
		document.write("ipt type='text/javascript'>\n");
		for(var i=0; i<this.imgArr.length; i+=3){
			document.write("var img"+i+" = new Image();\n");
			document.write("img"+i+".src = '"+ this.imgArr[i] +"';\n");
		}document.write("document.pfObj.start();\n");
		document.write("</scr");
		document.write("ipt>\n");
	}


	this.start = function(){		
		var hldr1 = "pf_photo1";
		var hldr2 = "pf_photo2";
		var dv1 = document.createElement("div");
			dv1.id = "pf_photo1";dv1.innerHTML = "<img src='"+ imgArr[0] +"' />";
		var dv2 = document.createElement("div");
			dv2.id = "pf_photo2";
	
		mainDv.appendChild(dv1);
		mainDv.appendChild(dv2);	

		image1 = document.getElementById(hldr1).childNodes[0];		
		setOpacity(image1, 0);
		
		image1.style.visibility = 'visible';
			
		fadeIn(hldr1,0);
			
		//Preload the rest of the images
		preloadBGImages(imgArr);
	
	
	}


	
	


	this.initImages();

}

	function preloadBGImages(imgArr){
		for(var i=3; i<imgArr.length; i+=3){
			var nImag = new Image();
			//nImag.onLoad = "imageLoadIsComplete()";
			//nImag.src = imgArr[i];
			//alert(nImag.src);
			//while(!checkForImageLoad(nImag)){
			createBGImageSelector(nImag.src);
			//}	
			//alert(nImag.src);
			//document.write("var img"+i+" = new Image();\n");
			//d//ocument.write("img"+i+".src = '"+ this.imgArr[i] +"';\n");
		}
		
		//document.write("document.pfObj.start();\n");
	}


	function imageLoadIsComplete(){
		load("sd");
	}


		
	var myTimer = "";	
	var imageLoadedTimer = "";			
	
	function setOpacity(obj, opacity) {
	
		opacity = (opacity == 100)?99.999:opacity;
		obj.style.filter = "alpha(opacity:"+opacity+")";
		obj.style.KHTMLOpacity = opacity/100;
		obj.style.MozOpacity = opacity/100;
		obj.style.opacity = opacity/100;
	}
	
	
	
	
	function manualSetCurImg(ind){
		//alert("--->"+ind);
		clearInterval(myTimer);
		document.pfObj.curImg=(ind*3)-3;
		if(document.pfObj.curImg<0)document.pfObj.curImg=0;
		
		swapImages();
	}
	
	



	var initialBGShown=false;

	function swapImages(){
		if(document.pfObj.curImg >= document.pfObj.imgArr.length-3)
		document.pfObj.curImg = 0;
		else 
		document.pfObj.curImg=document.pfObj.curImg+3;
		
		
		//alert(document.pfObj.curImg);
		
		if(initialBGShown==false){
			intMenuControl.closeMenu();
		}
		
		
		if((document.pfObj.curImg==0)&&(initialBGShown==true)){
			document.pfObj.curImg=document.pfObj.curImg+3;}
			var dvName				= (document.pfObj.curDiv == 1)?"pf_photo2":"pf_photo1";
			var eDivName			= (document.pfObj.curDiv == 1)?"pf_photo1":"pf_photo2";
			document.pfObj.curDiv	= (document.pfObj.curDiv == 1)?2:1;

		var tgtDiv = document.getElementById(dvName);
		var eDiv = document.getElementById(eDivName);
			tgtDiv.innerHTML = "<img src='"+ document.pfObj.imgArr[document.pfObj.curImg] +"' style='visibility:hidden;' />";
			
		var newDelay = document.pfObj.imgArr[(document.pfObj.curImg+2)];
		
			document.pfObj.delayInterval = newDelay;
		var newImageMap =  "#" + document.pfObj.imgArr[(document.pfObj.curImg+1)];
		
		eDiv.style.zIndex = 0;tgtDiv.style.zIndex = 1;
		var img = tgtDiv.childNodes[0];
		initialBGShown=true;
		setOpacity(img, 0);
		img.style.visibility = 'visible';
		
		fadeIn(tgtDiv.id,0);
		
		document.getElementById("mainImgOverlay").useMap=newImageMap; 
	}	
		
		
		
	
	var thumbIndicatorNotSet;
	function fadeIn(objId,opacity) {
		
		
		// Set the indicator on the thumb selector
		//alert(document.pfObj.curImg);
		if(document.pfObj.curImg>1){
			
		}
		else{
			//alert();
			
		}
		

		if (document.getElementById) {
			obj = document.getElementById(objId).childNodes[0];
			if (opacity < 100) {
			
				if(!thumbIndicatorNotSet){
				setThumbArrowIndicator(document.pfObj.curImg);
				thumbIndicatorNotSet=true;
				}
			
				speed = (speed < 2)?2:speed;
				setOpacity(obj, opacity);
				opacityDif = Math.ceil((100-opacity)/speed);
				opacity += opacityDif;
				myTimer = window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 50);
			} 
			else {
				thumbIndicatorNotSet=false;
				myTimer = setTimeout("swapImages()",document.pfObj.delayInterval*1000);
			}
		}

	}
	
	
	var currentIndicatorIndex = 0;
	function setThumbArrowIndicator(ind){
		
		if(currentIndicatorIndex>1)
		document.getElementById('imgTBSelIndArw_'+currentIndicatorIndex).src="../ImagesMain2/Home/blkIndicator.gif";
		
		if(document.pfObj.curImg>1)
		document.getElementById('imgTBSelIndArw_'+document.pfObj.curImg).src="../ImagesMain2/Home/whtIndicator.gif";
			
		currentIndicatorIndex = document.pfObj.curImg;
	}
	

	function fadeInOnce(objId,opacity) {
		if (document.getElementById) {
			obj = document.getElementById(objId).childNodes[0];
			if (opacity < 100) {
				speed = (speed < 2)?2:speed;
				setOpacity(obj, opacity);
				opacityDif = Math.ceil((100-opacity)/speed);
				opacity += opacityDif;
				myTimer = window.setTimeout("fadeInOnce('"+objId+"',"+opacity+")", 50);
			} 
			else {clearTimeout(myTimer);
			}
		}
	}
		
		
	

	var theImage = "";

	function checkImageLoad(whichImage) {
		theImage = "bg" + (whichImage + 1);
		document.getElementById("loadingDiv").style.visibility = "visible";
		imageLoadedTimer = setTimeout("checkImage()",20)
	}


	function checkImage() {
		if (!checkForImageLoad(theImage)) {
			clearTimeout(imageLoadedTimer);
			document.getElementById("loadingDiv").style.visibility = "hidden"; 
		} 
		else {
			document.getElementById("loadingDiv").style.visibility = "visible";	
		}
	}


	function checkForImageLoad(whichImage) {

		//alert(whichImage);
		if (whichImage.complete) {
			return true;
		}
	
		if (typeof whichImage.naturalWidth != "undefined" && whichImage.naturalWidth >= 1) {
			return true;
		}
		
		//createBGImageSelector(whichImage)
		//If complete... lets load the thumbnail selector		
		return false;
	}
	
	var thumbIndexCount = 0
	var imageArayIndexCount = 0
	function createBGImageSelector(whichImage){
		//alert();
		thumbIndexCount+=1;
		imageArayIndexCount+=3;
		//alert(thumbIndexCount);
		
		var content = "<div style='float:left;margin-right:5px;'><div style='width:30px;padding-bottom:5px;' align=center><img id='imgTBSelIndArw_"+imageArayIndexCount+"' src='../ImagesMain2/Home/blkIndicator.gif' height='5' alt='' border='0'></div><div style='width:30px; height:19px; border-style:solid; border-color:#ffffff; border-width:1px;'  id='tbsel1' onClick='thumbNailItemClick("+thumbIndexCount+")' onMouseOver='tSelect(this,"+thumbIndexCount+");' onMouseOut='tSelectOff(this);'><img src='"+KAWMainBackgroundImages_thumb[thumbIndexCount-1]+"' alt='' height=19 width=30 border=0></div></div>";
		var newDiv = document.createElement('span');			
		
		newDiv.innerHTML =content;	
		
		if(document.getElementById('thumbSelectorContainer'))
		document.getElementById('thumbSelectorContainer').appendChild(newDiv);
		
	}
	

	
	/* News Flash Rotation */
	function rotateNewsFlash(){
		//currNewsArticleId=newsArticles[currNewsArticlePos];
		//document.getElementById('spNewsFlashTitle').innerHTML=newsArticles[currNewsArticlePos+1];
		//currNewsArticlePos+=2;
		//if(currNewsArticlePos>=newsArticlesLen){
			//currNewsArticlePos=0;
		//}
		newsFlashWait();
	}
	function newsFlashWait(){
		setTimeout("rotateNewsFlash()",3000);
	}
	function newsFlashClick(){
		//window.location.href=currNewsArticleId;
		window.open(currNewsArticleId);
	}
	window.onload=function(){
		rotateNewsFlash();
		setRollovers();
	}
	function trapsearchKeypress(t,e,theKey) {
	var iKeyCode = 0;
	if (window.event) iKeyCode = window.event.keyCode
	else if (e) iKeyCode = e.which;
	if((t==1)&&(iKeyCode == theKey)){
		siteSearch_Click();
	}
		else if((t==2)&&(iKeyCode == theKey)){
			dealerSearch_Click();
		}
	}
	var mpWin;
	function popMediaPlayer(f,w,h){
	}
	
    function lnPopVideos(fileName,title){
		var args = "width=690,height=608,scrollbars=no,menubar=no,statusbar=no";
		//return false;
    }
    
	var mpWinLN;
	function popMediaPlayerLN(f,w,h){
	}

	function closeMenu(){
		intMenuControl.closeMenu();
	}

	function intMenu(){
		this.openMode		= 'closed';
		this.modeToPerform 	= 'open';
		this.menuTimer;
		
		this.demoMenu - function(){
		
		}
		
		this.menuRollOn = function(){
			clearTimeout(this.menuTimer);	
		}
		
		this.menuRollOff = function(){
			clearTimeout(this.menuTimer);	
			this.menuTimer = window.setTimeout("closeMenu()", 2000);
		}
		
		this.closeMenu = function(){
			clearTimeout(this.menuTimer);	
			this.modeToPerform = 'close';
			this.processMenuDisplay();
		}
		
		this.openMenu = function(){
			this.modeToPerform = 'open';
			this.processMenuDisplay();
		}
		
		this.processMenuDisplay = function(){
			
			if(this.modeToPerform=='open'){
				this.openMode='open';
				document.getElementById('divIntl').style.visibility='visible';
				document.getElementById('divInt_open').style.display='block';
				document.getElementById('divInt_closed').style.display='none';
			}
			else{
				this.openMode='closed';
				document.getElementById('divIntl').style.visibility='hidden';
				document.getElementById('divInt_open').style.display='none';
				document.getElementById('divInt_closed').style.display='block';
			}
		}
	}	
	<!-- 
