﻿
function postaddtocart(pid, vid, qty, color) {
    var to = "addtocart.aspx?ProductID=" + pid + "&VariantID=" + vid + "&Quantity="+ qty +"&Color=" + color + "&IsWishList=0&amp;IsComingSoon=0&IsGiftRegistry=0";
    postwith(to);
}

function postaddtowish(pid, vid, qty, color) {
    var to = "addtocart.aspx?ProductID=" + pid + "&VariantID=" + vid + "&Quantity=" + qty + "&Color=" + color + "&IsWishList=1&IsComingSoon=0&IsGiftRegistry=0";
    postwith(to);
}

function postwith(to) {
    var myForm = document.createElement("form");
    myForm.method = "post";
    myForm.action = to;
    document.body.appendChild(myForm);
    myForm.submit();
    document.body.removeChild(myForm);
}

function showhiderv() {
    var rvLink = document.getElementById('rvlink');
    var ele = document.getElementById("floatWin");
    var show = "1";
    
    var current = getCookie("RVSH"); 
    if(current == "1")
        show = "0";   

    if(show=="1") {        
        ele.style.display = "inline";
        rvLink.innerHTML = "Hide This";
        rvLink.title = "Hide";   
    }
    else {        
        ele.style.display = "none";
        rvLink.innerHTML = "<strong>Need Help?</strong><br/>Click Here";
        rvLink.title = "Show";
    }

    setCookie("RVSH", show, 365);    
}


function getCookie(c_name) {
    var i, x, y, ARRcookies = document.cookie.split(";");
    for (i = 0; i < ARRcookies.length; i++) {
        x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
        y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
        x = x.replace(/^\s+|\s+$/g, "");
        if (x == c_name) {
            return unescape(y);
        }
    }
}

function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}

function getBrowserWindowSize() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    }
    else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    }
    else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }

    return { width: myWidth, height: myHeight };
}



//function Searchform_Validator(theForm) {
//    if ((theForm.SearchTerm.value.length < 3) == true) {
//        alert('Please enter something to search for!');
//        theForm.SearchTerm.focus();
//        return (false);
//    }
//    else {
//        return (true);
//    }   
//}

