﻿//var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
//var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
//var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;


function showToolTip(event, divId, ctrlID) {


    var div = document.getElementById(divId);

    var posLeft = getX(event);
    posLeft = posLeft - 130 + "px";
    var posTop = getY(event);
    posTop = posTop - 25 + "px"; 
    
    
    if (isIE) {
        posLeft = posLeft.replace("px;","");
        posTop = posTop.replace("px;", "");
    }
    

    div.style.left = posLeft;
    div.style.top = posTop;

    div.style.zIndex = 1000;
    div.style.visibility = "visible";

    return false;
}


function hideToolTip(event, divId, ctrlID) {
    var div = document.getElementById(divId);
    div.style.visibility = "hidden";
    return false;
}

function openToolTip(event, divId) {

    var divContent = document.getElementById(divId);
    var windowUrl = 'about:blank';
    var dtDate = new Date();
    var sSeconds = dtDate.getMilliseconds();
    var divWindow = window.open(windowUrl, divId + sSeconds, 'left=0,top=0,width=500,height=400,location=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0,toolbar=0', true);

    divWindow.document.write("<html><title>Vehicle Tire Search Tool | Quick Lane Tire and Auto Centers</title><head><link href='App_Themes/quicklane_ami.css' rel='stylesheet' type='text/css' /></head><body>");
    divWindow.document.write(divContent.innerHTML);
    divWindow.document.write("</body></html>");
    divWindow.document.close();
    divWindow.focus();
    return false;

}

function getX(event) {
    if (event.pageX) {
        return event.pageX;
    }
    else if (window.event.clientX) {
    return window.event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
    }    
    else {    
        return 0;
    }     
}

function getY(event) {
    if (event.pageY) {
        return event.pageY;
    }
    else if (window.event.clientY) {
    return window.event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    }
    else {
        return 0;
    }
}


function showText(cntrlID) {

    $find(cntrlID).showPopup();
    

    if (cntrlID == 'popextWidthDef') {
        document.getElementById("ctl00_cphMain_ucFindTire_ddlWidth").style.visibility = "hidden";        
        document.getElementById("ctl00_cphMain_ucFindTire_ddlAspectRatio").style.visibility = "hidden";
        document.getElementById("ctl00_cphMain_ucFindTire_ddlRimSize").style.visibility = "hidden";
    }

    if (cntrlID == 'popextAspectRatioDef') {
        document.getElementById("ctl00_cphMain_ucFindTire_ddlAspectRatio").style.visibility = "hidden";
        document.getElementById("ctl00_cphMain_ucFindTire_ddlRimSize").style.visibility = "hidden";
    }

    if (cntrlID == 'popextRimSizeDef') {
        document.getElementById("ctl00_cphMain_ucFindTire_ddlRimSize").style.visibility = "hidden";
    }

    if (cntrlID == 'popextTireTypeDef') {
        document.getElementById("ctl00_cphMain_ddlFilterByTireType").style.visibility = "hidden";    
        document.getElementById("ctl00_cphMain_ddlFilterByTMWarranty").style.visibility = "hidden";
    }

    
}

function hideText(cntrlID) {

    $find(cntrlID).hidePopup();

    if (cntrlID == 'popextWidthDef') {
        document.getElementById("ctl00_cphMain_ucFindTire_ddlWidth").style.visibility = "visible";
        document.getElementById("ctl00_cphMain_ucFindTire_ddlAspectRatio").style.visibility = "visible";
        document.getElementById("ctl00_cphMain_ucFindTire_ddlRimSize").style.visibility = "visible";
    }

    if (cntrlID == 'popextAspectRatioDef') {
        document.getElementById("ctl00_cphMain_ucFindTire_ddlAspectRatio").style.visibility = "visible";
        document.getElementById("ctl00_cphMain_ucFindTire_ddlRimSize").style.visibility = "visible";
    }

    if (cntrlID == 'popextRimSizeDef') {
        document.getElementById("ctl00_cphMain_ucFindTire_ddlRimSize").style.visibility = "visible";
    }

    if (cntrlID == 'popextTireTypeDef') {
        document.getElementById("ctl00_cphMain_ddlFilterByTireType").style.visibility = "visible";
        document.getElementById("ctl00_cphMain_ddlFilterByTMWarranty").style.visibility = "visible";
    }
    
}

