//function used to load the home page, in category set page
function loadHomePage(requestType)
{       document.lcamainform.categorysetid.value = '';
        document.lcamainform.categoryid.value = '';
        document.lcamainform.requesttype.value = requestType;
        document.lcamainform.submit();
}
//function used in product body page
function loadNextPage(pageNo)
{       document.lcamainform.pagenumber.value = pageNo;
        document.lcamainform.submit();
}
function LoadShipOptionsPage()
{
	//load ship options page in a new window
	return  "";
}
function loadProductDesc(product_id,requestType)
{
	 //document.lcamainform.prid.value = product_id.substring(4);
	 document.lcamainform.prid.value = product_id;
     document.lcamainform.requesttype.value = requestType ;
     document.lcamainform.submit();
}
//used in product description page
function loadCart(product_id,requestType)
{    document.lcamainform.prid.value = product_id;
     document.lcamainform.requesttype.value = requestType ;
     document.lcamainform.submit();
}
function addCart(product_id,requestType)
{    //document.lcamainform.prid.value = product_id.substring(4);
      document.lcamainform.cartaction.value ='additem';
     document.lcamainform.prid.value = product_id;
     document.lcamainform.requesttype.value = requestType ;
     document.lcamainform.submit();
}

function isEmptyString(s)
{   return ((s == null) || (s.length == 0))}

//used in left menu page, category set pages
function LoadContentPage(catSetID,catID,requestType)
{
  if(requestType =='searchproducts')
  {
   if(isEmptyString(document.lcamainform.searchstring.value)){
     alert('Please enter search phrase.');
     document.lcamainform.searchstring.focus();
     return;
     }
   if(document.lcamainform.searchstring.value.length < 3){
     alert('Please enter minimum 3 characters in search phrase.');
     document.lcamainform.searchstring.focus();
     return;
     }
  }
  if(catSetID == '' || catID ==''){
        //for pages that do not require product body(faq,about us etc.)
        //and category where we do not want to overwrite hidden catSetID
        document.lcamainform.categoryid.value = catID;
        document.lcamainform.requesttype.value = requestType ;
        document.lcamainform.submit();
        }
  else{
        document.lcamainform.categorysetid.value = catSetID;
        document.lcamainform.categoryid.value = catID;
        document.lcamainform.requesttype.value = requestType ;
        document.lcamainform.submit();
   }
}
function loadContentFromMenu(catsetObj,catObj,requestType)
{
        var catsetInteger, catInteger;
        catsetInteger = catsetObj.selectedIndex;
        catInteger = catObj.selectedIndex;
        document.lcamainform.categorysetid.value = catsetObj.options[catsetInteger].value;
        document.lcamainform.categoryid.value = catObj.options[catInteger].value;
        document.lcamainform.requesttype.value = requestType ;
        document.lcamainform.submit();
}
function continueShopping(requestType)
{
        document.lcamainform.requesttype.value = requestType;
        document.lcamainform.submit();
}

//function used in shoppingbartop
function custLogin(requestType)
{
     document.lcamainform.requesttypeprev.value = document.lcamainform.requesttype.value ;
     document.lcamainform.requesttype.value = requestType ;
     document.lcamainform.submit();
}

//on order summary page
function orderdetail(trxID,requestType)
{
	document.lcamainform.ordernumber.value = trxID;
	document.lcamainform.requesttype.value = requestType;
	document.lcamainform.submit();
}
function orderSum(requestType){
        document.lcamainform.requesttype.value = requestType;
        document.lcamainform.submit();}
//on order details page
function proceedPayment(ordernumber,customerid)
{ document.paypal.notify_url.value ="http://www.handicraftshome.org/index.jsp?actionname=processpayment" ;
  document.paypal.return_url.value = eval("'http://www.hanicraftshome.org/index.jsp?actionname=paymentmade&order_number="+ordernumber+"&custid="+customerid+"'");
  document.paypal.business.value ="handicraftshomeac@sbcglobal.net";
 document.paypal.submit();
}
//fun 2 submit form by enter key
function checkEnter(e,requestType){ //e is event object passed from function invocation
if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}
if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
	if(requestType=='searchproducts'){LoadContentPage('','',requestType);}
	return false ;
}
else{	return true ;}
}
function refreshpage(delay){ document.lcamainform.requesttypeprev.value = "Paymentmade";
setTimeout('loadHomePage("producthome")',delay); }
function recommendFriend(action)
{
	document.lcamainform.recommendaction.value = action;
	if(action == 'process')
	{
	   //check email addresses,text length,
	   if(!isEmail(document.lcamainform.friendEmail.value))
	   {alert("Please enter a valid To email address.");
              return;
          }
	   if(!isEmail(document.lcamainform.yourEmail.value))
	   {alert("Please enter a valid From email address.");
              return;
          }
          if(document.lcamainform.yourmessage.value.length > 1000)
          {
            alert("Please limit your personal message to 1000 characters.");
              return;
          }
	}
	document.lcamainform.submit();
}
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")

