//(C) Stephen Daly
// www.stephendaly.org
// Date: 11/3/2008

function backgroundFilter()
{
    var div;
    
    if(document.getElementById)
    // Standard way to get element
    div = document.getElementById('backgroundFilter'); 
    else if(document.all) 
    // Get the element in old IE's 
    div = document.all['backgroundFilter']; 
    
    // if the style.display value is blank we try to check it out here 
    if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined)
    {
        div.style.display = (div.offsetWidth!=0&&div.offsetHeight!=0)?'block':'none'; 
    }
    
    // If the background is hidden ('none') then it will display it ('block').
    // If the background is displayed ('block') then it will hide it ('none').
    div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block';
}

function popUp(obj)
{
    var div;
	var savedVehiclesBtn = document.getElementById(obj);
    
    if(document.getElementById)
    // Standard way to get element
    div = document.getElementById('savedVehiclesPopUp'); 
    else if(document.all) 
    // Get the element in old IE's 
    div = document.all['savedVehiclesPopUp']; 
    
    // if the style.display value is blank we try to check it out here 
    if(div.style.display==''&&div.offsetWidth!=undefined&&div.offsetHeight!=undefined)
    {
        div.style.display = (div.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none'; 
    }
    
    // If the PopUp is hidden ('none') then it will display it ('block').
    // If the PopUp is displayed ('block') then it will hide it ('none').
    // div.style.display = (div.style.display==''||div.style.display=='block')?'none':'block'; // commented this line
	div.style.display = "block";
    
    // Sets the position of the DIV
    div.style.left = savedVehiclesBtn.offsetLeft + "px";
    div.style.top = (savedVehiclesBtn.offsetTop + 100) + "px";
}

function showGuaranteedFit()
{
	var hoverTxt = document.getElementById("guaranteedLink");
    var div = document.getElementById('guaranteedFit');
    div.style.left = hoverTxt.offsetLeft + "px";
    div.style.top = (hoverTxt.offsetTop + 20) + "px";
    div.style.display = "block"; 
}

function showGuaranteedFitNoVehicle()
{
	var hoverTxt = document.getElementById("guaranteedLink-noVehicle");
    var div = document.getElementById('guaranteedFit-noVehicle');
    div.style.left = hoverTxt.offsetLeft + "px";
    div.style.top = (hoverTxt.offsetTop + 50) + "px";
    div.style.display = "block"; 
}


function rollOverpopUp(showHide)
{
	var hoverTxt = document.getElementById("rollOverLink");
    var div = document.getElementById('rollOverPopup');
    div.style.left = hoverTxt.offsetLeft + "px";
    div.style.top = (hoverTxt.offsetTop + 17) + "px";
    div.style.display = showHide; 
}

function showProductGuaranteedFit()
{
	var div = document.getElementById('productGuaranteedFit');
    div.style.display = "block"; 
}

function showProductDetailGuaranteedFit()
{
 var hoverTxt = document.getElementById("guaranteedLink");
    var div = document.getElementById('guaranteedFit');
    div.style.left = (hoverTxt.offsetLeft - 150) + "px";
    div.style.top = (hoverTxt.offsetTop + 55) + "px";
    div.style.display = "block"; 

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE){
	div.style.top = (hoverTxt.offsetTop + 20) + "px";
}
}

function showMyVehicleGuaranteedFit()
{
 var hoverTxt = document.getElementById("guaranteedLink");
    var div = document.getElementById('guaranteedFit');
    div.style.display = "block"; 
    div.style.left = (hoverTxt.offsetLeft - 200) + "px";
    div.style.top = (hoverTxt.offsetTop + 70) + "px";    

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE){
	div.style.top = (hoverTxt.offsetTop + 50) + "px";
}
}

function hideGuaranteedFit()
{
    var div = document.getElementById('guaranteedFit');
    div.style.display = "none"; 
}

function hideProductGuaranteedFit()
{
    var div = document.getElementById('productGuaranteedFit');
    div.style.display = "none"; 
}

function hideGuaranteedFitNoVehicle()
{
    var div = document.getElementById('guaranteedFit-noVehicle');
    div.style.display = "none"; 
}


function showMyVehicleGuaranteedFitLeftNav()
{
	var hoverTxt = document.getElementById("guaranteedLinkLeftNav");
    var div = document.getElementById('guaranteedFitLeftNav');
    div.style.display = "block";
    div.style.left = "15px";
    div.style.top = (hoverTxt.offsetTop + 205) + "px";

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE){
	div.style.top = (hoverTxt.offsetTop + 197) + "px";
}
}

function hideGuaranteedFitLeftNav()
{
    var div = document.getElementById('guaranteedFitLeftNav');
    //div.style.display = "none";
    div.style.top = "-5000px"
}
function showPriceInCart(cartID){
	
var priceInCart = "<div id=\"priceInCart\"><div class=\"popUpHead\"><span class=\"blk_txt_smaller_bold_copy\" id=\"head\">Special Pricing</span></div><div class=\"middleCnt\"><ul><li><span class=\"grayTreb11\">The manufacturer of this product requires us to advertise their suggested price, but we want to sell it to you for less.  Add this product to your shopping cart to see our special low price.  You are not obligated to purchase the product and can remove it from your shopping cart easily and at any time.</span></li></ul></div></div>";

	document.getElementById(cartID).innerHTML = priceInCart;
}

function showItemGridPriceInCart(cartID){
	
var priceInCart = "<div id=\"priceInCart\"><div class=\"popUpHead\"><span class=\"blk_txt_smaller_bold_copy\" id=\"head\">Special Pricing</span></div><div class=\"middleCnt\"><ul style=\"padding:0 20px 0 0;\"><li style=\"height:auto; padding-bottom:10px;\"><span class=\"grayTreb11\">The manufacturer of this product requires us to advertise their suggested price, but we want to sell it to you for less.  Add this product to your shopping cart to see our special low price.  You are not obligated to purchase the product and can remove it from your shopping cart easily and at any time.</span></li></ul></div></div>";

	document.getElementById(cartID).innerHTML = priceInCart;
}
 

function showPriceInCartNewProduct(cartID){
	
var priceInCart = "<div id=\"priceInCart\" style=\"left:-50px; top:20px;\"><div class=\"popUpHead\"><span class=\"blk_txt_smaller_bold_copy\" id=\"head\">Special Pricing</span></div><div class=\"middleCnt\"><ul style=\"height:100px;\"><li style=\"float: left; height: 100px; left: 12px;\"><span class=\"grayTreb11\">The manufacturer of this product requires us to advertise their suggested price, but we want to sell it to you for less.  Add this product to your shopping cart to see our special low price.  You are not obligated to purchase the product and can remove it from your shopping cart easily and at any time.</span></li></ul></div></div>";

	document.getElementById(cartID).innerHTML = priceInCart;
}

function hidePriceInCart(cartID){
	document.getElementById(cartID).innerHTML = "";
}

function showPriceInCartFeatProd(cartID, link, reduceOffsetLeft){
    var priceInCartHTML = "<div id=\"priceInCartFeatProd\"><div class=\"popUpHead\"><span class=\"blk_txt_smaller_bold_copy\" id=\"head\">Special Pricing</span></div><div class=\"middleCnt\"><ul><li><span class=\"grayTreb11\">The manufacturer of this product requires us to advertise their suggested price, but we want to sell it to you for less.  Add this product to your shopping cart to see our special low price.  You are not obligated to purchase the product and can remove it from your shopping cart easily and at any time.</span></li></ul></div></div>";
    document.getElementById(cartID).innerHTML = priceInCartHTML;
    var priceInCart = document.getElementById("priceInCartFeatProd");
    if (reduceOffsetLeft == "true") {
        priceInCart.style.left = (link.offsetLeft - 100) + "px";
    } else {
        priceInCart.style.left = link.offsetLeft + "px";
    }
    priceInCart.style.top = (link.offsetTop + 20) + "px";
}


function showProdDetailCustomGuaranteedFit()
{
 var hoverTxt = document.getElementById("guaranteedLink");
    var div = document.getElementById('guaranteedFit');
    div.style.left = hoverTxt.offsetLeft + "px";
    div.style.top = (hoverTxt.offsetTop + 55) + "px";
    div.style.display = "block"; 

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE){
	div.style.top = (hoverTxt.offsetTop + 20) + "px";
}
}

function showSelectVehicleGuaranteedFit()
{
	var div = document.getElementById('guaranteedFit');
    div.style.display = "block"; 
}