﻿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];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
}

function goRequestThisOffer1( zipcode, vehicle ) {
    document.location = "tell_me_more.aspx?vehicle=" + vehicle + "&zipcode=" + zipcode;
}

function goRequestThisOffer( zipcode, vehicle ) {
    document.location = "tell_me_more.aspx?vehicle=" + vehicle + "&zipcode=" + zipcode;
}

function goLincolnPrivacy() { 
    MM_openBrWindow('http://www.lincoln.com/privacy.asp?sReferrer=2_lmevent_foottext_LINCprivacy','','scrollbars=yes,resizable=yes,width=500,height=500');
	urchinTracker('/lincoln/privacy_policy');
}
function goMercuryPrivacy() { 
	MM_openBrWindow('http://www.mercuryvehicles.com/privacy.asp?sReferrer=2_lmevent_foottext_MERCprivacy','','scrollbars=yes,resizable=yes,width=500,height=500');
	urchinTracker('/mercury/privacy_policy');
}
function goCaliforniaPrivacy() { 
	MM_openBrWindow('http://www.lincolnmercury.com/california_privacy.asp?sReferrer=2_lmevent_foottext_Caliprivacy','','scrollbars=yes,resizable=yes,width=500,height=500');
	urchinTracker('/lincolnmercury/california_privacy_policy');
}
function goDealershipCPO(url, dealername) {
    window.open(url, 'dealerCPO', 'scrollbars=yes,resizable=yes,width=500,height=500');
    pageTracker._trackPageview('/exit/' + dealername + '/CPO');
}

function pop2010MKZCompareChart() {
    var winWidth = 520;
    var winHeight = 675;
    var winLeft = (screen.width - winWidth) / 2;
    var winTop = (screen.height - winHeight) / 2;
    window.open('p-comparison-chart.htm', 'mkzCompare', 'height=' + winHeight + ',width=' + winWidth + ',top=' + winTop + ',left=' + winLeft + ',directories=0,toolbar=0,scrollbars=yes,resizable=no');

    pageTracker._trackPageview('/flash/2010mkz_comparison_chart');
}

function pop2010MKZCompareChartWithIncentives() {
    var winWidth = 520;
    var winHeight = 675;
    var winLeft = (screen.width - winWidth) / 2;
    var winTop = (screen.height - winHeight) / 2;
    window.open('p-comparison-chart-incentives.htm', 'mkzCompare', 'height=' + winHeight + ',width=' + winWidth + ',top=' + winTop + ',left=' + winLeft + ',directories=0,toolbar=0,scrollbars=yes,resizable=no');

    pageTracker._trackPageview('/flash/2010mkz_comparison_chart_incentives');
}

function urchinTracker(page) {
    pageTracker._trackPageview(page);
}

var xVLVvar = "";
var xVLVbvar = "";
function findPosX(obj) {
document.getElementById(obj).style.position = 'relative';
var xfinal = document.getElementById(obj).offsetLeft;
return xfinal;
}
function findPosY(obj) {
document.getElementById(obj).style.position = 'relative';
var xfinal = document.getElementById(obj).offsetTop;
return xfinal;
}

function xShowHide(xID, xState){
	if(xState==true){
		document.getElementById(xID).style.visibility='visible';
	}else{
		document.getElementById(xID).style.visibility='hidden';
	}
}

function xVLV(xID, xIDb){

	 xVLVvar = xIDb;
	 xVLVbvar = xID;
	var xVar = xIDb;

	xShowHide(xIDb,true);

	document.getElementById(xVar).style.width = '228px';
	document.getElementById(xVar).style.height = '100px';
	document.getElementById(xVar).style.background = '#7a7a7a';

	
	document.getElementById(xVar).style.left = findPosX(xID)+'px';
	document.getElementById(xVar).style.top = findPosY(xID) + document.getElementById(xID).offsetHeight+ 'px';
	document.getElementById('hIMH').src='images/common/spacer.gif';
	document.getElementById('hIMHb').src='images/common/spacer.gif';
}
function xVLVx(){
	 xID = xVLVbvar;
	 xIDb = xVLVvar;
	var xVar = xIDb;
	xShowHide(xVar,true);
	document.getElementById(xVar).style.width = '228px';
	document.getElementById(xVar).style.height = '100px';
	document.getElementById(xVar).style.background = '#7a7a7a';
	
	document.getElementById(xVar).style.left = findPosX(xID)+'px';
	document.getElementById(xVar).style.top = findPosY(xID) + document.getElementById(xID).offsetHeight+ 'px';
}
function xVLVOut(){
	var xVar = xVLVvar;
	xShowHide(xVLVvar,false);
	document.getElementById(xVar).style.width = '0px';
	document.getElementById(xVar).style.height = '0px';

}

function xVLVOutx(){
	var xVar = xVLVvar;
	xShowHide(xVLVvar,false);
	document.getElementById(xVar).style.width = '0px';
	document.getElementById(xVar).style.height = '0px';

}
function xChange(xID, xPath,xPx){
    document.getElementById('hIMH').src = xPath;
	document.getElementById('hIMH').style.marginTop = xPx+'px';
	
}
function xChangeB(xID, xPath,xPx){
	document.getElementById('hIMHb').src = xPath;
	document.getElementById('hIMHb').style.marginTop = xPx+'px';
	
}
function xCLa(){
    document.getElementById('hIMH').src='images/common/spacer.gif';
}
function xCLb(){
    document.getElementById('hIMHb').src='images/common/spacer.gif';
}

function DrawContent(sContent, sContentHeight, sContentWidth, sContentType, sOptions) {    
    if (sContentType.indexOf("x-shockwave-flash") >= 0) {
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="' + sContentHeight + '" width="' + sContentWidth + '">');
        document.write('	<param name="allowScriptAccess" value="sameDomain" />');
        document.write('	<param name="movie" value="' + sContent + '?' + sOptions + '">');
        document.write('	<param name="quality" value="high">');
        document.write('	<param name="play" value="true">');
        document.write('	<param name="id" value="flashmovie">');
        document.write('	<param name="wmode" value="transparent">');
        document.write('	<param name="bgcolor" value="#ffffff">');
        document.write('	<embed bgcolor="#ffffff" height="' + sContentHeight + '" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + sContent + '?' + sOptions + '" type="application/x-shockwave-flash" width="' + sContentWidth + '" allowScriptAccess="sameDomain" quality="high" wmode="transparent" play="true">');
        document.write('</object>');
    } else if (sContentType.indexOf("image") >= 0) {
        document.write('<img src="' + sContent + '" width="' + sContentWidth + '" height="' + sContentHeight + '" border="0" usemap="#DrawContentMap"/>');
    } else {
        document.write(sContent);
    }
}

function DrawContentNoParams(sContent, sContentHeight, sContentWidth, sContentType) {
    if (sContentType.indexOf("x-shockwave-flash") >= 0) {
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" height="' + sContentHeight + '" width="' + sContentWidth + '">');
        document.write('	<param name="allowScriptAccess" value="sameDomain" />');
        document.write('	<param name="movie" value="' + sContent + '">');
        document.write('	<param name="quality" value="high">');
        document.write('	<param name="play" value="true">');
        document.write('	<param name="id" value="flashmovie">');
        document.write('	<param name="wmode" value="transparent">');
        document.write('	<param name="bgcolor" value="#ffffff">');
        document.write('	<embed bgcolor="#ffffff" height="' + sContentHeight + '" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + sContent + '" type="application/x-shockwave-flash" width="' + sContentWidth + '" allowScriptAccess="sameDomain" quality="high" wmode="transparent" play="true">');
        document.write('</object>');
    } else if (sContentType.indexOf("image") >= 0) {
        document.write('<img src="' + sContent + '" width="' + sContentWidth + '" height="' + sContentHeight + '" border="0" usemap="#DrawContentMap"/>');
    } else {
        document.write(sContent);
    }
}

function DrawContent2(sContent, sContentHeight, sContentWidth, sContentType, sOptions) {
    if (sContentType.indexOf("x-shockwave-flash") >= 0) {
       document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" height="' + sContentHeight + '" width="' + sContentWidth + '">')
       document.write('     <param name="allowScriptAccess" value="sameDomain" />');
       document.write('	    <param name="movie" value="' + sContent + '?' + sOptions + '">');
       document.write('     <param name="wmode" value="transparent" />');
       document.write('     <param name="scale" value="exactfit" />');
       document.write('     <param name="quality" value="high" />');
       document.write('     <param name="bgcolor" value="#fff" />');
       document.write('     <param name="menu" value="true" />');
       document.write('	    <embed bgcolor="#ffffff" height="' + sContentHeight + '" pluginspage="http://www.macromedia.com/go/getflashplayer" src="' + sContent + '?' + sOptions + '" type="application/x-shockwave-flash" width="' + sContentWidth + '" allowScriptAccess="sameDomain" quality="high" wmode="transparent" play="true">');
       document.write('</object>');
   } else if (sContentType.indexOf("image") >= 0) {
        document.write('<img src="' + sContent + '" width="' + sContentWidth + '" height="' + sContentHeight + '" border="0" usemap="#DrawContentMap"/>');
    } else {
        document.write(sContent);
    }
}


var xVLVvar = "";
var xVLVbvar = "";
function findPosX(obj) {
document.getElementById(obj).style.position = 'relative';
var xfinal = document.getElementById(obj).offsetLeft;
return xfinal;
}
function findPosY(obj) {
document.getElementById(obj).style.position = 'relative';
var xfinal = document.getElementById(obj).offsetTop;
return xfinal;
}

function xShowHide(xID, xState){
	if(xState==true){
		document.getElementById(xID).style.visibility='visible';
	}else{
		document.getElementById(xID).style.visibility='hidden';
	}
}

function xVLV(xID, xIDb){

	 xVLVvar = xIDb;
	 xVLVbvar = xID;
	var xVar = xIDb;

	xShowHide(xIDb,true);

	document.getElementById(xVar).style.width = '228px';
	document.getElementById(xVar).style.height = '100px';
	document.getElementById(xVar).style.background = '#7a7a7a';

	
	document.getElementById(xVar).style.left = findPosX(xID)+'px';
	document.getElementById(xVar).style.top = findPosY(xID) + document.getElementById(xID).offsetHeight+ 'px';
}
function xVLVx(){
	 xID = xVLVbvar;
	 xIDb = xVLVvar;
	var xVar = xIDb;
	xShowHide(xVar,true);
	document.getElementById(xVar).style.width = '228px';
	document.getElementById(xVar).style.height = '100px';
	document.getElementById(xVar).style.background = '#7a7a7a';
	
	document.getElementById(xVar).style.left = findPosX(xID)+'px';
	document.getElementById(xVar).style.top = findPosY(xID) + document.getElementById(xID).offsetHeight+ 'px';
}
function xVLVOut(){
	var xVar = xVLVvar;
	xShowHide(xVLVvar,false);
	document.getElementById(xVar).style.width = '0px';
	document.getElementById(xVar).style.height = '0px';

}

function xVLVOutx(){
	var xVar = xVLVvar;
	xShowHide(xVLVvar,false);
	document.getElementById(xVar).style.width = '0px';
	document.getElementById(xVar).style.height = '0px';

}
function xChange(xID, xPath,xPx){
	document.getElementById('hIMH').src = xPath;
	document.getElementById('hIMH').style.marginTop = xPx+'px';
	
}
function xChangeB(xID, xPath,xPx){
	document.getElementById('hIMHb').src = xPath;
	document.getElementById('hIMHb').style.marginTop = xPx+'px';
	
}
function xCLa(){
	document.getElementById('hIMH').src='';
}
function xCLb(){
	document.getElementById('hIMHb').src='';
}
function setDisclaimer( vehicle, disclaimer ) {
	//alert( "setDisclaimer called with (" + vehicle + ", " + disclaimer + ")");
	//document.getElementById('dynamicDisclaimer').innerHTML = marinerDisclaimer + " " + milanDisclaimer;
	try {
	    if (disclaimer == "" || disclaimer == "undefined") {
		    document.getElementById('dynamicDisclaimer').innerHTML = "See your local Lincoln Mercury dealer for details.";
	    } else {
		    document.getElementById('dynamicDisclaimer').innerHTML = disclaimer;
	    }
	} catch(err) {}
	pageTracker._trackPageview( '/flash/' + vehicle );
}
function showWelcome(linkText) {
    if( !linkText ) {
        linkText = "About Us";
    }
	if (document.getElementById) { // DOM3 = IE5, NS6
       document.getElementById('regionCopy').style.visibility = 'visible';
       document.getElementById('regionCopy').style.display = 'block';
   	} else {
       if (document.layers) { // Netscape 4
           document.regionCopy.visibility = 'visible';
           document.regionCopy.display = 'block';
       } else { // IE 4
           document.all.regionCopy.style.visibility = 'visible';
           document.all.regionCopy.style.display = 'block';
       }
  	}
	document.getElementById('welcome').innerHTML = "<a href=\"#\" onClick=\"return hideWelcome('" + linkText + "');\">[-]Close</a>";
	
	return false;
}

function hideWelcome(linkText) {
    if( !linkText ) {
        linkText = "About Us";
    }
   if (document.getElementById) { // DOM3 = IE5, NS6
       document.getElementById('regionCopy').style.visibility = 'hidden';
       document.getElementById('regionCopy').style.display = 'none';
   } else {
       if (document.layers) { // Netscape 4
           document.regionCopy.visibility = 'hidden';
           document.regionCopy.display = 'none';
       } else { // IE 4
           document.all.regionCopy.style.visibility = 'hidden';
           document.all.regionCopy.style.display = 'none';
       }
   }
   document.getElementById('welcome').innerHTML = "<a href=\"#\" onClick=\"return showWelcome('" + linkText + "');\">[+]" + linkText + "</a>";
   return false;
}

/* Compare Show Group */
function CompareShowGroup(sGroupDiv) {
    var oSelectedGroup = document.getElementById('Href' + sGroupDiv);
    var oSelectedGroupImage = document.getElementById('Img' + sGroupDiv);
    var oElements = document.getElementsByTagName("div");

    //alert("oSelectedGroup = " + oSelectedGroup);
    //alert("oSelectedGroupImage = " + oSelectedGroupImage.src);
    //alert("oElements = " + oElements.length);

    for (var i = 1; i < oElements.length; i++) {
        switch (oElements[i].className) {
            case "group_inactive":
                oElements[i].className = "group_inactive";
                break;
            case "group_active":
                oElements[i].className = "group_inactive";
                break;
        }
    }
    // Show user selected campaign
    oSelectedGroup.className = "group_active";

}

function showOrHideGroup(groupName) {
    //get link element and div
    var link = document.getElementById(groupName);
    var div = document.getElementById(groupName + "Div");

    //shor or hide div
    if (div.style.visibility == "hidden") {
        pageTracker._trackPageview('competitive_comparison2/show/' + groupName);
        link.innerHTML = "<b>Hide " + groupName + "</b>";
        div.style.display = "";
        div.style.visibility = "visible";
        div.style.position = "relative";
    } else {
        pageTracker._trackPageview('competitive_comparison2/hide/' + groupName);
        link.innerHTML = "<b>Show " + groupName + "</b>";
        div.style.display = "none";
        div.style.visibility = "hidden";
        div.style.position = "absolute";
    }
}

function printGroup(groupVehicle, groupName) {
	/* Set Metrics */
    pageTracker._trackPageview('competitive_comparison2/print/' + groupName);
    /* Pop Print Group */
    var winWidth = 800;
    var winHeight = 500;
    var winLeft = (screen.width - winWidth) / 2;
    var winTop = (screen.height - winHeight) / 2;

    window.open('compare_print.aspx?vehicle=' + groupVehicle + '&group=' + groupName, 'PrintCompareGroup', 'height=' + winHeight + ',width=' + winWidth + ',top=' + winTop + ',left=' + winLeft + ',toolbars=no,menubar=no,location=no,scrollbars=yes,resizable=yes,status=yes');
    return false;
}