﻿//newsletter Subscription js
var menuYloc = null;
//$(document).ready(function() {
function scroolmsg(name) {
    menuYloc = parseInt($(name).css("top").substring(0, $(name).css("top").indexOf("px")))
    $(window).scroll(function() {
        if (name == "#newsMsg" && $(document).scrollTop() < 450) {
            offset = menuYloc + "px";
        }
        else {
            offset = menuYloc + $(document).scrollTop() + "px";
        }
        $(name).animate({ top: offset }, { duration: 500, queue: false });
    });

    $('#close_message').click(function() {
        $(name).animate({ top: "+=15px", opacity: 0 }, "slow");
    });
}
//); 

function CheckKeyPress(keyCode) {
    try {
        if (keyCode == 13) {
            nl_Subscription();
            return false;
        }
    }
    catch (ex) {
        alert(ex.message);
    }
}


function nl_Subscription() {

    var emailaddress = $("#txtemail");
    var fields = "";
    var filter = /^[a-zA-Z0-9]+[a-zA-Z0-9_.-]+[a-zA-Z0-9_-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{2,4}$/;

    if (emailaddress.val() <= 0) {
        fields += "\n --Please enter e-mail address."
    }
    else {
        //if it's NOT valid
        if (!filter.test(emailaddress.val())) {
            fields += "\n --The e-mail you entered appears to be incorrect. (Example: yourscreenname@aol.com)."
        }
    }


    // check if form has any errors    
    if (fields != "") {
        alert("Following fields are required" + fields);
        return false;
    }
    else {
        $('#msgloading').html("<img src='images/loader.gif' />");
        // the element to act on if viewable
        $.ajax({
            type: "POST",
            url: "newslettersubscription.ashx?email=" + $("#txtemail").val(),
            success: function(response) {
                // alert(response);
                if (response == 1) {
                    messagesBox1("Thanks for subscribing to our newsletter.");
                    $("#txtemail").val('');
                    $('#msgloading').html("");
                }
                else if (response == 2) {
                    messagesBox1("You are already subscribed to the AnyTime Banners newsletter.");
                    $('#msgloading').html("");
                }
            },
            error: function(response) {
                messagesBox1("newsletter subscription failed. please try again.", '')
                $('#msgloading').html("");
            }
        });
    }
}

var popupStatus1 = 0;

function messagesBox1(msg, color) {
    var msgdiv = '';
    $("#newsMsg").html('');
    msgdiv += "<div style='position:absolute; margin-top:0px;width:180px; margin-left:0px;'>";
    msgdiv += "<table style='width:auto' border='0' cellspacing='0' cellpadding='0'>";
    msgdiv += "<tr>";
    msgdiv += "<td><img src='images/gl.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "<td class='y-top'></td>";
    msgdiv += "<td><img src='images/gr.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "</tr>";
    msgdiv += "<tr>";
    msgdiv += "<td class='y-l'></td>";
    msgdiv += "<td class='y-txt'>";
    msgdiv += "<a href='javascript:void(0);' onclick='disablePopup1();'><img src='images/close-s.gif' align='right' alt='' /></a>" + msg + "</td>";
    msgdiv += "<td class='y-r'></td>";
    msgdiv += "</tr>";
    msgdiv += "<tr>";
    msgdiv += "<td><img src='images/gbl.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "<td class='y-bot'></td>";
    msgdiv += "<td><img src='images/gbr.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "</tr>";
    msgdiv += "</table>";
    msgdiv += "</div>";
    $("#newsMsg").append(msgdiv);
    //$("#sitemsg").animate({ left: "0px", top: $(window).scrollTop() + "px", "width": "180px" }, 2500).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
    $("#newsMsg").animate({ left: "0px", "width": "180px" }, 2500).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
    scroolmsg("#newsMsg");
    popupStatus1 = 1;
    //set possition according to window
    //$(window).scroll(function() {
    //$("#sitemsg").css({ "top": $(window).scrollTop() + "px","display":"relative"});
    //});
}


/* show user messages */
//0 means disabled; 1 means enabled;
var popupStatus = 0;

function messagesBox(msg, color) {
    var msgdiv = '';
    $("#sitemsg").html('');
    msgdiv += "<div style='position:absolute; margin-top:0px;width:180px; margin-left:0px;'>";
    msgdiv += "<table style='width:auto' border='0' cellspacing='0' cellpadding='0'>";
    msgdiv += "<tr>";
    msgdiv += "<td><img src='images/gl.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "<td class='y-top'></td>";
    msgdiv += "<td><img src='images/gr.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "</tr>";
    msgdiv += "<tr>";
    msgdiv += "<td class='y-l'></td>";
    msgdiv += "<td class='y-txt'>";
    msgdiv += "<a href='javascript:void(0);' onclick='disablePopup();'><img src='images/close-s.gif' align='right' alt='' /></a>" + msg + "</td>";
    msgdiv += "<td class='y-r'></td>";
    msgdiv += "</tr>";
    msgdiv += "<tr>";
    msgdiv += "<td><img src='images/gbl.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "<td class='y-bot'></td>";
    msgdiv += "<td><img src='images/gbr.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "</tr>";
    msgdiv += "</table>";
    msgdiv += "</div>";
    $("#sitemsg").append(msgdiv);
    //$("#sitemsg").animate({ left: "0px", top: $(window).scrollTop() + "px", "width": "180px" }, 2500).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
    $("#sitemsg").animate({ left: "0px", "width": "180px" }, 2500).fadeOut(300).fadeIn(300).fadeOut(300).fadeIn(300);
    scroolmsg("#sitemsg");
    popupStatus = 1;
    //set possition according to window
    //$(window).scroll(function() {
    //$("#sitemsg").css({ "top": $(window).scrollTop() + "px","display":"relative"});
    //});
}
function disablePopup1() {
    $("#newsMsg").hide();
}
//disabling user messages!
function disablePopup() {
    //disables popup only if it is enabled
    $("#sitemsg").hide();
}

function ClosePopup() {
    //disables popup only if it is enabled
    $("#sitemsg").hide();
}

function messagesBoxCart(msg) {
    var msgdiv = '';
    $("#sitemsg").html('');
    msgdiv += "<div style='position:absolute; margin-top:0px;width:180px;display:inline-block; margin-left:0px;'>";
    msgdiv += "<table style='width:auto' border='0' cellspacing='0' cellpadding='0'>";
    msgdiv += "<tr>";
    msgdiv += "<td><img src='images/gl.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "<td class='y-top'></td>";
    msgdiv += "<td><img src='images/gr.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "</tr>";
    msgdiv += "<tr>";
    msgdiv += "<td class='y-l'></td>";
    msgdiv += "<td class='y-txt'>";
    msgdiv += "<a href='javascript:void(0);' onclick='ClosePopup();'><img src='images/close-s.gif' align='right' alt='' /></a>" + msg + "</td>";
    msgdiv += "<td class='y-r'></td>";
    msgdiv += "</tr>";
    msgdiv += "<tr>";
    msgdiv += "<td><img src='images/gbl.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "<td class='y-bot'></td>";
    msgdiv += "<td><img src='images/gbr.gif' width='6' height='5' alt='' /></td>";
    msgdiv += "</tr>";
    msgdiv += "</table>";
    msgdiv += "</div>";
    $("#sitemsg").append(msgdiv);
    $("#sitemsg").animate({ "width": "180px" }, 200).fadeOut(200).fadeIn(200).fadeOut(200).fadeIn(200);
    //$("#sitemsg").fadeOut(9500);
    scroolmsg("#sitemsg");

}


function checkFundRaiser() {

    if (document.getElementById("ctl00_ContentPlaceHolder1_txtfname").value == "") {
        alert('Please enter First Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtfname").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtlname").value == "") {
        alert('Please enter Last Name');
        document.getElementById("ctl00_ContentPlaceHolder1_txtlname").focus();
        return false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail")) {
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value == "") {
            alert("Please Enter your Email ID");
            document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
            return false;
        }
        var emailPat = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
        var emailid = document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value;
        var matchArray = emailid.match(emailPat);
        if (matchArray == null) {
            alert("The e-mail address you entered appears to be incorrect.  (Example: yourscreenname@aol.com)");
            document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
            return false;
        }
    }

}

function set_shippingInfo() {
    //    if (document.getElementById("chkfill").checked == true) {
    if (document.getElementById("ctl00_ContentPlaceHolder1_chkfill").checked == true) {
        if (document.aspnetForm.ctl00_ContentPlaceHolder1_txtfname.value == "" || document.aspnetForm.ctl00_ContentPlaceHolder1_txtlname.value == "" || document.aspnetForm.ctl00_ContentPlaceHolder1_txtadd1.value == "" || document.aspnetForm.ctl00_ContentPlaceHolder1_ddlbstate.value == "" || document.aspnetForm.ctl00_ContentPlaceHolder1_txtcity.value == "" || document.aspnetForm.ctl00_ContentPlaceHolder1_txtpin.value == "") {
            alert("Please fill billing address details first");
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtfname.focus();
            document.getElementById("ctl00_ContentPlaceHolder1_chkfill").checked = false;
            //checksugadd();
            return false;
        }
        else {
            document.getElementById("ctl00_ContentPlaceHolder1_chkfill").checked = true;
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtsfname.value = document.getElementById("ctl00_ContentPlaceHolder1_txtfname").value;
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtslname.value = document.getElementById("ctl00_ContentPlaceHolder1_txtlname").value;
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtsadd1.value = document.getElementById("ctl00_ContentPlaceHolder1_txtadd1").value;
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtsadd2.value = document.getElementById("ctl00_ContentPlaceHolder1_txtadd2").value;
            document.aspnetForm.ctl00_ContentPlaceHolder1_ddlsstate.value = document.getElementById("ctl00_ContentPlaceHolder1_ddlbstate").value;
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtscity.value = document.getElementById("ctl00_ContentPlaceHolder1_txtcity").value;
            document.aspnetForm.ctl00_ContentPlaceHolder1_txtspin.value = document.getElementById("ctl00_ContentPlaceHolder1_txtpin").value;
        }
        //$('#sugadd_tr').show();
    }    
    else if (document.getElementById("ctl00_ContentPlaceHolder1_chkfill").checked == false) {
        $('#sugadd_tr').hide();
        document.aspnetForm.ctl00_ContentPlaceHolder1_txtsfname.value = "";
        document.aspnetForm.ctl00_ContentPlaceHolder1_txtslname.value = "";
        document.aspnetForm.ctl00_ContentPlaceHolder1_txtsadd1.value = "";
        document.aspnetForm.ctl00_ContentPlaceHolder1_txtsadd2.value = "";
        document.aspnetForm.ctl00_ContentPlaceHolder1_ddlsstate.value = "";
        document.aspnetForm.ctl00_ContentPlaceHolder1_txtscity.value = ""
        document.aspnetForm.ctl00_ContentPlaceHolder1_txtspin.value = "";        
    }
}


$(document).ready(function() {
    $('a#close').click(function() { $('#idshowProof').hide('slow'); })
    //    if (document.getElementById("ctl00_ContentPlaceHolder1_chkfill").checked == true) {
    //        $('#sugadd_tr').show();
    //    }
    //    else {
    //        $('#sugadd_tr').hide();
    //    }
    //checksugadd();
    //chkpaymenttype();
});

function hideproof() {
    $('#idshowProof').hide('slow');
}
function hideterms() {
    $('#idtermsconditions').hide('slow');
}

function showProof(id) {

    $('#idshowProof').html("");
    $("#idshowProof").css("height", "600");
    $("#idshowProof").css("width", "600");
    var proof = "";
    proof += "<div id='proof' style='width:600px; position:absolute; background-color:#FFF; z-index:9999;'>";
    proof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    proof += "<tr>";
    proof += "<td class='design-title'><img src='images/pop-top-l.png'/>Design Proof<span><a href='javascript:void(0);' onclick='hideproof();'><img src='images/remove.gif' alt='' /></a></span>";
    proof += "</td>";
    proof += "</tr>";
    proof += "<tr>";
    proof += "<td style='background:url(images/pop-bg.png) repeat-y; padding:18px;'>";
    proof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    proof += "<tr>";
    proof += "<td>";
    proof += "<div class='holder1'>";
    proof += "<div id='pane1' class='scroll-pane'>";
    proof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    proof += "<tr>";
    proof += "<td class='gift-sec'>";
    proof += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'";
    proof += "id='Viewer' width='600' height='400'";
    proof += "codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab'>";
    proof += "<param name='movie' value='Viewer.swf' />";
    proof += "<param name='quality' value='high' />";
    proof += "<param name='bgcolor' value='#ffffff' />";
    proof += "<param name='allowScriptAccess' value='sameDomain' />";
    proof += "<param name='FlashVars' value='info=artworkXml.ashx?id=" + id + "' />";
    proof += "<embed src='Viewer.swf' quality='high' bgcolor='#ffffff'";
    proof += "width='600' height='400' name='Viewer' align='middle'";
    proof += "play='true'";
    proof += "loop='false'";
    proof += "quality='high'";
    proof += "allowScriptAccess='sameDomain'";
    proof += "type='application/x-shockwave-flash'";
    proof += "FlashVars='info=artworkXml.ashx?id=" + id + "'";
    proof += "pluginspage='http://www.adobe.com/go/getflashplayer'>";
    proof += "</embed>";
    proof += "</object>	";
    proof += "</td>";
    proof += "</tr>";
    proof += "<tr><td style='color:#000000;text-align:left;font-family:Arial;font-size:12px;'>The dotted line indicates the edge of the banner. It will not be on your banner when it is printed</td></tr>";
    proof += "</table>";
    proof += "</div>";
    proof += "</div>";
    proof += "</td>";
    proof += "</tr>";
    proof += "</table>";
    proof += "</td>";
    proof += "</tr>";
    proof += "<tr>";
    proof += "<td><img src='images/pop-bot.png' width='647' height='11' alt='' /></td>";
    proof += "</tr>";
    proof += "</table>";
    proof += "</div>";

    $('#idshowProof').append(proof);
    centerPopup('div-center');
    $('#idshowProof').show('slow');
}


function showProofForHelp(id) {

    $('#idshowProof').html("");
    $("#idshowProof").css("height", "600");
    $("#idshowProof").css("width", "600");
    var proof = "";
    proof += "<div id='proof' style='width:600px; position:absolute; background-color:#FFF; z-index:9999;'>";
    proof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    proof += "<tr>";
    proof += "<td class='design-title'><img src='images/pop-top-l.png'/>Design Proof<span><a href='javascript:void(0);' onclick='hideproof();'><img src='images/remove.gif' alt='' /></a></span>";
    proof += "</td>";
    proof += "</tr>";
    proof += "<tr>";
    proof += "<td style='background:url(images/pop-bg.png) repeat-y; padding:18px;'>";
    proof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    proof += "<tr>";
    proof += "<td>";
    proof += "<div class='holder1'>";
    proof += "<div id='pane1' class='scroll-pane' style='height:455px;'>";
    proof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    proof += "<tr>";
    proof += "<td class='gift-sec'>";
    proof += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'";
    proof += "id='Viewer' width='600' height='400'";
    proof += "codebase='http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab'>";
    proof += "<param name='movie' value='Viewer.swf' />";
    proof += "<param name='quality' value='high' />";
    proof += "<param name='bgcolor' value='#ffffff' />";
    proof += "<param name='allowScriptAccess' value='sameDomain' />";
    proof += "<param name='FlashVars' value='info=artworkXml.ashx?id=" + id + "' />";
    proof += "<embed src='Viewer.swf' quality='high' bgcolor='#ffffff'";
    proof += "width='600' height='400' name='Viewer' align='middle'";
    proof += "play='true'";
    proof += "loop='false'";
    proof += "quality='high'";
    proof += "allowScriptAccess='sameDomain'";
    proof += "type='application/x-shockwave-flash'";
    proof += "FlashVars='info=artworkXml.ashx?id=" + id + "'";
    proof += "pluginspage='http://www.adobe.com/go/getflashplayer'>";
    proof += "</embed>";
    proof += "</object>	";
    proof += "</td>";
    proof += "</tr>";
    proof += "<tr><td style='color:#000000;text-align:left;font-family:Arial;font-size:12px;'>The dotted line indicates the edge of the banner. It will not be on your banner when it is printed</td></tr>";
    proof += "<tr><td style='color:#000000;text-align:center;font-family:Arial;font-size:12px;padding-top:10px;'><a href='javascript:void(0);' onclick='window.location.href=window.location.href;'><img src='images/refresh.gif' alt='Refresh'/></a></td></tr>";
    proof += "</table>";
    proof += "</div>";
    proof += "</div>";
    proof += "</td>";
    proof += "</tr>";
    proof += "</table>";
    proof += "</td>";
    proof += "</tr>";
    proof += "<tr>";
    proof += "<td><img src='images/pop-bot.png' width='647' height='11' alt='' /></td>";
    proof += "</tr>";
    proof += "</table>";
    proof += "</div>";

    $('#idshowProof').append(proof);
    centerPopup('div-center');
    $('#idshowProof').show('slow');
}

function showtermsConditions() {
    var vproof = "";
    vproof += "<div id='proof' class='' style='width:600px; position:absolute; background-color:#FFF; z-index:9999;'>";
    vproof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    vproof += "<tr>";
    vproof += "<td class='design-title'><img src='images/pop-top-l.png'/>Terms & Conditions<span><a href='javascript:void(0);' onclick='hideterms();'><img src='images/remove.gif' alt='' /></a></span>";
    vproof += "</td>";
    vproof += "</tr>";
    vproof += "<tr>";
    vproof += "<td style='background:url(images/pop-bg.png) repeat-y; padding:18px;'>";
    vproof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    vproof += "<tr>";
    vproof += "<td>";
    vproof += "<div class='holder1'>";
    vproof += "<div id='pane2' class='scroll-pane'>";
    vproof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    vproof += "<tr>";
    vproof += "<td class='gift-sec'>";
    vproof += "<strong>TERMS OF USE AGREEMENT BETWEEN USER AND GILL STUDIOS, Inc.</strong>";
    vproof += "<br/><br/><strong>PRIVACY POLICY</strong>";
    vproof += "<br/><br/>At Gill Studios, Inc. (&quot;Gill Studios, Inc.&quot; or &quot;We&quot;), user privacy is an important concern. We are committed to privacy and security, and to providing the best possible user experience for our users and online customers (&quot;You&quot;). We also strive to protect the personal and confidential information of those who use our on-line services. See http://www1.gill-line.com/gillweb/General.jsp?key=priv&s= for our entire Privacy Policy. This policy may be updated by us from time to time, so please check here frequently."
    vproof += "<br/><br/><strong>TERMS OF USE</strong>";
    vproof += "<br/><br/>Please read this agreement (&quot;Agreement&quot;) carefully before accessing or using the Gill Studios, Inc. online print design website at <a target=_blank href=http://www.gill-linedesigner.com/gill2180j>http://www.gill-linedesigner.com/gill2180j</a> (the &quot;Site&quot;). By accessing or using the Site, You agree to be bound by this Agreement. Gill Studios, Inc. provides the information and services on this Site to you, the user, conditioned on your acceptance without modification of the terms, conditions and notices contained herein. Your use of the Site constitutes your agreement to all such terms, conditions and notices. The information and services offered on the Site are provided with the understanding that neither Gill Studios, Inc. nor its representatives or service providers are engaged in rendering legal services or other such advice. Your use of the Site is subject to the additional disclaimers and notices that may appear throughout the Site. Gill Studios, Inc. and its representatives and service providers assume no responsibility for any consequence relating directly or indirectly to any action or inaction that you take based on the information, services or other material on this Site. While Gill Studios, Inc. strives to keep the information on this Site accurate, complete and up-to-date, Gill Studios, Inc. and its representatives cannot guarantee, and will not be responsible for any damage or loss related to, the accuracy, completeness or timeliness of the information.";
    vproof += "<br/><br/><strong>USE LIMITATIONS: PROHIBITED USES</strong>";
    vproof += "<br/><br/>We provide online print design services (the &quot;Services&quot;). Gill Studios, Inc. grants You access to the Site during the term of this agreement solely to receive the Services. You may access materials on the Site as necessary to receive the Services. You may not license, copy, distribute, create derivative works from, frame in another Web page, use on any other Web site, or sell any information, files, images, databases or lists obtained from the Site. We may provide you with downloadable low resolution proof images in jpg or other such formats. You may use such proof images for your own internal evaluation purposes. When requested, you agree to provide true, accurate and complete user information. You shall not access or attempt to access password protected, secure or non-public areas of the Web site without Gill Studios, Inc. prior written permission You will comply with all privacy laws.";
    vproof += "<br/><br/><strong>PROPRIETARY RIGHTS</strong><br/>";
    vproof += "<br/>All materials on this Site (as well as the organization and layout of the Site) are owned and copyrighted, licensed by, or used with permission that is granted to Gill Studios, Inc.. No reproduction, distribution, or transmission of the copyrighted materials at this Site is permitted without the prior written permission of Gill Studios, Inc..";
    vproof += "<br/><br/><strong>YOUR ACCOUNT</strong><br/>";
    vproof += "<br/>If you use this Site and we establish password protected areas, you are responsible for maintaining the confidentiality of your account and password and for restricting access to your computer, and you agree to accept responsibility for all activities that occur under your account or password. If your status as a user of the Site is terminated, you will (i) cease using the Site and any information obtained from the site, and (ii) destroy all copies of your account information, password and any information obtained from the Site.";
    vproof += "<br/><br/><strong>NO UNLAWFUL OR PROHIBITED USE</strong><br/>";
    vproof += "<br/>As a condition of your use of this Site, you warrant to Gill Studios, Inc. that you will not use this Site for any purpose that is unlawful or prohibited by these terms. If you violate any of these terms, your permission to use the Site automatically terminates. You may not without the prior written permission of Gill Studios, Inc. use any computer code, data mining software, &quot;robot,&quot; &quot;bot,&quot; &quot;spider,&quot; &quot;scraper&quot; or other automatic device, or program, algorithm or methodology having similar processes or functionality, or any manual process, to monitor or copy any of the Web pages, data or content found on this site or accessed through this site. If you are under the age of 13, you may not use this Site.";
    vproof += "<br/><br/><strong>DISCLAIMER OF WARRANTIES</strong><br/>";
    vproof += "<br/>YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THIS SITE AND THE SERVICES OFFERED AT THE SITE IS AT YOUR SOLE RISK. THE SITE IS PROVIDED ON AN &quot;AS IS&quot; AND &quot;AS AVAILABLE&quot; BASIS. GILL STUDIOS, INC. AND ITS SERVICE PROVIDERS EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE SITE IS DONE AT YOUR OWN DISCRETION AND RISK AND YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM THE DOWNLOAD OF ANY SUCH MATERIAL.";
    vproof += "<br/><br/><strong>LIMITATION OF LIABILITY</strong><br/>";
    vproof += "<br/>YOU EXPRESSLY UNDERSTAND AND AGREE THAT NEITHER GILL STUDIOS, INC. NOR ITS SERVICE PROVIDERS SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO, DAMAGES FOR LOSS OF PROFITS, GOODWILL, USE, DATA OR OTHER INTANGIBLE LOSSES (EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES), RESULTING FROM: (i) THE USE OR THE INABILITY TO USE THE SITE OR SERVICES; (ii) THE COST OF PROCUREMENT OF SUBSTITUTE SERVICES RESULTING FROM ANY DATA, INFORMATION OR SERVICES OBTAINED OR MESSAGES RECEIVED OR TRANSACTIONS ENTERED INTO ON THE SITE OR THROUGH OR FROM THE SERVICE; (iii) UNAUTHORIZED ACCESS TO OR ALTERATION OF YOUR TRANSMISSIONS OR DATA; (iv) STATEMENTS OR CONDUCT OF ANY THIRD PARTY ON THE SERVICE; OR (v) ANY OTHER MATTER RELATING TO THE SITE OR THE SERVICES. IN NO EVENT WILL OUR MAXIMUM LIABILITY TO YOU EXCEED THE AMOUNT YOU PAID TO US FOR THE SUBJECT SERVICES OR $100, WHICHEVER IS GREATER.";
    vproof += "<br/><br/><strong>LINKS TO THIRD PARTY SITES</strong><br/>";
    vproof += "<br/>This Site may contain hyperlinks to web sites operated by parties other than Gill Studios, Inc., or its affiliates. Such hyperlinks are provided for your reference only. Gill Studios, Inc. does not control such web sites, and is not responsible for their content. Inclusion of hyperlinks by Gill Studios, Inc. to such web sites does not imply any endorsement of the material on such web sites or any association with their operators, and your access to and use of such sites, including information, material, products and services therein, is solely at your own risk. Furthermore, because the Gill Studios, Inc. privacy policy is applicable only when you are on our Site, once linked to another web site, you should read that site’s privacy policy before disclosing any personal information.";
    vproof += "<br/><br/><strong>USE OF SUBMISSIONS</strong><br/>";

    vproof += "<br/>You grant us the right to use, reproduce, modify, distribute, and display any material you supply or communicate to the Site for the stated purposes of this Agreement and to authorize others to do so.";
    vproof += "<br/><br/><strong>USER CONTENT</strong>";
    vproof += "<br/><br/>You shall not (nor cause any third party to) use the Site to perform any illegal activities (including without limitation defaming, abusing, harassing, stalking, threatening or otherwise violating the legal rights - such as rights of privacy -of others) or immoral activities or any of the following types of activities, without limitation:";
    vproof += "a. transmitting information that infringes any patent, trademark, trade secret, copyright or other proprietary rights of any party; b. transmitting any material that contains software viruses, trojan horses, worms, time bombs, cancelbots, or any other computer code, files, or programs which may interrupt, destroy or limit the functionality of any computer software or hardware or telecommunications equipment; c. impersonating anyone or any entity, falsely stating or otherwise misrepresenting your affiliation with a person or entity; d. interfering with or disrupting the Site; e. disrupting the activities or enjoyment of the Site for other users; or f. collecting, or storing personal data about other users. You agree to abide by all applicable local, state and federal laws and regulations and are solely responsible for all acts or omissions that occur under your account or password, including without limitation any of the user content created by you. You acknowledge that user content is not endorsed by Gill Studios, Inc. and such user content should not be considered to have been reviewed, screened or approved by Gill Studios, Inc.. You agree that Gill Studios, Inc., in its sole discretion, may terminate your password, account (or any part thereof) or use of the Site, and remove any user content at any time and for any or no reason. You agree that Gill Studios, Inc. shall not be liable to you or any third party for any termination of your access to the Site or deletion of any user content on the Site. You acknowledge and agree that Gill Studios, Inc. may preserve and disclose user content if required to do so by law or if Gill Studios, Inc. believes in good faith that such preservation or disclosure is reasonably necessary to comply with legal process, enforce this Agreement, respond to a claim that user content violates any third party's rights, or protect the right, property or personal safety of Gill Studios, Inc., any users of the Site, and the public. You also acknowledge that the technical processing and transmission of the Site, including without limitation user content, may involve transmissions over various networks and changes to conform and adapt to technical requirements of connecting networks or devices. Gill Studios, Inc. assumes no responsibility or liability whatsoever for the user content.";
    vproof += "<br/><br/><strong>CHANGES TO SITE</strong><br/>";
    vproof += "<br/>Gill Studios, Inc. may make improvements or changes in the information, services, products, and other materials on this Site, or terminate this Site at any time. Gill Studios, Inc. may modify this Agreement at any time, and such modifications shall be effective immediately upon posting of the modified Agreement. Accordingly, you agree to review the Agreement periodically, and your continued access or use of this Site shall be deemed your acceptance of the modified Agreement.";
    vproof += "<br/><br/><strong>MISCELLANEOUS</strong><br/>";
    vproof += "<br/>This site is intended to and directed to residents of the United States, Mexico and Canada and all advertising claims contained in this site are valid only in the United States, Mexico and Canada. This Agreement and the resolution of any dispute related to this Agreement or this Site shall be governed by and construed in accordance with the laws of Kansas, without giving effect to any principles of conflicts of law. Failure by Gill Studios, Inc. to insist upon strict enforcement of any provision of this Agreement shall not be construed as a waiver of any provision or right. You agree that regardless of any statute or law to the contrary, any claim or cause of action arising out of or related to use of this Site or this Agreement must be filed within one (1) year after such claim or cause of action arose or be forever barred. Any legal action or proceeding between Gill Studios, Inc. and you related to this Agreement shall be brought exclusively in a federal or state court of competent jurisdiction sitting in the State of Kansas, County of Johnson. If any of these terms shall be deemed invalid, void, or for any reason unenforceable, that term shall be deemed severable and shall not affect the validity and enforceability of any remaining term. Design Online and other logos, product and service names are trademarks and service marks owned by or licensed to Gill Studios, Inc. or its affiliates (the &quot;Marks&quot;). Without the prior written permission of Gill Studios, Inc., or its appropriate affiliates, you agree not to display or use in any manner, the Marks.";
    vproof += "<br/>All other trademarks are the property of their respective owners.";
    vproof += "<br/><br/>© Copyright 2007. All rights reserved.";

    vproof += "</td>";
    vproof += "</tr>";
    vproof += "</table>";
    vproof += "</div>";
    vproof += "</div>";
    vproof += "</td>";
    vproof += "</tr>";
    vproof += "</table>";
    vproof += "</td>";
    vproof += "</tr>";
    vproof += "<tr>";
    vproof += "<td><img src='images/pop-bot.png' width='647' height='11' alt='' /></td>";
    vproof += "</tr>";
    vproof += "</table>";
    vproof += "</div>";

    $('#idtermsconditions').append(vproof);
    $('#pane2').jScrollPane();
    centerPopup('div-center');
    $('#idtermsconditions').show('slow');
}


function hidekey() {
    $('#idhelp').hide('slow');
}


function showBannerHelp() {
    newwindow = window.open('builderHelp.html', 'name', 'height=400,width=600,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
    return false;
}


function showBannerHelp1() {
    $('#idhelp').html("");
    var vproof = "";
    vproof += "<div id='proof' style='width:600px; position:absolute; background-color:#FFF; z-index:9999;'>";
    vproof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    vproof += "<tr>";
    vproof += "<td class='design-title'><img src='images/pop-top-l.png'/>Build Now! Icon Key<span><a href='javascript:void(0);' onclick='hidekey();'><img src='images/remove.gif' alt='' /></a></span>";
    vproof += "</td>";
    vproof += "</tr>";
    vproof += "<tr>";
    vproof += "<td style='background:url(images/pop-bg.png) repeat-y; padding:18px;'>";
    vproof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    vproof += "<tr>";
    vproof += "<td>";
    vproof += "<div class='holder1'>";
    vproof += "<div id='pane1' class='scroll-pane' >";
    vproof += "<table width='100%' cellspacing='0' cellpadding='0'>";
    vproof += "<tr>";
    vproof += "<td class='gift-sec'>";

    vproof += "<strong>4 Basic Icons for images and template</strong><br/><br/>";

    vproof += "<img src='images/front-back-icon.gif'><strong> F/B-</strong>";
    vproof += " Is located on all editable images placed on the banner. There are 2 levels images are presented on the banner &quot;F&quot; being for the front and &quot;B&quot; for the background.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/rotation-icon.gif'><strong> Rotation-</strong>";
    vproof += " (Curved two- sided Arrow) you can click and drag horizontally to rotated clockwise and counter-clockwise to give your image a different look.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/resize-tools-icon.gif'><strong> Resize tool-</strong>";
    vproof += " (Straight two-sided Arrow) Click and drag to resize an item.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/delete-icon.gif'><strong>X-</strong>";
    vproof += " Click to delete item. ";
    vproof += "<br/><br/>";


    vproof += "<strong>Top Tool Key</strong><br/><br/>";

    vproof += "<img src='images/insert-line-icon.gif'><strong> Insert Line-</strong>";
    vproof += " The line button adds a line to the template that you can move around on the template from any part of the line and extend using the gray box on the end. If you single click on the line you can change color and thickness on the left side menu under &quot;Line Item Settings&quot; . (Please see 4 basic icons for details on how they work)";
    vproof += "<br/><br/>";

    vproof += "<img src='images/insert-circle-icon.gif'><strong> Insert Circle-</strong>";
    vproof += " This adds a Circle to the template that you can move around on the template from any part of it and extend it using the resize tool. If you single click on the Circle you can change color, and fill it with color and adjust the thickness on the left side menu under &quot;Circle Settings&quot;. (Please see 4 basic icons for details on how they work.";
    vproof += "<br/><br/>";


    vproof += "<img src='images/insert-square-icon.gif'><strong> Insert Square-</strong>";
    vproof += " This adds a Square to the template that you can move around on the template from any part of it and extend using the resize tool. If you single click on the square you can change color, and fill it with color and adjust the thickness on the left side menu under &quot;Square Settings&quot;. (Please see 4 basic icons for details on how they work.";
    vproof += "<br/><br/>";


    vproof += "<img src='images/insert-text-icon.gif'><strong> Insert Text-</strong>";
    vproof += " This adds a Text box to the template that you can move around on the template. You need to Double Click to edit text. You need to single click outside of the box to apply edit.";
    vproof += "<br/><br/>";

    vproof += "The Text box extends automatically if you click the resize tool to fit the verbiage that you entered into the box. (Please see 4 basic icons for details on how they work";
    vproof += "<br/><br/>";

    vproof += "Under &quot;<strong>Text Item Settings</strong>&quot; you will find the following:"
    vproof += "<br/><br/>";

    vproof += "<img src='images/font-icon.gif'><strong> Font-</strong>";
    vproof += " You can change the Font type ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/font-color-icon.gif'><strong> Font Color-</strong>";
    vproof += " You can change the Font color";
    vproof += "<br/><br/>";

    vproof += "<img src='images/font-size-icon.gif'><strong> Font Size-</strong>";
    vproof += " Using the slide tool you can enlarge and decrease the size of the text ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/b-icon.gif'><strong> B-</strong>";
    vproof += " This bolds the font ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/i-icon.gif'><strong> I-</strong>";
    vproof += " This place your font in Italics ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/outline-font-icon.gif'><strong> Outline Font-</strong>";
    vproof += " Click box if you want to add an outline to your font ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/outline-color-icon.gif'><strong> Outline Color-</strong>";
    vproof += " Click box if you want to add an outline to your font ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/outline-font-thickness-icon.gif'><strong> Outline Font Thickness-</strong>";
    vproof += " Using the slide tool you can enlarge and decrease the thickness of the outline";
    vproof += "<br/><br/>";

    vproof += "<img src='images/upload-images-icon.gif'><strong> Upload Images-</strong>";
    vproof += " To upload your photos and images just click on upload to browse and select a file. Once you select a file, the upload operation will start automatically and after completion the image will be added to the banner design area. Supported types are jpeg, gif, and png. The size of the image is sized on the banner based on the picture quality. If you are having an issue with the image not look correct please contact us at (614) 876-9874.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/insert-clipart-icon.gif'><strong> Insert Clipart-</strong>";
    vproof += " These are images that you can use to dress up your banner based on the category. Once you select an image, double click on it and it will populate in the middle of the banner for you to move around, resize, rotate and place in the background.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/save-icon.gif'><strong> Save-</strong>";
    vproof += " Saves your image and then it is to be proofed. ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/save-icon.gif'><strong> Save-</strong>";
    vproof += " Saves your image and then it is to be proofed. ";
    vproof += "<br/><br/>";

    vproof += "<strong>Bottom Tool Bar</strong><br/><br/>";

    vproof += "<img src='images/border-icon.gif'><strong> Border-</strong>";
    vproof += " Allows you to create a boarder around the banner 1” from the edge. The paint Border Paint Brush- this brush allows you to color the border";
    vproof += "<br/><br/>";

    vproof += "<img src='images/border-thickness-icon.gif'><strong> Border Thickness-</strong>";
    vproof += " Using the slide tool you can enlarge and decrease the border thickness";
    vproof += "<br/><br/>";

    vproof += "<img src='images/vertical-align-icon.gif'><strong> Vertical Align-</strong>";
    vproof += " Saves your image and then it is to be proofed. ";
    vproof += "<br/><br/>";

    vproof += "<img src='images/horizontal-align-icon.gif'><strong> Horizontally Align-</strong>";
    vproof += " Horizontally center the selected item on the template.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/centre-align-icon.gif'><strong> Center Align-</strong>";
    vproof += " Vertically and horizontally center the selected item on the template.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/view-proof-icon.gif'><strong> View Proof-</strong>";
    vproof += " This will allow you to view the art you created and how it will print.";
    vproof += "<br/><br/>";

    vproof += "<img src='images/zoom-icon.gif'><strong> Zoom-</strong>";
    vproof += " This allows you to view closely to the images created.";
    vproof += "<br/><br/>";

    vproof += "</td>";
    vproof += "</tr>";
    vproof += "</table>";
    vproof += "</div>";
    vproof += "</div>";
    vproof += "</td>";
    vproof += "</tr>";
    vproof += "</table>";
    vproof += "</td>";
    vproof += "</tr>";
    vproof += "<tr>";
    vproof += "<td><img src='images/pop-bot.png' width='647' height='11' alt='' /></td>";
    vproof += "</tr>";
    vproof += "</table>";
    vproof += "</div>";

    $('#idhelp').append(vproof);
    $('#pane1').jScrollPane();
    centerPopup('div-center');
    $('#idhelp').show('slow');
}


function centerPopup(element) {
    //request data for centering
    var windowWidth;
    var windowHeight;

    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
    if (typeof window.innerWidth != 'undefined') {
        windowWidth = window.innerWidth,
      windowHeight = window.innerHeight
    }
    // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
    else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
        windowWidth = document.documentElement.clientWidth,
       windowHeight = document.documentElement.clientHeight
    }
    // older versions of IE
    else {
        windowWidth = document.getElementsByTagName('body')[0].clientWidth,
        windowHeight = document.getElementsByTagName('body')[0].clientHeight
    }

    var popupHeight = $("." + element).height();
    var popupWidth = $("." + element).width();

    //centering
    $("." + element).css({
        "position": "absolute",
        "top": windowHeight / 2 - popupHeight / 2,
        "left": windowWidth / 2 - popupWidth / 2
    });

    $("." + element).css({ "top": $(window).scrollTop() + "px" });
}



function customizeTemplate(applink) {
    window.location.href = applink + "#designer"
}

function showRoom(link) {
    newwindow = window.open(link, 'name', 'height=580,width=950,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
    return false;
}

function showVideo() {
    newwindow = window.open('builderHelp.aspx', 'name', 'height=600,width=900,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
    return false;
}

function showBHelp(link) {
    newwindow = window.open(link, 'name', 'height=400,width=600,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
    return false;
}

//get mural price
function getmuralprice(id) {
    $('#myorderhistory').html("<img src='images/loading-1.gif' />");
    $("#ctl00_ContentPlaceHolder1_widthft").ForceNumericOnly();
    $("#ctl00_ContentPlaceHolder1_widthin").ForceNumericOnly();
    $("#ctl00_ContentPlaceHolder1_heightft").ForceNumericOnly();
    $("#ctl00_ContentPlaceHolder1_heightin").ForceNumericOnly();

    var widthft = $('#ctl00_ContentPlaceHolder1_widthft').val();
    var widthin = $('#ctl00_ContentPlaceHolder1_widthin').val();
    var heightft = $('#ctl00_ContentPlaceHolder1_heightft').val();
    var heightin = $('#ctl00_ContentPlaceHolder1_heightin').val();
    var price = $('#ctl00_ContentPlaceHolder1_persqrprice').val();

    var minarea = $('#ctl00_ContentPlaceHolder1_hfminarea').val();
    //var minheightin = $('#ctl00_ContentPlaceHolder1_hfminheight').val();
    //alert(widthft + " " + widthin + " " + heightft + " " + heightin);

    if (widthft != "" && heightft != "") {
        if (widthin == "") {
            widthin = 0;
        }

        if (heightin == "") {
            heightin = 0;
        }


        var widthIn;
        widthIn = ConvertToInches(parseInt(widthft));
        if (widthin != 0) {
            widthIn += parseInt(widthin);
        }
        var heightIn;
        heightIn = ConvertToInches(parseInt(heightft));
        if (heightin != 0) {
            heightIn += parseInt(heightin);
        }
        var squareInches = widthIn * heightIn;
        $('#ctl00_ContentPlaceHolder1_ltrprice').html(((squareInches * parseFloat(price)) / 12).toFixed(2));
        $('#ctl00_ContentPlaceHolder1_ddlPrice').val(0);
        $('#ctl00_ContentPlaceHolder1_customprice').val(((squareInches * parseFloat(price)) / 12).toFixed(2));
        $('#ctl00_ContentPlaceHolder1_hdnwidth').val(widthIn);
        $('#ctl00_ContentPlaceHolder1_hdnheight').val(heightIn);
        //document.getElementById("ctl00_ContentPlaceHolder1_updddlprice").value = 0;
        checkwidthheight(minarea);
    }
}
function checkwidthheight(minarea) {
    var widthft = $('#ctl00_ContentPlaceHolder1_widthft').val();
    var widthin = $('#ctl00_ContentPlaceHolder1_widthin').val();
    var heightft = $('#ctl00_ContentPlaceHolder1_heightft').val();
    var heightin = $('#ctl00_ContentPlaceHolder1_heightin').val();
    var currwidth;
    var currheight;

    currwidth = ConvertToInches(parseInt(widthft));
    if (widthin != 0) {
        currwidth += parseInt(widthin);
    }
    currheight = ConvertToInches(parseInt(heightft));
    if (heightin != 0) {
        currheight += parseInt(heightin);
    }

    var currarea = currwidth * currheight;
    var ftarea = ConvertToFeet(parseInt(currwidth)) * ConvertToFeet(parseInt(currheight));
    if (minarea > currarea) {
        document.getElementById("ctl00_ContentPlaceHolder1_errmsg").innerHTML = "Total area must be greater than or equal to " + ConvertareaToFeet(parseInt(minarea)) + " ft per sq ";
        return false;
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_errmsg").innerHTML = "";
    }

    //    else if (minheight > currheight) {
    //        document.getElementById("ctl00_ContentPlaceHolder1_errmsg").innerHTML = "Please enter height greater than or equal to " + ConvertToFeet(minheight) + " ft ";
    //        return false;
    //    }
}

function ConvertToInches(feet) {
    return feet * 12;
}
function ConvertToFeet(inch) {
    return inch / 12;
}
function ConvertareaToFeet(area) {
    return area / 144;
}

//get mural price

// Numeric only control handler

jQuery.fn.ForceNumericOnly =
function() {
    //  alert(this.attr('id'));
    return this.each(function() {
        $(this).keydown(function(e) {
            var key = e.charCode || e.keyCode || 0;
            // allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
            return (
                key == 8 ||
                key == 9 ||
                key == 46 ||
                (key >= 37 && key <= 40) ||
                (key >= 48 && key <= 57) ||
                (key >= 96 && key <= 105));
        })
    })
};


//start insert to cart
function addToUserCart(id, pid, option) {
    // $('#msgloading').html("<img src='images/loader.gif' />");
    var re = '^[1-9]?$';
    var itemoption = jQuery.trim($('#' + option + " option:selected").text());
    if ($('#' + id).val() != "") {
        $.ajax({
            type: "POST",
            url: "addtocart.ashx?pid=" + pid + "&qty=" + $('#' + id).val() + "&option=" + itemoption,
            success: function(response) {
                if (response == 'success') {
                    messagesBoxCart('Product(s) has been successfully added<br />to your cart<br />.');
                    //centerPopup(); 
                    //loadPopup();
                    //fetchCart();
                }
                else if (response == 'failure') {
                    messagesBoxCart('Product has been not been added<br />to your cart<br />.')
                }
            },
            error: function(response) {
                messagesBoxCart('Product has been not been added<br />to your cart<br />.')
            }
        });
        $("#" + id).val('');
    }
}
//end insert to cart

//check numeric value
function numbersOnly(id) {
    textbox = $("#" + id).val();
    $("#" + id).val(textbox.replace(/[^0-9\.]/g, ''));
}


//
function fetchCart() {
    //Click out event!
    $("#backgroundPopup").click(function() {
        disablePopup();
    });
    //Press Escape event!
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup();
        }
    });

    $("#ButtonArea").html("");
    $("#previewArea").html("<img src='images/loading.gif' alt='loadign'/>");

    $.ajax({
        type: "POST",
        url: "getcart.ashx",
        success: function(response) {

            $("#ButtonArea").css({ "text-align": "right", "padding-right": "20px", "padding-top": "0px", "font-weight": "bold" });
            $("#ButtonArea").html("<A href='javascript:void(0);' onclick='disablePopup();'><img src='images/continue-s.gif'></a>&nbsp;&nbsp;<A href='billing-details.aspx'><img src='images/check-out.gif'></a></br>");
            $("#previewArea").html(response);
        },
        error: function(response) { }
    });
}

function showOrder(link) {
    newwindow = window.open(link, 'name', 'height=800,width=730,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
    return false;
}



//start insert to cart
function loadMurals(id, containerDiv, pageno) {
    $("#" + containerDiv).html('<p><img src="images/ajax-loader.gif" width="220" height="19" /></p>');
    $.ajax({
        type: "POST",
        url: "getMurals.ashx?id=" + id + "&pageno=" + pageno,
        success: function(response) {
            $("#" + containerDiv).html(response);
        },
        error: function(response) {
            $("#" + containerDiv).html(response);
        }
    });
}
//end insert to cart




//function check_qty(count) {
//    var test = 0;
//    for (var i = 0; i < count; i++) {
//        if (emptyField(document.getElementById("ctl00_ContentPlaceHolder1_dlproducts_ctl0" + i + "_txtquantity"))) {
//            alert('Please enter quantity');
//            document.getElementById("ctl00_ContentPlaceHolder1_dlproducts_ctl0" + i + "_txtquantity").focus();
//            return false;
//        }
//        if (document.getElementById("ctl00_ContentPlaceHolder1_dlproducts_ctl0" + i + "_txtquantity").value < 1) {
//            alert('Please enter valid numeric value greater than zero in quantity field.');
//            document.getElementById("ctl00_ContentPlaceHolder1_dlproducts_ctl0" + i + "_txtquantity").focus();
//            return false;
//        }

//        if (!isInt(document.getElementById("ctl00_ContentPlaceHolder1_dlproducts_ctl0" + i + "_txtquantity").value)) {
//            alert('Please enter valid numeric value greater than zero in quantity field.');
//            document.getElementById("ctl00_ContentPlaceHolder1_dlproducts_ctl0" + i + "_txtquantity").focus();
//            return false;
//        }
//    }



//}

function check_qty(id) {

    if (emptyField(document.getElementById(id))) {
        alert('Please enter quantity');
        document.getElementById(id).focus();
        return false;
    }
    if (document.getElementById(id).value < 1) {
        alert('Please enter valid numeric value greater than zero in quantity field.');
        document.getElementById(id).focus();
        return false;
    }

    if (!isInt(document.getElementById(id).value)) {
        alert('Please enter valid numeric value greater than zero in quantity field.');
        document.getElementById(id).focus();
        return false;
    }

}
function emptyField(textobj) {

    if (textobj.value.length == 0) {
        textobj.focus();
        return true;
    }
    for (var i = 0; i < textobj.value.length; ++i) {
        var ch = textobj.value.charAt(i);
        if (ch != ' ' && ch != '\t')
            return false;
    }
    textobj.focus();
    return true;
}

function isInt(argvalue) {
    argvalue = argvalue.toString();

    if (argvalue.length == 0) {
        return true;
    }

    for (var n = 0; n < argvalue.length; n++) {

        if (argvalue.substring(n, n + 1) == "0")
            continue;

        else if (argvalue.substring(n, n + 1) == "1")
            continue;

        else if (argvalue.substring(n, n + 1) == "2")
            continue;

        else if (argvalue.substring(n, n + 1) == "3")
            continue;

        else if (argvalue.substring(n, n + 1) == "4")
            continue;

        else if (argvalue.substring(n, n + 1) == "5")
            continue;

        else if (argvalue.substring(n, n + 1) == "6")
            continue;

        else if (argvalue.substring(n, n + 1) == "7")
            continue;

        else if (argvalue.substring(n, n + 1) == "8")
            continue;

        else if (argvalue.substring(n, n + 1) == "9")
            continue;

        /*else if(argvalue.substring(n, n+1) == " ")
        continue;*/

        else
            return false;

    }
    return true;
}


function datevalidation(datetime, datename) {
    var workingDays = 3;
    var id = document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate");
    var datevalue = id.value;
    var arrDT = datevalue.split("/");

    var d = new Date();

    var m = new Date();

    var var_date = d.getDate();
    var var_Month = d.getMonth();
    var var_Year = d.getFullYear();
    
    Date.prototype.getDayName = function() {
        var d = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
        return d[this.getDay()];
    }
    var my_day = d.getDayName();
    if (var_Year > arrDT[2]) {
        alert("In Hand date must be " + workingDays + " working days ahead of todays date.");
        document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").value = "";
        document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").focus();
        return false;
    }
    else if (var_Year == arrDT[2]) {
        if ((var_Month + 1) > arrDT[0]) {
            alert("In Hand date must be " + workingDays + " working days ahead of todays date.");
            document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").value = "";
            document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").focus();
            return false;
        }
        else if ((var_Month + 1) == arrDT[0]) {
            if (var_date > arrDT[1]) {
                alert("In Hand date must be " + workingDays + " working days ahead of todays date.");
                document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").value = "";
                document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").focus();
                return false;
            }
            else {
                if (datename == 'Saturday') {
                    var_date = var_date + 5; //for 3 days add 5 and for 5 days add 8
                }
                else if (datename == 'Friday') {
                    var_date = var_date + 5; //for 3 days add 6 and for 5 days add 9
                }
		else if (datename == 'Wednesday') {
                    var_date = var_date + 5; //for 3 days add 5 and for 5 days remove this
                }
                else {
                    var_date = var_date + 4; //for 3 days add 4 and for 5 days add 7
                }
                if (var_date >= arrDT[1]) {
                    alert("In Hand date must be " + workingDays + " working days ahead of todays date.");
                    document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").value = "";
                    document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").focus();
                    return false;
                }
                else {
                    return true;
                }
            }
        }
        else {
            return true;
        }
    }
    else {
        if (var_Month == 11 && arrDT[0] == 01) {
            if (datename == 'Saturday') {
                var_date = var_date + 5; //for 3 days add 5 and for 5 days add 8
            }
            else if (datename == 'Friday') {
                var_date = var_date + 6; //for 3 days add 6 and for 5 days add 9
            }
            else {
                var_date = var_date + 4; //for 3 days add 4 and for 5 days add 7
            }
            if (var_date > 31) {
                var_date = var_date - 31; 
            }
            if (var_date >= arrDT[1]) {
                alert("In Hand date must be " + workingDays + " working days ahead of todays date.");
                document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").value = "";
                document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").focus();
                return false;
            }
            else {
                return true;
            }
        }
    }
}

function SetVisibility(id1, value1, id2, value2) {
    if (value1 == false) {
        document.getElementById(id1).style.visibility = "hidden";
    }
    else if (value1 == true) {
        document.getElementById(id1).style.visibility = "visible";
    }
    if (value2 == false) {
        document.getElementById(id2).style.visibility = "hidden";
    }
    else if (value2 == true) {
        document.getElementById(id2).style.visibility = "visible";
    }
}
function SetBothVisibility(id1, id2, value) {
    if (value == false) {
        document.getElementById(id1).style.visibility = "hidden";
        document.getElementById(id2).style.visibility = "hidden";

    }
    else if (value == true) {
        document.getElementById(id1).style.visibility = "visible";
        document.getElementById(id2).style.visibility = "visible";
    }
}

function showSecurityCard() {
    newwindow = window.open('cvv.html', 'name', 'height=400,width=600,scrollbars=yes');
    if (window.focus) { newwindow.focus() }
    return false;
}

function checkprice() {    
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtquantity").value == "") {
        alert("--Please enter your quantity. \n");
        return false;  
    }    
}

function checkDateShipDetails(dayname, currflag) {

    var errmsg = "Following fields need to be enter. \n";
    var flag = true;
    //    if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value == "") {
    //        errmsg += "--Please enter your Email Address \n";
    //        if (flag == true) {
    //            document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
    //        }
    //        flag = false;

    //    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail")) {
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value == "") {
            errmsg += "--Please enter your Email Address \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
            }
            flag = false;
        }
        else {
            var emailPat = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
            var emailid = document.getElementById("ctl00_ContentPlaceHolder1_txtemail").value;
            var matchArray = emailid.match(emailPat);
            if (matchArray == null) {
                errmsg += "--The e-mail address you entered appears to be incorrect.\n E-mail addresses must contain an 'at' sign (@) and a period (.). (Example: yourscreenname@aol.com). \n\n"
                if (flag == true) {
                    document.getElementById("ctl00_ContentPlaceHolder1_txtemail").focus();
                }
                flag = false;
            }
        }
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtphone").value == "") {
        errmsg += "--Please enter your Phone Number \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtphone").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").value == "") {
        errmsg += "--Please enter In hand Date \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtinhanddate").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtfname").value == "") {
        errmsg += "--Please enter your Billing First Name \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtfname").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtlname").value == "") {
        errmsg += "--Please enter your Billing Last Name \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtlname").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtadd1").value == "") {
        errmsg += "--Please enter your Billing Address Line 1 \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtadd1").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtcity").value == "") {
        errmsg += "--Please enter your Billing City \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtcity").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlbstate").value == "") {
        errmsg += "--Please enter your Billing State \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_ddlbstate").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtpin").value == "") {
        errmsg += "--Please enter your Billing Pin Code \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_txtpin").focus();
        }
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_ddlcountry").value == "") {
        errmsg += "--Please enter your Billing Country \n";
        if (flag == true) {
            document.getElementById("ctl00_ContentPlaceHolder1_ddlcountry").focus();
        }
        flag = false;
    }
    if (currflag != "Billverify") {
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtsfname").value == "") {
            errmsg += "--Please enter your Shipping First Name \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_txtsfname").focus();
            }
            flag = false;
        }
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtslname").value == "") {
            errmsg += "--Please enter your Shipping Last Name \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_txtslname").focus();
            }
            flag = false;
        }
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtsadd1").value == "") {
            errmsg += "--Please enter your Shipping Address Line 1 \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_txtsadd1").focus();
            }
            flag = false;
        }
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtscity").value == "") {
            errmsg += "--Please enter your Shipping City \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_txtscity").focus();
            }
            flag = false;
        }
        if (document.getElementById("ctl00_ContentPlaceHolder1_ddlsstate").value == "") {
            errmsg += "--Please enter your Shipping State \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_ddlsstate").focus();
            }
            flag = false;
        }
        if (document.getElementById("ctl00_ContentPlaceHolder1_txtspin").value == "") {
            errmsg += "--Please enter your Shipping Pin Code \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_txtspin").focus();
            }
            flag = false;
        }
        if (document.getElementById("ctl00_ContentPlaceHolder1_ddlscountry").value == "") {
            errmsg += "--Please enter your Shipping Country \n";
            if (flag == true) {
                document.getElementById("ctl00_ContentPlaceHolder1_ddlscountry").focus();
            }
            flag = false;
        }
    }
    if (flag == false) {
        alert(errmsg);
        return flag;
    }
    else {
        if (datevalidation(1, dayname)) {
            return true;
        }
        else {
            return false;
        }
    }

}

function adjustDivs() {

    var df = document.getElementById('progTemplate');
    var foreItem = document.getElementById('progDisplay');
    var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
    var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
    var clientWidth;
    if (window.innerWidth) {
        clientWidth = (window.__safari ? window.innerWidth : Math.min(window.innerWidth, document.documentElement.clientWidth));
    } else {
        clientWidth = document.documentElement.clientWidth;
    }
    var clientHeight;
    if (window.innerHeight) {
        clientHeight = (window.__safari ? window.innerHeight : Math.min(window.innerHeight, document.documentElement.clientHeight));
    } else {
        clientHeight = document.documentElement.clientHeight;
    }
    df.style.position = 'absolute';
    foreItem.style.position = 'absolute';
    df.style.left = scrollLeft + 'px';
    df.style.top = scrollTop + 'px';
    df.style.width = clientWidth + 'px';
    df.style.height = clientHeight + 'px';
    foreItem.style.left = scrollLeft + ((clientWidth - foreItem.offsetWidth) / 2) + 'px';
    foreItem.style.top = scrollTop + ((clientHeight - foreItem.offsetHeight) / 2) + 'px';

}
function chkpaymenttype() {
    if (document.getElementById("ctl00_ContentPlaceHolder1_rdbtnpaymenttype_0").checked == true) {
        document.getElementById("ctl00_ContentPlaceHolder1_rfvccard").enabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_rfvcustname").enabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_rfvcardno").enabled = true;
        document.getElementById("ctl00_ContentPlaceHolder1_rfvscode").enabled = true;

        //document.getElementById("ctl00_ContentPlaceHolder1_rfvappcode").enabled = false;
        //document.getElementById("ctl00_ContentPlaceHolder1_rfvponumber").enabled = false;
    }
    else if (document.getElementById("ctl00_ContentPlaceHolder1_rdbtnpaymenttype_1").checked == true) {
        //document.getElementById("ctl00_ContentPlaceHolder1_rfvappcode").enabled = true;
        //document.getElementById("ctl00_ContentPlaceHolder1_rfvponumber").enabled = true;

        document.getElementById("ctl00_ContentPlaceHolder1_rfvccard").enabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_rfvcustname").enabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_rfvcardno").enabled = false;
        document.getElementById("ctl00_ContentPlaceHolder1_rfvscode").enabled = false;
    }

}
function getQtyPrice(qty, id, target, flag, side) {
    var reint = '^[0-9]*$';
    //var reint = '[+]?[0-9]*$';
    // $('#txtfrom' + i).val()
    if ($('#' + qty).val() == "") {
        alert('Please enter quantity');
        $('#' + qty).focus();
        return false;
    }

    if (!$('#' + qty).val().match(reint)) {
        alert('Please enter numeric value for quantity');
        $('#' + qty).focus();
        return false;
    }

    if ($('#' + qty).val() <= 0) {
        alert('Quantity must be greater than 0');
        $('#' + qty).focus();
        return false;
    }

    if ($('#' + qty).val() != "" && $('#' + qty).val() > 0) {
        $.ajax({
            type: "POST",
            url: "getProductPrice.ashx?id=" + id + "&qty=" + $('#' + qty).val() + "&flag=" + flag + "&side=" + side,
            success: function(response) {
                $("#" + target).html(response);
            },
            error: function(response) {
                $("#" + target).html(response);
            }
        });
    }

}
function showPrice(link) {
    newwindow = window.open(link, 'name', 'height=350,width=400,scrollbars=no,left=200,top=100');
    if (window.focus) { newwindow.focus() }
    return false;
}
function getQtyPriceRange(qty, id, target, flag, side, rangetarget) {
    //alert("call");
    var reint = '^[0-9]*$';
    //var reint = '[+]?[0-9]*$';
    // $('#txtfrom' + i).val()
    if ($('#' + qty).val() == "") {
        alert('Please enter quantity');
        $('#' + qty).focus();
        return false;
    }

    if (!$('#' + qty).val().match(reint)) {
        alert('Please enter numeric value for quantity');
        $('#' + qty).focus();
        return false;
    }

    if ($('#' + qty).val() <= 0) {
        alert('Quantity must be greater than 0');
        $('#' + qty).focus();
        return false;
    }

    if ($('#' + qty).val() != "" && $('#' + qty).val() > 0) {
        $.ajax({
            type: "POST",
            url: "gettemplatepricewithrange.ashx?id=" + id + "&qty=" + $('#' + qty).val() + "&flag=" + flag + "&side=" + side,
            success: function(response) {
                var strarr = response.split(",");
                $("#" + target).html(strarr[0]);
                $("#" + rangetarget).html(strarr[1]);
            },
            error: function(response) {
                $("#" + target).html(response);
            }
        });
    }

}
//gettemplatepricewithrange.ashx

//clock
function showclock() {
    if (!document.layers && !document.all && !document.getElementById)
        return
    var Digital = new Date()
    var hours = Digital.getHours()
    var minutes = Digital.getMinutes()
    var seconds = Digital.getSeconds()
    var dn = "AM"
    if (hours > 12) { dn = "PM"; hours = hours - 12; }
    if (hours == 0) hours = 12;
    if (minutes <= 9) minutes = "0" + minutes;
    if (seconds <= 9) seconds = "0" + seconds;
    //change font size here to your desire
    myclock = "  " + hours + ":" + minutes + ":" + seconds + " " + dn + ""
    if (document.layers) {
        document.layers.liveclock.document.write(myclock)
        document.layers.liveclock.document.close()
    }
    else if (document.all)
        liveclock.innerHTML = myclock
    else if (document.getElementById)
        document.getElementById("liveclock").innerHTML = myclock
    window.status = "Current Time " + hours + ":" + minutes + ":" + seconds + " " + dn;
    setTimeout("showclock()", 1000)
}


