function Validationkeyword(theform)
{
  if (theform.Keyword.value == "")
  {
    alert("Please enter your search keyword.");
    theform.Keyword.focus();
    return (false);
  }
    return (true);
 } 
 
function ValidateSelection()
 {                      
   var f = window.document.frmDetail;
   
   for(var i=0; i < f.elements.length; i++) {
      var e = f.elements[i];
      
      if (e.type == "select-one") {
         if (e.name == "sizes" && (e.options[e.options.selectedIndex].text =="" || e.options[e.options.selectedIndex].text =="Select Size")) { 
            alert("Please choose size.");
            e.focus();
            return (false);
           }
         
         if (e.name == "color" && e.options[e.options.selectedIndex].value =="") { 
            alert("Please choose color.");
            e.focus();
            return (false);
           }
         
         if (e.options[e.options.selectedIndex].value =="" && e.name != "sizes" && e.name != "color") { 
            alert("Please choose options.");
            e.focus();
            return (false);
           }
        }
     }
 
  return (true);
 }

function displayWindow(url, width, height) {
      var url1 = 'bigimage.asp?pic=' + url + '&height=' + height + '&width=' + width;
	  var Win = window.open(url1,"1",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=yes,menubar=no,status=no,screenX=0,screenY=0,top=0,left=0' );
 }
var strOrigImage = "";
function switchImage(sColor,fillsize) {
	var colorpath = 'http://www.holdnstorage.com/image3.asp?image=images/' ;
	var colorPic = ColorMatrix[sColor];
	
    if (sColor != "") {
	   if (document.images.ItemPic) {
		   document.images.ItemPic.src = colorpath + colorPic + '&w=306';
		   document.getElementById("mItemPic").setAttribute("data-zoomsrc", 'images/' + colorPic);
		   MojoZoom.init();
	      }
	   } 
	if (sColor == "" && strOrigImage != "")
	{
		document.images.ItemPic.src = colorpath + strOrigImage + '&w=306';
		document.getElementById("mItemPic").setAttribute("data-zoomsrc", 'images/' + strOrigImage);
		MojoZoom.init();
	}
	if (fillsize == "1") {FillSizeList();}
  }

function FillSizeList() {
var mfr = document.frmDetail.color;
var model = document.frmDetail.sizes;
var ml = ColorList[mfr.options[mfr.selectedIndex].value];
for (var i=model.length; i >= 0; i--){
	model.options[i] = null;
  }
for (var i=0; i < ml.length; i++){
	model.options[i] = new Option(ml[i]);
  }
}

function OpenPopUp(url, width, height) {
	     var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no,status=no' );
	}
	
function mailpage()
{
mail_str = "mailto:?subject=Check out the " + document.title;
mail_str += "&body=I thought you might be interested in the " + document.title;
mail_str += ". You can view it at, " + location.href; 
location.href = mail_str;
}	

function emailcheck(str) {
  var at="@";
  var dot=".";
  var lat=str.indexOf(at);
  var lstr=str.length;
  var ldot=str.indexOf(dot);
  
  if (str.indexOf(at)==-1){
      alert("Invalid E-mail Address");
	  return false;
   }

  if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
     alert("Invalid E-mail Address");
	 return false;
   }

   if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
	   alert("Invalid E-mail Address");
	   return false;
    }

    if (str.indexOf(at,(lat+1))!=-1){
	   alert("Invalid E-mail Address");
	   return false;
     }

    if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	   alert("Invalid E-mail Address");
	   return false;
     }

    if (str.indexOf(dot,(lat+2))==-1){
	   alert("Invalid E-mail Address");
	   return false;
     }
		
    if (str.indexOf(" ")!=-1){
	   alert("Invalid E-mail Address");
	   return false;
     }

    return true;					
  }
  
  function ValidateGiftCertForm(){
	var f = document.frmGiftCert;
    var p = f.Price;
    var price="";
    var s = f.ShipBy;
    var shipby="";
    var i;
  
    for (i=0;i<p.length;i++){
	    if (p[i].checked){
		   price = p[i].value;
	      }
      }
  
    if (price == "" && f.PriceOther.value == ""){
      alert("Please Select or Input Gift Value.");
      f.PriceOther.focus();
      return (false);
      }
	else if (price == "" && isNaN(f.PriceOther.value)){
	  alert("Please Enter Correct Gift Value.");
	  f.PriceOther.focus();
      return (false);
	  }
	
	for (i=0;i<s.length;i++){
	    if (s[i].checked){
		   shipby = s[i].value;
	      }
      }
    
    if (shipby == ""){
       alert("Please Select Shipping Method for Gift Certificate.");
       return (false);
      }
    
    if (f.SenderName.value == ""){
       alert("Please Input Sender's Name.");
       f.SenderName.focus();
       return (false);
      }  
	
	if (f.SenderEmail.value == ""){
       alert("Please Input Sender's E-mail.");
       f.SenderEmail.focus();
       return (false);
      }  
    else if (emailcheck(f.SenderEmail.value)==false){
	   f.SenderEmail.value="";
	   f.SenderEmail.focus();
	   return false;
	  }
    
    if (f.RecipientName.value == ""){
       alert("Please Input Recipient's Name.");
       f.RecipientName.focus();
       return (false);
      } 
     
    if (shipby == "E-mail"){
       if (f.RecipientEmail.value == ""){
           alert("Please Input Recipient's E-mail.");
           f.RecipientEmail.focus();
           return (false);
          }  
        else if (emailcheck(f.RecipientEmail.value)==false){
	         f.RecipientEmail.value="";
	         f.RecipientEmail.focus();
	         return false;
	      }
       } 
     else if (shipby == "Mail"){
       if (f.RecipientAddress.value == ""){
           alert("Please Input Recipient's Address.");
           f.RecipientAddress.focus();
           return (false);
          }   
        
        if (f.RecipientCity.value == ""){
           alert("Please Input Recipient's City.");
           f.RecipientCity.focus();
           return (false);
          }  
        
        if (f.RecipientState.value == ""){
           alert("Please Input Recipient's State.");
           f.RecipientState.focus();
           return (false);
          } 
        
        if (f.RecipientZip.value == ""){
           alert("Please Input Recipient's Zip.");
           f.RecipientZip.focus();
           return (false);
          }         
       }
             
	return true;
 }	
 

function clearall(){
 elem = document.getElementById("menudescription");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("menufeatures");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
   
 elem = document.getElementById("menuproductreview");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("menushippinginfo");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
   
 elem = document.getElementById("menuspecsheet");
 if(isNaN(elem)) { 
    elem.style.display="none";
   }   
 
 elem = document.getElementById("menumultimedia");
 if(isNaN(elem)) { 
    elem.style.display="none";
   }  
 
 elem = document.getElementById("lyrdescription");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("lyrfeatures");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("lyrproductreview");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("lyrshippinginfo");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("lyrspecsheet");
 if(isNaN(elem)) { 
    elem.style.display="none";
   } 
 
 elem = document.getElementById("lyrmultimedia");
 if(isNaN(elem)) { 
    elem.style.display="none";
   }            
 }

function setdescription()
{
 clearall();
 elem = document.getElementById("menudescription");
 elem.style.display="block";
 
 elem = document.getElementById("lyrdescription");
 elem.style.display="block";
}

function setfeatures()
{
 clearall();
 elem = document.getElementById("menufeatures");
 elem.style.display="block";
 
 elem = document.getElementById("lyrfeatures");
 elem.style.display="block";
}

function setproductreview()
{
 clearall();
 elem = document.getElementById("menuproductreview");
 elem.style.display="block";
 
 elem = document.getElementById("lyrproductreview");
 elem.style.display="block";
}

function setshippinginfo()
{
 clearall();
 elem = document.getElementById("menushippinginfo");
 elem.style.display="block";
 
 elem = document.getElementById("lyrshippinginfo");
 elem.style.display="block";
}

function setspecsheet()
{
 clearall();
 elem = document.getElementById("menuspecsheet");
 elem.style.display="block";
 
 elem = document.getElementById("lyrspecsheet");
 elem.style.display="block";
}

function setmultimedia()
{
 clearall();
 elem = document.getElementById("menumultimedia");
 elem.style.display="block";
 
 elem = document.getElementById("lyrmultimedia");
 elem.style.display="block";
}

function Expert_Validator() { 
  var f = window.document.frmExpert;
  
  if (f.Name.value == "") {
      alert("Please Enter Your Name.");
      f.Name.focus();
      return (false);
    }
  
  if (f.Email.value == "") {
      alert("Please Enter Your Email.");
      f.Email.focus();
      return (false);
    }
    
  return (true);
 }
 
 function Customer_Validator() { 
  var f = window.document.frmCustomer;
  
  if (f.FirstName.value == "") {
      alert("Please Enter Your First Name.");
      f.FirstName.focus();
      return (false);
    }
  
  if (f.LastName.value == "") {
      alert("Please Enter Your Last Name.");
      f.LastName.focus();
      return (false);
    }
    
  if (f.Email.value == "") {
      alert("Please Enter Your Email.");
      f.Email.focus();
      return (false);
    }
  
  if (f.Phone.value == "") {
      alert("Please Enter Your Phone.");
      f.Phone.focus();
      return (false);
    }
      
  return (true);
 }  