function parseMoney(parseString) {
    if (parseInt(parseString / 10000) >= 1) {
        var modString = parseInt(parseString % 10000);
        if (modString < 100) {
            if (modString < 10)
                modString = "00" + modString;
            else
                modString = "0" + modString;
        }
        parseString = parseMoney(parseInt(parseString / 10000)) + "," + modString;
        return parseString;
    }
    else
        return parseString;
}
function showContentPage(contentId) {
    var path = window.location.protocol + "//" + window.location.host + "/";
    window.open(path + 'contentlinkRingSizer.aspx', '', 'width=775,height=505,top=50,left=200,screenX=0,screenY=0,scrollbars=yes,menubar=no,location=no,status=yes,toolbar=no,resizable=no');
}
function Zoom(id) {
    var path = window.location.protocol + "//" + window.location.host + "/";
    var strLink = path + "zoom.aspx?sitemid=" + id + "&shape=" + document.getElementById("ctl00_ContentPlaceHolder1_hdnDiamondShape1").value + "&buildid=" + document.getElementById("ctl00_ContentPlaceHolder1_hdnbuildId").value;
    window.open(strLink, '', 'width=1000,height=900,top=0,left=0,screenX=0,screenY=0,scrollbars=No,menubar=no,location=no,status=yes,toolbar=no,resizable=no');
}
function Zoom2(id1, id2) {
    var path = window.location.protocol + "//" + window.location.host + "/";
    var strLink = path + "zoom.aspx?itemid1=" + id1 + "&itemid2=" + id2 + "&shape=" + document.getElementById("ctl00_ContentPlaceHolder1_hdnDiamondShape1").value + "&buildid=" + document.getElementById("ctl00_ContentPlaceHolder1_hdnbuildId").value;
    window.open(strLink, '', 'width=1000,height=900,top=0,left=0,screenX=0,screenY=0,scrollbars=No,menubar=no,location=no,status=yes,toolbar=no,resizable=no');
}
function fnShowHide(y) {
    if (y == 'show') {
        var a = document.getElementById('ctl00_ContentPlaceHolder1_divSelectItem');
        a.style.display = '';
    }
    else if (y == 'hide') {
        var a = document.getElementById('ctl00_ContentPlaceHolder1_divSelectItem');
        a.style.display = 'none';
    }
}
function test(id) // Ring Size Combo
{
    obj1 = document.getElementById("disperr");
    var obj = document.getElementById("disptext");
    obj1.style.display = "none";
    if (document.getElementById('ctl00_ContentPlaceHolder1_ddlSize1').value == "Other")
        obj.style.display = "block";
    else
        obj.style.display = "none";

    if (id != 'Other' && id != 'select') {
        var price = id.split('_');
        var obj = document.getElementById("ctl00_ContentPlaceHolder1_lblPrice");
        if (navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
            obj.textContent = formatCurrency(price[1]);
        else
            obj.innerText = formatCurrency(price[1]);
        var objhdn = document.getElementById("ctl00_ContentPlaceHolder1_hdnRingPrice");
        objhdn.value = price[1];
    }
    else if (id == 'select') {
        var obj = document.getElementById("ctl00_ContentPlaceHolder1_lblPrice");
        var objhdn = document.getElementById("ctl00_ContentPlaceHolder1_hdnFirstPrice");
        if (navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
            obj.textContent = objhdn.value;
        else
            obj.innerText = objhdn.value;
    }
}
function formatCurrency(num) {
    num = num.toString().replace(/\$|\,/g, '');
    if (isNaN(num))
        num = "0";
    sign = (num == (num = Math.abs(num)));
    num = Math.floor(num * 100 + 0.50000000001);
    cents = num % 100;
    num = Math.floor(num / 100).toString();
    if (cents < 10)
        cents = "0" + cents;
    for (var i = 0; i < Math.floor((num.length - (1 + i)) / 3); i++)
        num = num.substring(0, num.length - (4 * i + 3)) + ',' +
			num.substring(num.length - (4 * i + 3));
    return (((sign) ? '' : '-') + '$' + num + '.' + cents);
}
function test1() {
    obj1 = document.getElementById("disperr");
    obj = document.getElementById("ctl00_ContentPlaceHolder1_ddlSize1");
    if (obj.style.visibility == "visible") {
        if (obj.value == "select" || obj.value == "Other") {
            obj1.style.display = "block";
            return false;
        }
        else
            obj1.style.display = "none";
    }
}
function ChangeCursorToHand(ob) {
    if (navigator.appName == "Microsoft Internet Explorer") {
        ob.style.cursor = "hand";
    }
    else
        ob.style.cursor = "pointer";
}
function Sample(id) {
    /*obj = document.getElementById('ctl00_ContentPlaceHolder1_ddlSize1');
    //var path = window.location.protocol + "//" + window.location.host + "/";
    //location.href = path + "Free-Trial.aspx?itemid=" + id;
   
    if (obj != null) {
        if (obj.style.visibility == "visible") {
            if (document.getElementById('ctl00_ContentPlaceHolder1_ddlSize1').value == "select" || document.getElementById('ctl00_ContentPlaceHolder1_ddlSize1').value == "Other") {
                alert("Please Select Ring Size.");
                return false;
            }
            else {
                var dvSample = document.getElementById("dvSample");
                if (dvSample != null) {
                    dvSample.style.display = "block";
                }
            }
        }
        else {
            var dvSample = document.getElementById("dvSample");
            if (dvSample != null) {
                dvSample.style.display = "block";
            }
        }
    }
    else {
        var dvSample = document.getElementById("dvSample");
        if (dvSample != null) {
            dvSample.style.display = "block";
        }
    }*/

    var dvSample = document.getElementById("ctl00_ContentPlaceHolder1_dvSample");
    if (dvSample != null) {
        dvSample.style.display = "block";

    }

}
function fnCloseReplica() {


    var dvSample = document.getElementById("ctl00_ContentPlaceHolder1_dvSample");
    if (dvSample != null) {
        dvSample.style.display = "none";
        if (navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
            document.getElementById("ctl00_ContentPlaceHolder1_lblRaplicaMsg").textContent = "";
        else
            document.getElementById("ctl00_ContentPlaceHolder1_lblRaplicaMsg").innerText = "";
    }
    
    
}


function CheckReplica() {
    var flg = true;
    var dvSample = document.getElementById("ctl00_ContentPlaceHolder1_hndReplicaCnt");
    if (dvSample != null) {
        if (dvSample.value == "1") {
            if (navigator.userAgent.indexOf("Firefox") != -1) // If Browser is Mozilla
                document.getElementById("ctl00_ContentPlaceHolder1_lblRaplicaMsg").textContent = "Can't Add More Than 3 Replicas in Cart.";
            else
                document.getElementById("ctl00_ContentPlaceHolder1_lblRaplicaMsg").innerText = "Can't Add More Than 3 Replicas in Cart.";
            flg = false;
        }
    }
    return flg;   
}
