

// dreamweaver rollovers

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// *******************************************************		easeInOut()
/*
	--Generic Animation Step Value Generator By www.hesido.com 
		powr > 1 produces ease-in
		powr < 1 produces ease-out
		powr = 1 produces linear animations
*/
function easeInOut(minValue, maxValue, totalSteps, actualStep, powr)
{
	var delta = maxValue - minValue; 
	var stepp = minValue+(Math.pow(((1 / totalSteps) * actualStep), powr) * delta); 
	return Math.ceil(stepp);
} 

// *************************************************	dhtml pop ups:

/*
	div must be set with style="display: none;"
*/

var dhtmlPopUpInnerHTML;

function preloadDhtmlImages()
{
	bgTileGreyOutBg90 = new Image();
	bgTileGreyOutBg90.src = 'http://www.kansashda.com/_images/bgTile-greyOutBg-90.png';
}

			
function showDhtmlPopUp(divId, topPos)
{
	var scrollXY = getScrollXY();
	var windowSize = getWindowSize();

	var popDiv = document.getElementById(divId);
	var topPosition = (topPos) ? topPos : 100;
	//topPosition += (Math.round(scrollXY[0]/2));
	
	var htmlWrapper1 = '<div id="dhtmlPopUpWrapper" style="position: absolute; top: '+Math.round(scrollXY[1])+'px; left: 0px; z-index: 101; width: 100%; height: 100%;';
	htmlWrapper1 += '	background-image: url(http://www.kansashda.com/_images/bgTile-greyOutBg-90.png);">';
	htmlWrapper1 += '<div style="float: left; width:100%; height: 100%; position:relative;">';
	htmlWrapper1 += '<div style="clear: left; float: left; position: relative; left: 50%; top: '+topPosition+'px;">';
	htmlWrapper1 += '<div style="display: block; float: left; position: relative; right: 50%;">';

	var htmlWrapper2 = '</div></div></div></div>';
	dhtmlPopUpInnerHTML = popDiv.innerHTML;
	
	popDiv.innerHTML = htmlWrapper1+dhtmlPopUpInnerHTML+htmlWrapper2;
	
	popDiv.style.top = scrollXY[1]+'px';
	popDiv.style.zIndex = '102';
	popDiv.style.display = 'block';
}
			


function hideDhtmlPopUp(divId)
{
	var popDiv = document.getElementById(divId);
	popDiv.innerHTML = dhtmlPopUpInnerHTML;
	popDiv.style.display = 'none';
}


// *************************************************


function getVideoSkinColors()
{
	colors = new Array();
	colors[0] = 'dddddd'; // buttonColor
	colors[1] = '2c3291'; // bgColor
	colors[2] = 'ffffff'; // highlightColor
	colors[3] = '8085be'; // mutedColor
	return colors;
}


// requires a div with id 'popupVideoContainer' to be set

function popUpVideo(videoName, w, h)
{
	var scrollXY = getScrollXY();
	colors = getVideoSkinColors();
	var paddedW = w + 50;
	var paddedH = h + 100;
	var html = '<div style="width: 100%; height: 100%; position: absolute; top: '+scrollXY[1]+'px; left: 0px; z-index: 100;';
	html += ' background-image: url(http://www.kansashda.com/_images/bgTile-greyOutBg-80.png);">';
	html += '<div style="position:absolute; top: 50%; left: 50%; width: '+w+'px; height: '+h+'px;';
	html += ' margin-top: -'+Math.round(h/2)+'px; margin-left: -'+Math.round(w/2)+'px;">';
	html += '<a href="javascript: closePopUpVideo();" style="display: block; text-align: right; background-color: #'+colors[1]+'; color: #'+colors[0]+'; padding: 3px 20px;';
	//html += 'margin-bottom: 10px; ';
	html += '"><b>X</b> Close</a>';
	html += insertVideo(videoName, w, h, true);
	html += '</div></div>';

	document.getElementById('popupVideoContainer').innerHTML = html;
}


function closePopUpVideo()
{
	document.getElementById('popupVideoContainer').innerHTML = '';
}


function insertVideo(videoName, width, height, returnHtml)
{
	colors = getVideoSkinColors();
	
	if (!returnHtml) {
		AC_FL_RunContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', width,
			'height', height,
			'src', 'FLASH/video_player',
			'FlashVars', 'videoUrl=FLASH/videos/'+videoName+'.flv&buttonColor=0x'+colors[0]+'&bgColor=0x'+colors[1]+'&highlightColor=0x'+colors[2]+'&mutedColor=0x'+colors[3],
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', videoName,
			'bgcolor', '#ffffff',
			'name', videoName,
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','always',
			'movie', 'FLASH/video_player',
			'salign', ''
			); //end AC code
	} else {
		html = AC_FL_GetContent(
			'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
			'width', width,
			'height', height,
			'src', 'FLASH/video_player',
			'FlashVars', 'videoUrl=FLASH/videos/'+videoName+'.flv&buttonColor=0x'+colors[0]+'&bgColor=0x'+colors[1]+'&highlightColor=0x'+colors[2]+'&mutedColor=0x'+colors[3],
			'quality', 'high',
			'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'false',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', videoName,
			'bgcolor', '#ffffff',
			'name', videoName,
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','always',
			'movie', 'FLASH/video_player',
			'salign', ''
			); //end AC code
		return html;
	}
}




// ************************************************* 

function showLoginBox(e, vehicleId, action, refUrl, siteRootHttps, imagesUrl, promotionGoingOn, promotionName, clickType)
{
	
	switch(clickType)
	{
			case 'saveVehicle':
				message = 'To save this vehicle you will need to quickly login<br />or create a new account:';
				break;
			case 'createWishList':
				message = 'To create a wish list, quickly login<br />or create a new account:';
				break;
			default:
				message = 'To save this vehicle you will need to quickly login<br />or create a new account:';
	}

	var html = '<div style="padding: 12px; background-color: #fff; width: 450px; border: 1px solid #ddd; text-align: center;">';
	
	html += '<div style="float: left; width: 200px;"><b>'+message+'</b></div>';
	html += '<div style="float: right;"><a href="javascript: hideLoginBox();">Close</a>';
	html += '<a href="javascript: hideLoginBox();"><img src="'+imagesUrl+'/button-x.gif" alt="Close" id="closeX" style="position: relative; top: 6px; left: 5px;" /></a></div>';
	html += '<br class="clearfix" />';
	
	html += '<form name="login" method="post" action="'+siteRootHttps+'/login2.php">';
	html += '<input type="hidden" name="action" value="'+action+'" />';
	html += '<input type="hidden" name="refUrl" value="'+refUrl+'" />';
	
	html += '<div class="boxContent" style="width: 400px;">';
	html += '<h2>Login To Your Account</h2>';
	html += '<label for="emailAddress" class="alignedForm">Email Address:</label>';
	html += '<input type="text" class="alignedForm" size="30" name="emailAddress" id="emailAddress" />';
	html += '<label for="password" class="alignedForm">Password:</label>';
	html += '<input type="password" class="alignedForm" id="password" size="30" name="password" />';
	html += '<input type="image" class="alignedFormButton" src="'+imagesUrl+'/button-login.gif" alt="Login" name="loginSubmit" id="loginSubmit" />';
	html += '<div class="centerDiv">Forgot your password?  <a href="'+siteRootHttps+'/forgot_password.php">Click Here</a>.</div>';
	html += '</div></form>';
	
	
	
	html += '<form name="signup" method="post" action="'+siteRootHttps+'/signup2.php">';
	html += '<input type="hidden" name="action" value="'+action+'" />';
	html += '<input type="hidden" name="refUrl" value="'+refUrl+'" />';
	html += '<div class="boxContent" style="width: 400px;">';
	html += '<h2>Create a New Account</h2>';
	html += '<label for="emailAddressB" class="alignedForm">Email Address:</label>';
	html += '<input type="text" class="alignedForm" size="30" name="emailAddress" id="emailAddressB" />';
	html += '<label for="passwordB" class="alignedForm">Password:</label>';
	html += '<input type="password" class="alignedForm" id="passwordB" size="30" name="password" />';
	html += '<label for="password2" class="alignedForm">Re-enter Password:</label>';
	html += '<input type="password" class="alignedForm" id="password2" size="30" name="password2" />';
	html += '<div class="centerDiv" style="margin-bottom: 15px;"><input type="checkbox" name="subscribe" checked="checked" />';
	html += ' &nbsp; Subscribe to newsletters and announcements</div>';

	html += '<input type="image" class="alignedFormButton" src="'+imagesUrl+'/button-create_account.gif" alt="Create Account" name="signupSubmit" id="signupSubmit" />';
	html += '</div></form>';
	
	html += '</div>';
	
	document.getElementById('saveThisVehicleDiv').innerHTML = html;
	showDhtmlPopUp('saveThisVehicleDiv', 100);
	
	YAHOO.Rollover.init('_over', ['closeX', 'loginSubmit', 'signupSubmit']);

	
}



function hideLoginBox()
{
	hideDhtmlPopUp('saveThisVehicleDiv');
}

// ***************************************************************

function nullFunc()
{
	return;
}

// ***************************************************************


