﻿// JScript File

function showDiv1() {
    var heading = trim(document.getElementById("ProdContentHeading").innerHTML);

    if ((heading == "The Collection") || (heading == "The Collection")) {
        document.getElementById("ProdContentHeading").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn22").title = "FAQ's";
        document.getElementById("ProdLHSGrn33").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn33").title = "Demo";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";
        document.getElementById("ProdLHSGrn44").title = "Videos";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOn clsProductInfo"
        document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";
    }
    else {
        document.getElementById("ProdContentHeading").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn11").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn22").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn33").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";

        document.getElementById("ProdLHSGrn11").title = "Product Reviews";
        document.getElementById("ProdLHSGrn22").title = "FAQ's";
        document.getElementById("ProdLHSGrn33").title = "Demo";
        document.getElementById("ProdLHSGrn44").title = "Videos";


        document.getElementById("pnlProductInfo").className = "displayOn clsProductInfo"
        document.getElementById("pnlProductReview").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";
    }
}

function showDiv2() {
    var heading = trim(document.getElementById("ProdContentHeading").innerHTML);

    if ((heading == "The Collection") || (heading == "Product Reviews")) {
        document.getElementById("ProdContentHeading").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn33").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";

        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").title = "Product Reviews";
        document.getElementById("ProdLHSGrn33").title = "Demo";
        document.getElementById("ProdLHSGrn44").title = "Videos";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductFaq").className = "displayOn clsProductInfo"
        document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";
    }
    else {
        document.getElementById("ProdContentHeading").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn33").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";

        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").title = "FAQ's";
        document.getElementById("ProdLHSGrn33").title = "Demo";
        document.getElementById("ProdLHSGrn44").title = "Videos";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOn clsProductInfo"
        document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";
    }
}

function showDiv3(product) {
    var heading = trim(document.getElementById("ProdContentHeading").innerHTML);
    if ((heading == "The Collection") || (heading == "Product Reviews") || (heading == "FAQ's")) {
        document.getElementById("ProdContentHeading").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn33").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";


        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").title = "Product Reviews";
        document.getElementById("ProdLHSGrn33").title = "FAQ's";
        document.getElementById("ProdLHSGrn44").title = "Videos";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductDemo").className = "displayOn clsProductInfo"
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";

        //below function is written in \en-US\products\productDetail.aspx page
        TrackTampaxVideodAndDemo(product, "Demo");
    }
    else {
        document.getElementById("ProdContentHeading").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn33").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";

        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").title = "Product Reviews";
        document.getElementById("ProdLHSGrn33").title = "Demo";
        document.getElementById("ProdLHSGrn44").title = "Videos";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductFaq").className = "displayOn clsProductInfo"
        document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";
    }
}

function showDiv4(product) {
    var heading = trim(document.getElementById("ProdContentHeading").innerHTML);

    if ((heading == "The Collection") || (heading == "Product Reviews") || (heading == "FAQ's") || (heading == "Demo")) {
        document.getElementById("ProdContentHeading").innerHTML = "Videos";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn33").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn44").innerHTML = "Demo";

        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").title = "Product Reviews";
        document.getElementById("ProdLHSGrn33").title = "FAQ's";
        document.getElementById("ProdLHSGrn44").title = "Demo";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOn clsProductInfo"
        
        //below function is written in \en-US\products\productDetail.aspx page
        TrackTampaxVideodAndDemo(product, "Videos");
    }
    else {
        document.getElementById("ProdContentHeading").innerHTML = "Demo";
        document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
        document.getElementById("ProdLHSGrn22").innerHTML = "Product Reviews";
        document.getElementById("ProdLHSGrn33").innerHTML = "FAQ's";
        document.getElementById("ProdLHSGrn44").innerHTML = "Videos";

        document.getElementById("ProdLHSGrn11").title = "The Collection";
        document.getElementById("ProdLHSGrn22").title = "Product Reviews";
        document.getElementById("ProdLHSGrn33").title = "FAQ's";
        document.getElementById("ProdLHSGrn44").title = "Videos";

        document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductReview").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
        document.getElementById("pnlProductDemo").className = "displayOn clsProductInfo";
        document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";

        //below function is written in \en-US\products\productDetail.aspx page
        TrackTampaxVideodAndDemo(product, "Demo");
    }
}


function showReview() {
    document.getElementById("ProdContentHeading").innerHTML = "Product Reviews";
    document.getElementById("ProdLHSGrn11").innerHTML = "The Collection";
    document.getElementById("ProdLHSGrn22").innerHTML = "FAQ's";
    document.getElementById("ProdLHSGrn33").innerHTML = "Demo";
    document.getElementById("ProdLHSGrn44").innerHTML = "Videos";

    document.getElementById("ProdLHSGrn11").title = "The Collection";
    document.getElementById("ProdLHSGrn22").title = "FAQ's";
    document.getElementById("ProdLHSGrn33").title = "Demo";
    document.getElementById("ProdLHSGrn44").title = "Videos";

    document.getElementById("pnlProductInfo").className = "displayOff clsProductInfo";
    document.getElementById("pnlProductReview").className = "displayOn clsProductInfo"
    document.getElementById("pnlProductFaq").className = "displayOff clsProductInfo";
    document.getElementById("pnlProductDemo").className = "displayOff clsProductInfo";
    document.getElementById("pnlProductVideo").className = "displayOff clsProductInfo";
}

function showHideBuyLinks(buynowlinkID, buynowlinkClass, buynowalllinkID, buynowalllinkClass) {
    buynowdiv = document.getElementById(buynowlinkID);
    buynowdiv.className = buynowlinkClass;
    buynowalldiv = document.getElementById(buynowalllinkID);
    buynowalldiv.className = buynowalllinkClass;

}
function trim(str) { if (!str || typeof str != 'string') return null; return str.replace(/^[\s]+/, '').replace(/[\s]+$/, '').replace(/[\s]{2,}/, ' '); }

/*Disclaimer Popup*/
var URLLink;
function goToProd(ev) {
    origEl = ev.target || ev.srcElement;
    URLLink = origEl.parentNode.getAttribute('href');
    document.getElementById('disclaimer').style.display = 'block';
    return false;

}
function closeD() {
    document.getElementById('disclaimer').style.display = 'none';
}
function goToWheretobuy() {
    //window.location = URLLink;
    //var str = URLLink.replace("shopTampax1.aspx", "shopTampaxCA.aspx") + '&C_Id=CA';
    //alert(str);
    window.location = URLLink.replace("shopTampax1.aspx", "shopTampaxCA.aspx") + '&C_Id=CA'; //URLLink;    
    return false;
}

function USgoToWheretobuy() {
    //alert(URLLink);
    window.location = URLLink + '&C_Id=US';
    return false;
}

function CAgoToWheretobuy() {
    document.getElementById('disclaimer').style.display = 'block';
    closeBuy()
    return false;
}

function whereToBuy(ev) {
    
    origEl = ev.target || ev.srcElement;
    URLLink = origEl.parentNode.getAttribute('href');
    if (URLLink.indexOf("cii_sSKU=&cii_nRGID=") != -1) {
        window.location = URLLink + '&C_Id=US';
    }
    else if (URLLink.indexOf("SKU=&cii_sSKU") != -1) {
    
        document.getElementById('disclaimer').style.display = 'block';
        return false;
        window.location = URLLink.replace("shopTampax1.aspx", "shopTampaxCA.aspx") + '&C_Id=CA'; //URLLink;    
    }
    else {
        document.getElementById('whereToBuy').style.display = 'block';
    }
    
    return false;
}

function closeBuy() {
    document.getElementById('whereToBuy').style.display = 'none';
}

/*Disclaimer Popup Ends here*/
