var BPB_IMAGE_ROOT = "images/";
var BPB_APPROOT ="";
var BPB_NAVCONFIRM = "";
var paymentpagebase = "";

function ignoreKiosk(kiosk){
    if(kiosk.indexOf("gmac-real-estate") > -1||
            kiosk.indexOf("independent-realtor") > -1 ){	    
	    return true;
	}
	return false;
}


function ConfirmNav(){
    if(BPB_NAVCONFIRM == "") return true;
    return confirm(BPB_NAVCONFIRM)
}

function RenderFooter(kiosk){
    var kp = ""; //kiosk prefix can be keller-williams keller-williams-
    if(kiosk != undefined && kiosk != ""){
       kp = kiosk + "-";
       kiosk = kiosk + "/"
    }else{
        kiosk = "";
    }
    var BPBAPPROOT = BPB_APPROOT;
    if(window.location.protocol == "https:"){
        if(paymentpagebase != "")
            BPBAPPROOT = paymentpagebase;
    }
    
    document.write("<div class=\"footer \">");
	document.write("	<div class=\"imgcont fltlft\"><img src=\"" + BPB_IMAGE_ROOT + "footer_lft.gif\" alt=\"\" /></div>");
	document.write("	<div class=\"footboxbg color1 fltlft\">");
	document.write("		<ul id=\"footerSMBProducts\" class=\"bfz\" style=\"display:none\">");
	document.write("		</ul>");
	document.write("		<ul id=\"footerProducts\" class=\"bfz\" style=\"display:none\">");
    if(ignoreKiosk(kiosk)){
	    kp = "";
	    kiosk = "";
	}	
	document.write("			<li class=\"first\"><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "business-cards/" +kp + "business-cards.htm?rsp=true\" title=\"Business Cards\">Business Cards</a></li>");
	 if(kiosk != "downing-frye-realty/" && kiosk != "nextre/" && kiosk != "howard-hanna/" && kiosk != "realty-world/" && kiosk != "era/") {
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "postcards/" +kp + "postcards.htm?rsp=true\" title=\"PostCards\">Postcards</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "folded-cards/" +kp + "folded-cards.htm?rsp=true\" title=\"Folded Note Cards\">Folded Note Cards</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "bookmarks/" +kp + "bookmarks.htm\" title=\"Bookmarks\">Bookmarks</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "door-hangers/" +kp + "door-hangers.htm\" title=\"Door Hangers\">Door Hangers</a></li>");
	document.write("			<li><a href=\"javascript:;\" class=\"color1\" onclick=\"javascript:alert('This product will be available shortly')\" title=\"New Agent Starter Kits\">New Agent Starter Kits</a></li>");
	document.write("			<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "postcards/" +kp + "postcard-mailing.htm\" class=\"color1\" title=\"Postcard Mailing\">Postcard Mailing</a></li>");}
	else{document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "business-card-labels/" +kp + "business-card-labels.htm?rsp=true\" title=\"Labels/Stickers\">Labels/Stickers</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "business-card-magnets/" +kp + "business-card-magnets.htm?rsp=true\" title=\"Magnets\">Magnets</a></li>");}
	
	document.write("		</ul>");
	document.write("		<ul id=\"footerGeneric\">"); //style=\"float:right\"
	document.write("			<li class=\"first\"><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk +kp + "faq.htm\" title=\"FAQs\">FAQs</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk +kp + "privacy.htm\" title=\"Privacy Policy\">Privacy Policy</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk +kp + "site-security.htm\" title=\"Site Security\">Site Security</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "sitemap.htm\" title=\"Sitemap\">Html Sitemap</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "sitemap.htm\" title=\"Sitemap\">XML Sitemap</a></li>");
	document.write("			<li><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk +kp + "terms-of-use.htm\" title=\"Terms of Use\">Terms of Use</a></li>");
	document.write("			<li class=\"last\"><a class=\"color1\" onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk +kp + "contact-us.htm\" title=\"Contact Us\">Contact Us</a></li>");
	document.write("		</ul>");
	document.write("	</div><img src=\"" + BPB_IMAGE_ROOT + "footer_rgt.gif\" alt=\"\" class=\"fltrgt\" />");
	document.write("	<div class=\"bottom_cont fltlft\">");	
    document.write("		<div class=\"card fltlft\"><a href=\"#\"><img src=\"" + BPB_IMAGE_ROOT + "master_card_big.gif\" alt=\"Master Card\" title=\"Master Card\" /></a><a href=\"#\"><img src=\"" + BPB_IMAGE_ROOT + "visa_big.gif\" alt=\"Visa\" title=\"Visa\" hspace=\"4\" /></a><a href=\"#\"><img src=\"" + BPB_IMAGE_ROOT + "ammexp_big.gif\" alt=\"American Express\" title=\"American Express\" /></a></div>"); //<img src=\"" + BPB_IMAGE_ROOT + "discover.gif\" alt=\"Discover\" title=\"Discover\" /></a><a href=\"#\">
    document.write("		<div class=\"imgcont fltlft contentsm martop\">&copy; 2005-2010, BestPrintBuy.com V2.0 07/16/2010</div>");
    if (window.location.hostname.indexOf("bestprintbuy.com") == -1) {
        document.write("		<div class=\"imgcont fltrgt\"><a href=\"#\"><img src=\"" + BPB_IMAGE_ROOT + "geotrust_big.gif\" width=\"115px\" height=\"55px\" alt=\"GeoTrust\" title=\"GeoTrust\" /></a></div>");
    } else {
        document.write("		<div id=\"divIfrmGeotrust\" class=\"imgcont fltrgt\"></div>");
    }
	document.write("	</div>");
	document.write("</div>");
	
	document.write("<div id=\"mcaAccountNote\" style=\"position:absolute;display:none;width: 400px; height:125px; border: 1px solid #000000;font-weight:normal;text-align:left;z-index:9999999999;font-size:12px;font-color:#000000;background-color:#ffffff;padding:5px 5px 5px 5px;\">"+
        "Designated MCA accounts are eligible for discounts on most of our products.When you place orders through a designated MCA account, discounts are applied to the product list price and automatically show up in your order summary. Please note discounts are not available on all products. Cross sold products which are already discounted are also not eligible for additional discounts. If you need more information, feel free to call customer service at 866-763-4720. Also ask us how you can become eligible for VIP discounts on our system.</div>");
}

function AppRoot(){
    if(BPB_APPROOT == "")
        return "../";
    else
        return BPB_APPROOT;
}

function RenderHeader(kiosk, renderjs){
    var kp = ""; //kiosk prefix can be keller-williams keller-williams-
    var temp = kiosk;
    if(kiosk != undefined && kiosk != ""){
       kp = kiosk + "-";
       kiosk = kiosk + "/"
    }else{
        kiosk = "";
    }
    
    //alert(">>"+kiosk + "<< >>>>"+document.referrer+"<<<<<");
    if((kiosk == "era/") && document.referrer==""){
        window.location.href = BPB_APPROOT + "page-not-available.htm";
        return
    }
    
    if(renderjs == undefined){
        document.write("<script type=\"text/javascript\" src=\""+BPB_APPROOT+"scripts/jquery.blockUI.js\"></script>");
    }
    var BPBAPPROOT = BPB_APPROOT;
    if(window.location.protocol == "https:"){
        if(paymentpagebase != "")
            BPBAPPROOT = paymentpagebase;
    }
    
    document.write("<h1 class=\"logo fltlft\"><a onclick=\"return ConfirmNav();\" href=\""+BPBAPPROOT + kiosk + "index.htm\"><img src=\"" + BPB_IMAGE_ROOT + "logo_bpb.gif\" width=\"208\" height=\"23\" alt=\"Best PrintBuy.com\" title=\"Best PrintBuy.com\" /></a><br /><span class=\"logo_phone\">1-866-763-8720</span></h1>");
    document.write("<div class=\"home-icon\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "index.htm\"><img src=\"" + BPB_IMAGE_ROOT + "home_icon.gif\" alt=\"Click to go to the home page\" title=\"Click to go to the home page\" /></a></div>");
    document.write("<div id=\"divUserLogin\" class=\"acc-cont1 fltrgt\">");    
    document.write("			</div>");
    document.write("			<div class=\"menucont fltlft\">");
    document.write("				<div class=\"tpmenu fltlft\"><ul id=\"navmenu-h\">");
    document.write("					<li id=\"mnuProducts\" class=\"first\"><a href=\"#\" class=\"menu-bg color1\" title=\"Products\"><b>Products</b></a>");
    document.write("					<ul>");
    document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "business-cards/" +kp + "business-cards.htm?rsp=true\" title=\"Business Cards\">Business Cards</a></li>");
    document.write("						<li id=\"mnuBusinesscardlabels\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "business-card-labels/" + kp + "business-card-labels.htm\" title=\"Labels/Stickers\">Labels/Stickers</a></li>");
    if(kiosk == "downing-frye-realty/" || kiosk == "nextre/" || kiosk == "howard-hanna/" || kiosk == "realty-world/" || kiosk == "era/")
    {
    document.write("						<li id=\"mnuBusinesscardmagnets\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "business-card-magnets/" + kp + "business-card-magnets.htm\" title=\"Magnets\">Magnets</a></li>");
    }
    else
    {
    document.write("						<li id=\"mnuBusinesscardmagnets\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "magnets.htm\" title=\"Magnets\">Magnets</a></li>");
    }

    if(ignoreKiosk(kiosk)){
	    kp = "";
	    kiosk = "";
	}
	
    if(kiosk == "downing-frye-realty/" || kiosk == "nextre/" || kiosk == "howard-hanna/" || kiosk == "realty-world/" || kiosk == "era/")
    {
            document.write("						<div id=\"mnuPordPostCards\" style=\"display:none\"></div>");
            document.write("						<div id=\"mnuPordFoldedCards\" style=\"display:none\"></div>");
    }      
    else
    {       document.write("						<li id=\"mnuPordPostCards\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "postcards/" +kp + "postcards.htm?rsp=true\" title=\"Postcards\">Postcards</a></li>");
            document.write("						<li id=\"mnuPordFoldedCards\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "folded-cards/" +kp + "folded-cards.htm?rsp=true\" title=\"Folded Note Cards\">Folded Note Cards</a></li>");
            if(kiosk == "keller-williams/" || kiosk == "exit-realty/" || kiosk == "remax/" || kiosk == "weichert/" || kiosk == "coldwell-banker/" || kiosk == "prudential/" || kiosk == "century-21/")
            {
            document.write("						<li id=\"mnuPordStationery\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "stationery.htm?rsp=true\" title=\"Stationery\">Stationery</a></li>");
            }    
            if(kiosk != "independent-realtor/" && kiosk != "")
            {
            document.write("						<li id=\"mnuDoorhangers\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "door-hangers/" + kp + "door-hangers.htm\" title=\"Door Hangers\">Door Hangers</a></li>");
            }
            document.write("						<li id=\"mnuGreetings\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "greeting-cards/" + kp + "greeting-cards.htm\" title=\"Greeting Cards\">Greeting Cards</a></li>");
            document.write("						<li id=\"mnuBookmarks\" style=\"display:none\"><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "bookmarks/" + kp + "bookmarks.htm\" title=\"Book Marks\">Book Marks</a></li>");
            
            if(kiosk != "independent-realtor/" && kiosk != "")
            {
                document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "notepads/" + kp + "notepads.htm\" title=\"Notepads\">Notepads</a></li>");
            }
      }
           if(kiosk == "keller-williams/" || kiosk == "remax/" || kiosk == "weichert/")
            {    
            document.write("						<li id=\"mnuNewAgentKits\" style=\"display:none\"><a href=\"" + BPBAPPROOT + kiosk + kp + "new-agent-packages/" +kp + "new-agent-packages.htm\" title=\"New Agent Starter Kits\">New Agent Starter Kits</a></li>");
            }
            else
            {
            document.write("						<div id=\"mnuNewAgentKits\" style=\"display:none\"></div>");
            }
    

    
    
    document.write("					</ul></li>");
    document.write("					<li id=\"mnuServices\" style=\"display:none\"><a href=\"#\" class=\"menu-bg color1\" title=\"Services\"><b>Services</b></a>");
    document.write("					<ul>");
    if(kiosk != "downing-frye-realty/" && kiosk != "nextre/" && kiosk != "howard-hanna/" && kiosk != "realty-world/" && kiosk != "era/"){
    document.write("						<li><a  onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "postcards/" +kp + "postcard-mailing.htm\" title=\"Postcard Mailing\">Postcard Mailing</a>");
    document.write("						<ul>");
    document.write("							<li><a  onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/DirectMailOptions.aspx?pm=design\" title=\"Start with a design\">Use our postcard designs</a></li>");
    document.write("							<li><a  onclick=\"return ConfirmNav();\" href=\"javascript:;\" title=\"Start with buying a list\">Upload your own design</a>");
    document.write("						        <ul>");
    document.write("							        <li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/DirectMailOptions.aspx?pm=upload&size=OVE\" title=\"Upload Jumbo Postcard - 8.5 X 5.5\">Upload Jumbo Postcard</a></li>");
    document.write("							        <li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/DirectMailOptions.aspx?pm=upload&size=STA\" title=\"Start with a design\">Upload Standard Postcard</a></li>"); 
    document.write("						        </ul></li>");     
    
    document.write("						</ul></li>");
    }
    document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + kiosk + kp + "upload-design/" +kp + "upload-design.htm\" title=\"Upload your design\">Upload your design</a></li>");
  
    if(kiosk != "")
    {
        document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/CatalogRequest.aspx\" rel=\"gb_page_center[600, 525]\" title=\"Request a catalog\">Request a catalog</a></li>");
    }
    else
    {document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"#\"  title=\"Request a catalog\">Request a catalog</a></li>");}
    document.write("					</ul></li>");					
    document.write("					<li id=\"mnuMyAccount\" style=\"display:none;\"><a href=\"" + BPBAPPROOT + "Account/my-account.aspx\" class=\"menu-bg color1\" title=\"My Account\"><b>My Account</b></a>");
    document.write("					<ul>");
    document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/order-reprints.aspx\" title=\"Order Reprints\">Order Reprints</a></li>");
    document.write("						<li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/my-saved-designs.aspx\" title=\"Saved Designs\">Saved Designs</a></li>");    
    document.write("                        <li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/my-product-profile.aspx\" title=\"My Profile\">My Profile</a></li>");
    document.write("                        <li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/mail-lists.aspx\" title=\"Mailing Lists\">Mailing Lists</a></li>");
    document.write("                        <li><a onclick=\"return ConfirmNav();\" href=\"" + BPBAPPROOT + "Account/my-account.aspx\" title=\"Manage Account\">Manage Account</a></li>");
    document.write("					</ul></li>");
    document.write("				</ul></div>");
    document.write("				<div id=\"divMenuCartLinks\" class=\"tpmenu fltrgt color1\">");
    document.write("					<ul>");
    document.write("						<li class=\"youcart\" ><div id=\"mnuCartInfo\"><p><b>Your Cart</b> :0 items $ 0.00</p></div></li>");
    document.write("						<li class=\"nobg\"><div id=\"mnuOrderReprint\"><a href=\"#\"><b>Order Reprints</b></a></div></li>");
    document.write("						<li class=\"last\"><div id=\"mnuSaveDesign\"><a href=\"#\"><b>Saved Designs</b></a></div></li>");
    document.write("					</ul>");
    document.write("				</div>");
    document.write("			</div>");
    
}

function RenderIndexHeader(){    
    
    document.write("<h1 class=\"logo fltlft\"><a href=\"" + BPB_APPROOT + "index.htm\"><img src=\"" + BPB_IMAGE_ROOT + "logo_bpb.gif\" width=\"208\" height=\"23\" alt=\"Best PrintBuy.com\" title=\"Best PrintBuy.com\" /></a><br /><span class=\"logo_phone\">1-866-763-8720</span></h1>");
    document.write("<div id=\"divUserLogin\" class=\"acc-cont1 fltrgt\">");    
    document.write("			</div>");
    document.write("			<div class=\"menucont fltlft\">");
    document.write("				<div class=\"tpmenu fltlft\"><ul id=\"navmenu-h\">");
    document.write("					<li id=\"mnuSelectCompany\" class=\"first\"><a href=\"#\" class=\"menu-bg color1\" title=\"Select Company\"><b>Select Company</b></a>");
    document.write("					<ul>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "keller-williams/keller-williams-index.htm\" title=\"Keller Williams\">Keller Williams</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "exit-realty/exit-realty-index.htm\" title=\"Exit Realty\">Exit Realty</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "realty-executives/realty-executives-index.htm\" title=\"Realty Executives\">Realty Executives</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "assist-2-sell/assist-2-sell-index.htm\" title=\"Assist2Sell\">Assist2Sell</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "prudential/prudential-index.htm\" title=\"Prudential\">Prudential</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "coldwell-banker/index.htm\" title=\"Coldwell Banker\">Coldwell Banker</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "remax/remax-index.htm\" title=\"Re/Max\">Re/Max</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "realty-world/index.htm\" title=\"Realty World\">Realty World</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "weichert/weichert-index.htm\" title=\"Weichert Realtors&reg;\">Weichert Realtors&reg;</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "independent-realtor/independent-realtor-index.htm\" title=\"Independent Agency\">Independent Agency</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "century-21/century-21-index.htm\" title=\"Century 21\">Century 21</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "downing-frye-realty/downing-frye-realty-index.htm\" title=\"Downing Frye Realty\">Downing Frye Realty</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "nextre/nextre-index.htm\" title=\"NextRE\">NextRE</a></li>");
    //document.write("						<li><a href=\"" + BPB_APPROOT + "era/era-index.htm\" title=\"ERA\">ERA</a></li>");
//    document.write("						<li><a href=\"" + BPB_APPROOT + "howard-hanna/howard-hanna-index.htm\" title=\"Howard Hanna\">Howard Hanna</a></li>");
   
    document.write("					</ul></li>");
    document.write("					<li id=\"mnuMyAccount\" style=\"display:none;\"><a href=\"" + BPB_APPROOT + "Account/my-account.aspx\" class=\"menu-bg color1\" title=\"My Account\"><b>My Account</b></a>");
    document.write("					<ul>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "Account/order-reprints.aspx\" title=\"Order Reprints\">Order Reprints</a></li>");
    document.write("						<li><a href=\"" + BPB_APPROOT + "Account/my-saved-designs.aspx\" title=\"Saved Designs\">Saved Designs</a></li>");    
    document.write("                        <li><a href=\"" + BPB_APPROOT + "Account/my-product-profile.aspx\" title=\"My Profile\">My Profile</a></li>");
    document.write("                        <li><a href=\"" + BPB_APPROOT + "Account/mail-lists.aspx\" title=\"Mailing Lists\">Mailing Lists</a></li>");
    document.write("                        <li><a href=\"" + BPB_APPROOT + "Account/my-account.aspx\" title=\"Manage Account\">Manage Account</a></li>");
    document.write("					</ul></li>");
    document.write("				</ul></div>");
    document.write("				<div id=\"divMenuCartLinks\" class=\"tpmenu fltrgt color1\">");
    document.write("					<ul>");
    document.write("						<li class=\"youcart\" ><div id=\"mnuCartInfo\"><p><b>Your Cart</b> :0 items $ 0.00</p></div></li>");
    document.write("						<li class=\"nobg\"><div id=\"mnuOrderReprint\"><a href=\"#\"><b>Order Reprints</b></a></div></li>");
    document.write("						<li class=\"last\"><div id=\"mnuSaveDesign\"><a href=\"#\"><b>Saved Designs</b></a></div></li>");
    document.write("					</ul>");
    document.write("				</div>");
    document.write("			</div>");
    
    
    $('#txtPassword').keyup(function(e) {	//alert(e.keyCode);	
        if(e.keyCode == 13) {		
            ValidateCustomer();	
        }}
     );
}

function RenderDCHeader(){
    document.write("<div id=\"divUserLogin\" class=\"acc-cont1 fltrgt\">");
    document.write("				<dl>");
    document.write("					<dt><input type=\"text\" class=\"txtbox color2\" name=\"txtUserName\" id=\"txtUserName\" value=\"Username\" onfocus=\"if(this.value=='Username')this.value=''\" onblur=\"if(this.value=='')this.value='Username'\" /></dt>");
    document.write("					<dt><input type=\"password\" class=\"txtbox color2\" name=\"txtPassword\" id=\"txtPassword\" value=\"Password\" onfocus=\"this.value=''\" onblur=\"if(this.value=='')this.value='Password'\" /></dt>");
    document.write("					<dd><a href=\"javascript:void(0);\" onclick=\"ValidateCustomer();\"><img src=\"" + BPB_IMAGE_ROOT + "loginbut.gif\" alt=\"Login\" title=\"Login\" /></a></dd>");
    document.write("				</dl>");
    document.write("				<dl>");
    document.write("					<dt class=\"martop\"><a href=\"" + BPB_APPROOT + "Account/Customer-Registration.aspx\" title=\"New User Registration\" rel=\"gb_page_center[600, 520]\" ><img src=\"" + BPB_IMAGE_ROOT + "newuser.gif\" id=\"newuser\" alt=\"New user? Sign up!\" title=\"New user? Sign up!\" /></a></dt>");
    document.write("					<dd class=\"martop padlft\"><a href=\"" + BPB_APPROOT + "Account/Forgot-Password.aspx\" title=\"Forgot Your Password\" rel=\"gb_page_center[450, 200]\" ><img src=\"" + BPB_IMAGE_ROOT + "forgotpassword.gif\" id=\"forgotpwd\" alt=\"Forgot password\" title=\"Forgot password\" /></a></dd>");
    document.write("				</dl>");
    document.write("			</div>");
    document.write("			<div class=\"menucont fltlft\">");
    document.write("				<div class=\"tpmenu fltlft\">");    
    document.write("				</div>");
    document.write("				<div id=\"divMenuCartLinks\" class=\"tpmenu fltrgt color1\">");
    document.write("					<ul>");
    document.write("						<li class=\"youcart\" id=\"mnuCartInfo\"><b>Your Cart</b> :0 items $ 0.00</li>");
    document.write("						<li><a href=\"#\">Upload design</a></li>");
    document.write("						<li class=\"last\"><a href=\"#\">Pricing</a></li>");
    document.write("					</ul>");
    document.write("				</div>");
    document.write("			</div>");
}

var BLOCKUI_TICKS = 120000;//10000;
function BlockUserInterface(){
    
    $.blockUI({ 
        message: '<div class="pageloader"><img src="'+BPB_APPROOT+
            'images/loading8.gif" /> <p>Your request is being processed</p></div>'        
    });  
    if(BLOCKUI_TICKS > 0){        
        setTimeout($.unblockUI, BLOCKUI_TICKS);
    }
}

function UnBlockUserInterface(){
    $.unblockUI();
}

function ShowRegistration(){   
    GB_hide();
    tid = setTimeout("ShowNewUserRegistration();", 100);    
}

function ShowRegConfirmation(){
    GB_hide();
    tid = setTimeout("ShowRegistrationConfirmation();", 100);    
}

function ShowRegistrationConfirmation(){
    var wurl = window.location.href;
    
    var url = "../Account/Registration-Confirmation.aspx"
    if(wurl.toLowerCase().indexOf("login.aspx") > -1)
    {
        url = url + "?login=true"
    }
    GB_showCenter("New User Registration - Confirmation", url, 150,450);
}
var fullname = "";
function ShowCatalogReqConfirmation(name){
    fullname = name;
    GB_hide();
    tid = setTimeout("ShowCatalogReqUpdateConfirmation();", 100);    
}

function ShowCatalogReqUpdateConfirmation(){
    var wurl = window.location.href;
    
    var url = "../Account/Registration-Confirmation.aspx?catalog=true&name="+fullname;
   // alert(url)
       GB_showCenter("Request Catalog - Confirmation", url, 150,450);
}

function viewpdfproof(){
    var newDate = new Date();
    var timeStampLink = newDate.getMonth()+""+newDate.getDate()+""+newDate.getYear()
        +""+newDate.getHours()+""+newDate.getMinutes()+""+newDate.getSeconds()+""+newDate.getMilliseconds();
    var url = "../DesignCenter/PDFViewer.aspx?ts=" + timeStampLink;
    GB_showCenter("PDF Proof", url, 600,800);
}

function ShowNewUserRegistration(){
    var url = "../Account/Customer-Registration.aspx"
    GB_showCenter("New User Registration", url, 520,600);
}

function GBPricing(url, producttype){
    var ht = 245;
    if(producttype == 243 || producttype == 244 || producttype == 853)
    {
        //ht = 245;
        ht = 315;
    }
    else if(producttype == 846 || producttype == 844 || producttype == 631 || producttype == 839)    
    {
       //ht = 245;
       ht = 315; 
    }
    GB_showCenter("Pricing Calculator", url, ht,472);
}

function ShowForgotPassword(){   
    GB_hide();
    tid = setTimeout("ShowNewForgotPassword();", 100);    
}

function ShowNewForgotPassword(){
    var url = "../Account/Forgot-Password.aspx"
    GB_showCenter("Forgot Your Password", url, 200,450);
}
function LoadTemplateToDC(url,anchid){
    var uprof = "";   
    if($("#chkUserProfile").length > 0){
       if($('#chkUserProfile').attr('checked')){
            uprof = "&UserProfile=Yes"
       }else{
            uprof = "&UserProfile=no"
       }
    }
   var prulogo = "";
   if($("#ddbranch").length > 0){
            prulogo = $("#ddbranch").val();
    if(prulogo == -1)
    { 
    alert("Please select a state and a branch first.If you do not find your branch listed, call 1-866-763-8720 Ext 101 or email customercare@bestprintbuy.com" )
    return false;
    }
    }
    BlockUserInterface();
   if(prulogo>0)
   {
    prulogo ="&prulogo="+prulogo;
    document.getElementById(anchid).href = url + uprof+prulogo;
   }
   else
   {    
    document.getElementById(anchid).href = url + uprof;
   }
    return true;
}

function GetTemplates(productType, templateType, kioskKey, pagenumber, tempateCat, templateDesc){
    var newDate = new Date();
    var timeStampLink = newDate.getMonth()+""+newDate.getDate()+""+newDate.getYear()
        +""+newDate.getHours()+""+newDate.getMinutes()+""+newDate.getSeconds()+""+newDate.getMilliseconds();
     
    var themeKey = -1;    
    if($("#cboTheme").length > 0 && productType != 853){
    
    themeKey = $("#cboTheme").val();
    }
   
     document.getElementById("divTemplateList").innerHTML = "<div class=\"tnloader\"><img src=\""+ BPB_APPROOT + "images/loading8.gif\" alt=\"\" /></div>"; 
    
    $.get(BPB_APPROOT + "Templates/FrontTemplates.aspx", { product: productType, template: templateType, 
        kiosk: kioskKey, page: pagenumber, tempateCat: tempateCat, templateDesc: templateDesc, 
        themeKey: themeKey, ts: timeStampLink},
      function(data){  
        document.getElementById("divTemplateList").innerHTML = data; 
        UnTip();         
      }); 
}
function GetTemplatesCBKM(productType, templateType, kioskKey, pagenumber, tempateCat, templateDesc,themeKey){
    var newDate = new Date();
    var timeStampLink = newDate.getMonth()+""+newDate.getDate()+""+newDate.getYear()
        +""+newDate.getHours()+""+newDate.getMinutes()+""+newDate.getSeconds()+""+newDate.getMilliseconds();    
    var themeKey = themeKey;    
    document.getElementById("divTemplateList").innerHTML = "<div class=\"tnloader\"><img src=\""+ BPB_APPROOT + "images/loading8.gif\" alt=\"\" /></div>"; 
    
    $.get(BPB_APPROOT + "Templates/FrontTemplates.aspx", { product: productType, template: templateType, 
        kiosk: kioskKey, page: pagenumber, tempateCat: tempateCat, templateDesc: templateDesc, 
        themeKey: themeKey, ts: timeStampLink},
      function(data){  
        document.getElementById("divTemplateList").innerHTML = data; 
        UnTip();         
      }); 
}

function GetBranchOnload()
{
$("#ddstate").SelectedValue = 60;
GetBranch();
}

function GetBranch()
{
           var state = -1;    
           if($("#ddstate").length > 0){
            state = $("#ddstate").val();
            }
           $.get(BPB_APPROOT + "Templates/dropdown.aspx", { State: state},
           function(data){  
              
           var row = data.split("#$#");
           var cbobranch = document.getElementById("ddbranch");
		   var listLength = cbobranch.options.length;
		   var j;
            for(j=listLength-1;j>-1;j--)
            {
	            cbobranch.options[j] = null;
            }
            
           for(var i = 0; i<row.length-1;i++)
           { 
               var col;
               col = row[i];
               var text;
               text = col.split("*");
               var textfield;
               var valuefield;
               textfield = text[0];
               valuefield = text[1];           
           if(i==0)
           {
           cbobranch.options[0] = new Option("Select Branch","-1");
           }
           cbobranch.options[i+1] = new Option($.trim(valuefield),$.trim(textfield));
       }
       }); 
}

function GetRevTemplates(productType, templateType, kioskKey, cardFormat, pagenumber, colorkey){
    
    var newDate = new Date();
    var timeStampLink = newDate.getMonth()+""+newDate.getDate()+""+newDate.getYear()
        +""+newDate.getHours()+""+newDate.getMinutes()+""+newDate.getSeconds()+""+newDate.getMilliseconds();
        
    $.get("ReverseTemplates.aspx", { product: productType, template: templateType, 
        kiosk: kioskKey, cardFormat:cardFormat, page: pagenumber, color: colorkey, ts: timeStampLink},
      function(data){        
        document.getElementById("divTemplateList").innerHTML = data;
        UnTip();          
      });  
}

function GetShippingPrices(productType){
    var newDate = new Date();
    var timeStampLink = newDate.getMonth()+""+newDate.getDate()+""+newDate.getYear()
        +""+newDate.getHours()+""+newDate.getMinutes()+""+newDate.getSeconds()+""+newDate.getMilliseconds();
        
    $.get("Templates/ShippingPrice.aspx", { product: productType, ts: timeStampLink},
      function(data){        
        document.getElementById("divTemplateList").innerHTML = data;          
      });    
}

function ShowCustLogin(){    
    GB_showCenter("Login","../Account/CustomerLogin.aspx",172, 300)
}

function DisplayUserLogin(isSMBUser){    
    var userHtml = "";
    
    userHtml = "<dl>";
    userHtml = userHtml + "<dd><a href=\"javascript:;\" title=\"Login\" onclick=\"javascript:ShowCustLogin();\" ><img src=\"" + BPB_IMAGE_ROOT + "login2.gif\" id=\"login\" alt=\"Login\" title=\"Login\" /></a></dt>";
    userHtml = userHtml + "</dl>";
    userHtml = userHtml + "<dl>";
    userHtml = userHtml + "<dt class=\"martop\"><a href=\"" + BPB_APPROOT + "Account/Customer-Registration.aspx\" title=\"New User Registration\" rel=\"gb_page_center[600, 520]\" ><img src=\"" + BPB_IMAGE_ROOT + "create_acc2.gif\" id=\"newuser\" alt=\"New user? Sign up!\" title=\"New user? Sign up!\" /></a></dt>";
    userHtml = userHtml + "<dd class=\"martop padlft\"><a href=\"" + BPB_APPROOT + "Account/Forgot-Password.aspx\" title=\"Forgot Your Password\" rel=\"gb_page_center[450, 200]\" ><img src=\"" + BPB_IMAGE_ROOT + "forgot_pw_2.gif\" id=\"forgotpwd\" alt=\"Forgot password\" title=\"Forgot password\" /></a></dd>";
    userHtml = userHtml + "</dl>";

   
    document.getElementById("divUserLogin").innerHTML = userHtml;
    document.getElementById("mnuMyAccount").style.display = "none";
    
    HideMenusforSMB(isSMBUser);
    
    $('#txtPassword').keyup(function(e) {	//alert(e.keyCode);	
        if(e.keyCode == 13) {		
            ValidateCustomer();	
        }}
     );  
}

function HideMenusforSMB(isSMBUser){
    
    if(eval(document.getElementById("mnuSelectCompany"))){
        document.getElementById("footerProducts").style.display = "block";
        return;
    }
    if(isSMBUser == true){
        $('#mnuServices').addClass('hidemenu');
        $('#mnuPordPostCards').addClass('hidemenu');
        $('#mnuPordFoldedCards').addClass('hidemenu');
        $('#mnuNewAgentKits').addClass('hidemenu');     
        
        document.getElementById("mnuServices").style.display = "none";
        document.getElementById("mnuPordPostCards").style.display = "none";
        document.getElementById("mnuPordFoldedCards").style.display = "none";
        document.getElementById("mnuNewAgentKits").style.display = "none";
        document.getElementById("footerProducts").style.display = "none";
        document.getElementById("footerSMBProducts").style.display = "block";
    }  
    else{

        document.getElementById("mnuServices").style.display = "block";
        document.getElementById("mnuPordPostCards").style.display = "block";
        document.getElementById("mnuPordFoldedCards").style.display = "block";
        document.getElementById("mnuNewAgentKits").style.display = "block";
        document.getElementById("footerProducts").style.display = "block";
        document.getElementById("footerSMBProducts").style.display = "none";
    }
}

function AlertAndNavigate(url, storefront, hasCart){
    if(hasCart == false){
        if(confirm('Do you want to proceed to the '+ storefront + ' of bestprintbuy?'))
        {
            window.location.href = url;
        }
    }else{
        if(confirm('Dear user you have orders on your shopping cart would you like to view them?')){
            window.location.href = "../Cart/Shopping-Cart.aspx";
        }else{
             window.location.href = url;
        }
    }
}

function OpenSizeWindow(winurl,producttype){
    var wintitle = "Select Postcard Size";
    var winHt = 300;
    var winWt = 500;
    if(producttype == 853){
        wintitle = "Select Folded Card Size";
    }
    else if(producttype == 851){
        wintitle = "Select Notepad Size";
        winHt = 600;
        winWt = 520;
    }
    GB_showCenter(wintitle,winurl,winHt,winWt);
}

function NavigateToDC(dcparams){
    //alert(dcparams)
    var keys = dcparams.split("##");
    
    var dcurl = "../DesignCenter/NavigateToDC.aspx?templateKey=" + keys[0] + "&txtTemplateCategory=" + keys[1] + 
        "&txtTemplateText=" + keys[2] + "&txtTemplateType=" + keys[3] + "&txtproductType=" + keys[4] 
        + "&txtTemplateCategoryType=" + keys[5] + "&templatesize=" + keys[6];
    
    BlockUserInterface();
    var uprof = "";   
    if($("#chkUserProfile").length > 0){
       if($('#chkUserProfile').attr('checked')){
            uprof = "&UserProfile=Yes"
       }else{
            uprof = "&UserProfile=no"
       }
    }
    
    window.location.href = dcurl + uprof;
}

function NavigateToLoginDC(dcparams){
    //alert(dcparams)
    var keys = dcparams.split("##");
    
    var dcurl = "../Account/Navigator.aspx?naviFrom=templatetodclogin&navurl=../DesignCenter/NavigateToDC.aspx?templateKey=" + keys[0] + "%26txtTemplateCategory=" + keys[1] + 
        "%26txtTemplateText=" + keys[2] + "%26txtTemplateType=" + keys[3] + "%26txtproductType=" + keys[4] 
        + "%26txtTemplateCategoryType=" + keys[5] + "%26templatesize=" + keys[6];
    
    //alert(dcurl);
    BlockUserInterface();    
    
    window.location.href = dcurl;
}



function NavigateUploadDesign(udurl){    
    window.location.href = udurl;
}

function NavigateToPage(url){
     window.location.href = url;
}

function ShowKWPCProductCategories(gbwintitle,url){
    GB_showCenter(gbwintitle,url,500,567)
    }
function ShowProductCategories(gbwintitle,url){
    GB_showCenter(gbwintitle,url,500,950)
}
function ShowPCProductCategories(gbwintitle,url){

    GB_showCenter(gbwintitle,url,430,567)
}
function ShowKWBCProductCategories(gbwintitle,url){

    GB_showCenter(gbwintitle,url,200,327)
}
function ShowKWCALProductCategories(gbwintitle,url){
    GB_showCenter(gbwintitle,url,140,320)
}
function ShowKWBC4ProductCategories(gbwintitle,url){

    GB_showCenter(gbwintitle,url,200,330)
}

function RenderPageMessage(){
    if(eval(document.getElementById("PageMessage"))){
        if($.trim(document.getElementById("PageMessage").value) != ""){
            alert($.trim(document.getElementById("PageMessage").value));
        }
    }
}

function ShowProdFinishingOptions(productDetails, anchid){
    var strHtml = "";
    strHrml = "<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"100%\">";
    strHrml = strHrml + "<tr>";
    strHrml = strHrml + "<td width=\"96%\" align=\"right\">";
    strHrml = strHrml + "<a href=\"javascript:void(0);\" onclick=\"closeDiv('ddProdFinishOptions');\" class=\"txt color4\">Close</a></td>";
    strHrml = strHrml + "<td width=\"4%\" align=\"left\">";
    strHrml = strHrml + "<a href=\"javascript:void(0);\" onclick=\"closeDiv('ddProdFinishOptions');\">";
    strHrml = strHrml + "<img src=\"" + BPB_IMAGE_ROOT + "/images/close_sm.gif\" border=\"0\" alt=\"\" /></a></td>";
    strHrml = strHrml + "</tr></table><br />";
    strHrml = strHrml + productDetails;
    document.getElementById("ddProdFinishOptions").innerHTML = strHrml
    showhideDiv1('ddProdFinishOptions',anchid,-50,20);
}

function HidePriceCalcLoader(){
    $("#divPCLoader").css("display","none");
    $("#ifrmPricingCalc").css("height","280px"); //"270px" 220px
}

function OpenCustomDataWindow(winurl,productType){
    var wintitle = "Custom Business Card Information";
    if(productType == "244")
    {
        wintitle = "Custom PostCard Information";
    }
    var winHt = 400;
    var winWt = 525;    
    GB_showCenter(wintitle,winurl,winHt,winWt);
}


function RevNavigateToDC(url){
    BlockUserInterface();
    var uprof = "";   
    if($("#chkUserProfile").length > 0){
       if($('#chkUserProfile').attr('checked')){
            uprof = "&UserProfile=Yes"
       }else{
            uprof = "&UserProfile=no"
       }
    }
    
    window.location.href = url + uprof;
}

function ShowCatalogRequest(){    
    tid = setTimeout("ShowNewCatalogRequest();", 500);    
}
function ShowNewCatalogRequest(){
    var url = "../Account/CatalogRequest.aspx"
    GB_showCenter("Request a Catalog", url, 525,600);
}

function ShowOnSubmit(){ 
    GB_hide();
    tid = setTimeout("ShowMessageOnSubmit();", 100);    
}

function ShowMessageOnSubmit(){
    var url = "../Account/CustomerComments.aspx?id=reopen";    
    GB_showCenter("Submit Changes", url, 100,450);    
}
