function WishList_Add2Cart()
{
	if (isValid())
	{
		document.add_to_cart.target.value = 'wishlist';
		document.add_to_cart.action.value = 'add';
		document.add_to_cart.submit();
	}
}
function isValid()
{

    if(document.add_to_cart.amount.value==""){
alert("You must enter quantity!");
return false;
}

if (!valid(document.add_to_cart.amount.value,"0123456789"))
  	{
  	validity = false; alert('Please enter valid quantity!');
  	document.add_to_cart.amount.value="";
	document.add_to_cart.amount.focus();
   return false;
  	}
  if (document.add_to_cart.amount.value=="0")
  	{
  	validity = false; alert('Please enter valid quantity!');
  	document.add_to_cart.amount.value="";
	document.add_to_cart.amount.focus();
   return false;
  	}
  	document.add_to_cart.amount.value=parseInt(document.add_to_cart.amount.value);

}

	function valid(str,validchars) {
  var parsed = true;

  for (var i=0; i < str.length; i++) {
    var letter = str.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) != -1)
    continue;
	var parsed = false;
    break;
  }
	if (parsed)
	{return true;}
	else
	{return false;}

	}
	
		  function check()
{
if(document.send_form.sender_name.value==""){
alert("You must enter your name!");
return false;
}
if(document.send_form.sender_email.value==""){
alert("You must enter your email-id!");
return false;
}

  if (!echeck(document.send_form.sender_email.value))
  	{
  	validity = false; alert('Please enter valid email id!');
	document.send_form.sender_email.focus();
   return false;
  	}

if(document.send_form.recipient_email.value==""){
alert("You must enter your friend's email-id!");
return false;
}
 if (!echeck(document.send_form.recipient_email.value))
  	{
  	validity = false; alert('Please enter valid email id!');
	document.send_form.recipient_email.focus();
   return false;
  	}
}

function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		//trace(lat)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.indexOf(" ")!=-1){
		    return false
		 }
		if(lstr==ldot+1)
	    return false
 		 return true
	}

function disp_text(obj,v)
   {

   if(v<9999){
   var w = obj.selectedIndex;
   var selected_text = obj.options[w].text;
   eval("document.add_to_cart.h"+v).value=selected_text;

   tot=parseFloat(document.add_to_cart.cost.value);

   for(i=1;i<=document.add_to_cart.toth.value;i++){
    str=eval("document.add_to_cart.h"+i).value;
    strs=str;
    str=str.indexOf("+");
    if(str>0){
    tot=tot+parseFloat(strs.substr(str+1));
    }
   }
   document.add_to_cart.scost.value=tot
   tot=tot*parseInt(document.add_to_cart.amount.value)
   document.add_to_cart.totcost.value=tot
   }

   if(v==9999){
   tot=parseInt(document.add_to_cart.scost.value);
   tot=tot*parseInt(document.add_to_cart.amount.value)
   document.add_to_cart.totcost.value=tot
   }
    if(tot>0){
    document.getElementById('price').innerHTML = tot.toFixed(2);
   }
   }
