// creates extra title code
//  a place to have common code that gets inserted below the title on every page
function ExtraTitle()
{
}
// validates e-mail and verifycode 
function Form1_Validator(theForm)
{
  var code = theForm.Verify_Code.value;
  var vcode = "25624";
 
  if (vcode  != code)
  {
    alert("Please enter verification code as shown.");
    theForm.Verify_Code.focus();
    return (false);
  }

  if (theForm.email.value.length > 50  ||  theForm.email.value.length < 7)
  {
    alert("Please enter a valid e-mail address.");
    theForm.email.focus();
    return (false);
  }
  return (true);
}

// this will build the guest book form
function GuestBook(id)
{
  var file_name = document.location.href;
  document.write('<table border="9" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="75%" bordercolor="#FF0000" height="340">');
    document.write('<tr>');
      document.write('<td width="100%" bgcolor="#FFFFCC" >');
      document.write('<center>');
        document.write('<p align="center">');
        document.write('<a name="mailform"><b><font color="#000080" size="4" face="arial">');
        document.write('<form action="/cgi-bin/cgiemail/contact/gb.txt" method="POST" name="Form1" onsubmit="return Form1_Validator(this)" language="JavaScript">');
        document.write('<input type="hidden" name="html_name" value="'+file_name+'">');
          document.write('<input type="hidden" name="success"  value="http://www.jmcutlery.com/confirm.html">');
          document.write('<font size="5" >');
          document.write('<br>Contact us with any questions or concerns.<br><br>');
          document.write('</font>');
          document.write('<font color="#990000" size="4">');
          document.write('* Your email address<br>');
          document.write('<input type="text" size="50" name="email">');
          document.write('<br><br>Your Message<br>');
          document.write('<textarea name="comment" rows="4" cols="45"></textarea>');
          document.write('<br><br><input type="checkbox" checked name="news" value="Yes" >Check here to be the first to know about our news and sales.<br>');
          document.write('We never share your information or send you excessive email.<br>');
          document.write('<br>Enter Verification Code Shown In Image<br>');
          document.write('</font>');
          document.write('<img src="vcode.jpg" width="155" height="57">');
          document.write('<input type="text" size="10" name="Verify_Code"><br><br>');
          document.write('<input type="submit" value="send" name="'+id+'">');
          document.write('<input type="reset"  value="clear">');
        document.write('</form><br><br>');
        document.write('</font>');
        document.write('</b>');
        document.write('</p>');
      document.write('</center>');                          
      document.write('</td>');
    document.write('</tr>');
    document.write('</table>');

    setTimeout("window.scrollBy(0, -300);", 600);
       
}
// about your order table
function AboutOrder()
{
document.write('<table border="6" cellspacing="7" width="75%" bgcolor="#FFFF00" bordercolor="#FF0000" cellpadding="3" style="border-collapse: collapse" height="143">');
  document.write('<tr>');
    document.write('<td width="50%" bgcolor="#FFFFFF" height="17" style="color: #000000">');
      document.write('<p align="left" style="margin-left: 40; margin-right: 40"><b><strong><font size="4" color="#000000" face="arial">');
        document.write('<font size="5">If you need help<br> </font>');
        document.write('<a href="mailto:custsvc@jmcutlery.com"><font color="#000000">e-mail us</font></a>');
        document.write(' before you order.<br>We try to answer within 1 business day. We need to know your address,');
        document.write('what product, how many. Be ready to order when we answer as our inventory changes.<br><br><br>');
      document.write('</font></strong></b></p>');
    document.write('</td>');
    document.write('<td width="50%" bgcolor="#FFFFFF" height="17" style="color: #000000"><b>');
      document.write('<p align="left" style="margin-left: 40; margin-right: 40"><b><font size="3" color="#000000" face="arial"><br>');
       document.write('<font size="6">About Your Order: </font><br><br>');
        document.write('You will receive an important J. Mark email soon after Pay Pal\'s notification. If you ');
        document.write('don\'t get it, click here to <a href="mailto:custsvc@jmcutlery.com"><font color="#000000">');
        document.write('email us </font></a>about it promptly.<br><br>');
        document.write('For problems click <a href="http://www.jmcutlery.com/policy.htm"><font color="#000000">www.OurHelp4U.com</font></a>');
        document.write(' It explains <span style="background-color: #FFFF00">sales tax </span>which is <span style="background-color: #FFFF00">not ');
        document.write('tax</span>, it is our means of adding a postage surcharge for excess weight and distance. It has ');
        document.write('our policy, and other information.<br><br>');
        document.write('<img border="0" src="http://www.jmcutlery.com/images/creditCards_169x21.gif" width="176" height="22"><br><br>');
        document.write('<span style="background-color: #FFFF00">You do not need a Pay Pal Account <br></span>');
        document.write('to buy securely online using our Add to Cart button. <br>');
        document.write('(If you encounter a Pay Pal problem, <strong>you can call them toll free at 1-888-221-1161. <br><br>');
        document.write('Do not ask them about orders or merchandise. <br>They are a bank and transfer funds online, only.</strong><br>');
        document.write('click here to <a href="mailto:custsvc@jmcutlery.com"><font color="#000000">email us</font> </a> any questions.<br><br>');
      document.write('</font></b></p>');
    document.write('</td>');
  document.write('</tr>');
  document.write('<tr>');
    document.write('<td width="50%" bgcolor="#FFFFFF" height="16" style="color: #000000">');
      document.write('<p align="left" style="margin-left: 40; margin-right: 40"><b><strong><font size="4" color="#FF0000" face="arial">');
        document.write('We do not ship Outside of the first 48 states continental USA Not to Canada, HI. AK, APO, AE, etc. <br>');
      document.write('</font></strong></b></p>');
    document.write('</td>');
    document.write('<td width="50%" bgcolor="#FFFFFF" height="16" style="color: #000000">');
      document.write('<p align="left" style="margin-left: 40; margin-right: 40"><b><br><font size="3" color="#000000" face="arial">');
        document.write('We do not offer catalogs. Click here for a list of ');
        document.write('<a href="http://www.jmcutlery.com/printourpages.htm"><font color="#000000">links to printable pages. </font></a>');
        document.write('<br><br>Please do not order unless you are certain you <br>');
        document.write('want the item and it is correct for your needs. <br>');
        document.write('Due to the fragility and the costly round-trip <br>');
        document.write('postage we do not accept returns.<br><br>');
      document.write('</font></b></p>');
    document.write('</td>');
  document.write('</tr>');
document.write('</table>');
}

function nostockpop()
{
    var pop = window.open('', '', 'height=250,width=350,left=100,top=100');
    pop.document.write('<html><body bgcolor="#F0C0E0"><center>');
    pop.document.write('<p><img src="frown.gif"><br><br><font size="4">Sorry This Item Is Out Of Stock</font></p>');
    pop.document.write('<p><font size="2">Use form at bottom of page to be notified when it comes back in.<br><br></font></p>');
    pop.document.write('<p><a href="javascript:self.close()">Close</a></p>');
    pop.document.write('</center></body></html>');
    pop.document.close();
}

// creates add to cart button
// example call   AddToCart( 'ceramic thingy', 'CE-6309', '24.99' );
function AddToCart(desc, item, price, nostock, quant)
{
  document.write('<a name="L' + item + '"></a>');
  if(nostock)
   // document.write('<a href="javascript:nostockpop();">');
    document.write('<br><font color="#FF0000"> OUT OF STOCK </font>');
  else
  {
    document.write('<br>  $' + price + '  ');
    document.write('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=jmpbooks%40jmcutlery.com&lc=US');
    document.write('&item_name='+desc+'&item_number='+item+'&amount='+price);
    if (quant)
        document.write('&quantity=' + quant);
    document.write('&currency_code=USD&button_subtype=products&cn=Add%20special%20instructions%20to%20the%20seller');
    document.write('&no_shipping=2&rm=1&return=http%3a%2f%2fwww%2ejmcutlery%2ecom%2fthankyou%2ehtm');
    document.write('&cancel_return=http%3a%2f%2fwww%2ejmcutlery%2ecom%2fcancel%2ehtm&weight_unit=lbs&add=1');
    document.write('&bn=PP%2dShopCartBF%3abtn_cart_LG%2egif%3aNonHosted">' );
    document.write('<img src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0"></a>');
  }
// for extraction only    
//	document.write('<br><font size="1" color="#CCCCCC">name:' + desc + '<br>item:' + item + '</font>');

}
// search box
function do_search2() {
   location.href = 'http://www.jmcutlery.com/store/prod_'+ document.keyw_frm.word.value.replace(/ /g,"_") + '.htm';
}
var FirstSearchBox = 1;
function SearchBox()
{
if (FirstSearchBox)
{
FirstSearchBox = 0;
document.write('<form name="keyw_frm" onSubmit="do_search2();return false">'
 + '<input type="text" name="word" size="17" value=""><br>'
 + '<input type="button" value="Search" onClick="do_search2()"></form>');
}
}
function ViewCart(HideSrch)
{
  if (!HideSrch)
     SearchBox();
  document.write('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&display=1&business=jmpbooks%40jmcutlery.com"><img src="https://www.paypal.com/en_US/i/btn/view_cart.gif" border="0"></a>');
  document.write('<br><a href="http://www.jmcutlery.com/index.html">Home</a><br>');
  document.write('<div><div id="comm100_LiveChatDiv"></div><a href="http://www.comm100.com/livechat/" onclick="comm100_Chat();return false;" target="_blank" title = "Live Chat Live Help Software for Website">');
  document.write('<img id="comm100_ButtonImage" src="http://chatserver.comm100.com/BBS.aspx?siteId=39069&planId=82" border="0px" alt="Live Chat Live Help Software for Website" width="130" height="68" /></a></div>');
  document.write('<scr'+'ipt type="text/javascript" src="http://chatserver.comm100.com/js/LiveChat.js?siteId=39069&planId=82" ></scr'+'ipt>'); 
}

function PPSeal()
{
document.write('<b><a href="https://www.paypal.com/us/verified/pal=jmpbooks@bellsouth.net" target="_blank">');
document.write('<img src="http://www.paypal.com/en_US/i/icon/verification_seal.gif" border="0" alt="Official PayPal Seal" width="49" height="45" align="left"></a>');
document.write('<img border="0" src="http://www.jmcutlery.com/images/creditCards_169x21.gif" width="176" height="22" align="left">');
document.write('<font size="3" face="Arial" color="#000000">');
document.write('<br><br><br>Please use a <br>STREET ADDRESS<br>UPS does not deliver to a PO Box<br>');
document.write('<font color="#FFFFFF"><span style="background-color: #0000FF">WE SHIP TO USA ONLY</span></font><br></font></b>');
}

function cartpop2(type, Item) {
  var pop;
    if (type == "TCP")
        pop = window.open('', '', 'height=800,width=600,resizable=1');
    else if (type == "AE")
        pop = window.open('', '', 'height=500,width=450,resizable=1');
    else
        pop = window.open('', '', 'height=720,width=750,resizable=1');
    //alert("Item=["+Item+"]");
    pop.document.write('<html><head><title>' + type + '-' + Item + '</title>');
    pop.document.write('</head><body><center>');
    if (type == "")
        pop.document.write('<br><img src="images/' + Item + '.jpg" >');
    else if (type == "AE")
        pop.document.write('<br><img src="store/catalog/images/ae/' + Item + '.lg.jpg">');
    else
        pop.document.write('<br><img src="images/' + type.toLowerCase() + '/' + Item + '.jpg" >');
    pop.document.write('<p><a href="javascript:self.close()">Close</a></p>');
    pop.document.write('</center></body></html>');
    pop.document.close();
}


// example call   Add2Cart('CE', '6309', 'ceramic thingy', '24.99' );
function Add2Cart(type, item, desc, price, nostock, quant) {
    document.write('<a name="' + type + '-' + item + '"></a>');
    document.write('<a href="javascript:cartpop2(\'' + type + '\', \'' + item + '\');">');
    if (type == "TCP")
        document.write('<img border="0" src="images/tcp/' + item + '_small.jpg" width="203" height="160" >');
    else if (type == "TCU")
        document.write('<img border="0" src="images/tcu/' + item + '_small.jpg" width="150" height="125" >');
    else if (type == "TLS")
        document.write('<img border="0" src="images/tls/' + item + '_small.jpg" width="160" height="160" >');
    else if (type == "CHB")
        document.write('<img border="0" src="images/chb/' + item + '_small.jpg" width="84" height="160" >');
    else if (type == "AE")
        document.write('<img src="store/catalog/images/ae/' + item + '_small.jpg" width="133" height="133" >');
    else
        document.write('<img src="images/' + item + '.jpg" width="250" height="250" >');
    document.write('</a><br>' + desc);
    if (nostock)
        document.write('<br><font color="#FF0000"> OUT OF STOCK </font>');
    else {
       // document.write('<br>' + type + '-' + item + '  $' + price + '  ');
        document.write('<br> $' + price + '  ');
        document.write('<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=jmpbooks%40jmcutlery.com&lc=US');
        document.write('&item_name=' + desc + '&item_number=' + type + '-' + item + '&amount=' + price);
        if (quant)
            document.write('&quantity=' + quant);
        document.write('&currency_code=USD&button_subtype=products&cn=Add%20special%20instructions%20to%20the%20seller');
        document.write('&no_shipping=2&rm=1&return=http%3a%2f%2fwww%2ejmcutlery%2ecom%2fthankyou%2ehtm');
        document.write('&cancel_return=http%3a%2f%2fwww%2ejmcutlery%2ecom%2fcancel%2ehtm&weight_unit=lbs&add=1');
        document.write('&bn=PP%2dShopCartBF%3abtn_cart_LG%2egif%3aNonHosted">');
        document.write('<img src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif" border="0"></a>');
    }
}
// for google analytics keep as last
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-681964-1']);
_gaq.push(['_trackPageview']);

(function () {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();



