function showcur(getcur,url)
{
//alert(getcur);
document.frmcurrency.getcur.value=getcur;
document.frmcurrency.url.value=url;
document.frmcurrency.submit();
}
 function loginfrmsubmit()
 {
  document.frmloginsubmit.submit();
 }
  function loginfrmsubmit1()
 {
  document.frmloginsubmit1.submit();
 }

function cartupdate(actiontype)
{

document.frmcart.action="cartmodi.php";
document.frmcart.actiontype.value=actiontype;
document.frmcart.submit();

}
function loginnow()
{
document.frmlogin.submit();
}
function searchsubmit()
{
document.frmsearch.submit();
}
function searchsubmit1()
{
document.frmsearch1.submit();
}
function searchsubmit2()
{
document.frmsearch2.submit();
}
/*function loginsubmit()
{
	if(document.frmsign.txtuname.value=="")
	{
	alert("Please Enter User Name");
	document.frmsign.txtuname.focus();
	return false;
	}
	if(document.frmsign.txtpwd.value=="")
	{
	alert("Please Enter Password");
	document.frmsign.txtpwd.focus();
	return false;
	}
	//document.frmsign.submit();
}*/
function validatesearch()
{
//alert(document.frmsign.txtsearch.value);
	if(document.frmsign.txtsearch.value==""||document.frmsign.txtsearch.value=="Enter Search Here")
	{
	alert("Please Enter Search String");
	document.frmsign.txtsearch.focus();
	return false;
	}
var iChars = "*|,\":<>[]{}`\'~;()@&$#%";
//alert(document.frmsign.txtsearch.value.length);
	for (var i = 0; i < document.frmsign.txtsearch.value.length; i++) 
	{
		if (iChars.indexOf(document.frmsign.txtsearch.value.charAt(i)) != -1)
		{
		alert ("Search string contains illegal characters!");
		document.frmsign.txtsearch.focus();
		return false;
		}	
	}	
	
}

var win= null;
function NewWindow(mypage,myname,w,h,scroll,resize,toolbar){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
settings='height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable='+resize+',dependent=no'
win=window.open(mypage,myname,settings)
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}


function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=(getposOffset(curobj, "left")-50)+"px"
subobj.style.top=(getposOffset(curobj, "top")-140)+"px"
subobj.style.display="block"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

function showAnswer(whr, wht){
        document.getElementById(whr).innerHTML = "<div class=boxb>"+wht+"<div class=faq-close><a class=nav07 href=javascript:clearAnswers("+whr+");>Close Answer</a></div></div>";
}

function clearAnswers(cntfcat){

        document.getElementById(cntfcat).innerHTML = "<br>";
}
function validate()
	{	
		if(document.frmlogin.txtemail.value=="") 
  {
	 alert('Enter Email-ID');
	 document.frmlogin.txtemail.focus();
	 return false;
   }
	var eID=document.frmlogin.txtemail
	
	if ((eID.value!=""))
	{
	if (echeck(eID.value)==false)
	{
		eID.value=""
		eID.focus()
		return false
	}
	}
  
   
	
function echeck(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 ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}
	}
function movepic(img_name,img_src) {
document[img_name].src=img_src;
}
function zoompic(img_name,width,height)
{
window.open("zoomimg.php?img="+img_name,"","height="+height+",width="+width+",toolbar=0,location=0,directories=0,menubar=0,resizable=0,scrollbars=no,width=620,height=620");
}
function addprodcart(prodid,pqty,price,actiontype)
{

//alert("Product added to Cart with prodid: "+prodid);
//alert("pqty: "+pqty);
//alert("price: "+price);


	if (document.frmproduct.varstatus.value=="color")
	{

		var radio_choice = 'false';
		for (counter = 0; counter < frmproduct.lstarea.length; counter++)
		{
			if (frmproduct.lstarea[counter].checked)
			{
			radio_value=frmproduct.lstarea[counter].value;
			radio_choice = "true"; 
			}
		}

		if (radio_choice!='true')
		{
		alert("select an option before pressing  Add to cart button");
		//return (false);
		}
		else
		{
		
		document.frmproduct.prodid.value=prodid;
		document.frmproduct.pqty.value=pqty;
		document.frmproduct.price.value=price;
		document.frmproduct.actiontype.value=actiontype;
		document.frmproduct.submit();
		}
	}

	//}
	
 if (document.frmproduct.varstatus1.value=="product")
	{
		if(document.frmproduct.lstvariant.value=="")
			{
				alert("Select an option before pressing  Add to cart button");
				//return false;
			}
		else
			{
			
			document.frmproduct.prodid.value=prodid;
			document.frmproduct.pqty.value=pqty;
			document.frmproduct.price.value=price;
			document.frmproduct.actiontype.value=actiontype;
			document.frmproduct.submit();
			}
	

	}
if ((document.frmproduct.varstatus.value=="") && (document.frmproduct.varstatus1.value==""))

	{
		document.frmproduct.prodid.value=prodid;
		document.frmproduct.pqty.value=pqty;
		document.frmproduct.price.value=price;
		document.frmproduct.actiontype.value=actiontype;
		document.frmproduct.submit();
}

}



function addcart(prodid,pqty,price,actiontype)
{

document.frmproduct.prodid.value=prodid;
document.frmproduct.pqty.value=pqty;
document.frmproduct.price.value=price;
document.frmproduct.actiontype.value=actiontype;
document.frmproduct.submit();
}
function continueshop(newinstruct)
{
//added by sony
alert(newinstruct);
window.location="index.php?instruction="+newinstruct;
//window.location="index.php";
}

function myaccount(newinstruct)
{
//added by sony
alert(newinstruct);
window.location="welcome.php?instruction="+newinstruct;
//window.location="index.php";
}


function showex()
{
document.getElementById("existinguser").style["display"]="block";
document.getElementById("newuser").style["display"]="none";
document.getElementById("common").style["display"]="none";
}
function shownew()
{
document.getElementById("existinguser").style["display"]="none";
document.getElementById("newuser").style["display"]="block";
document.getElementById("common").style["display"]="none";
document.frmsignup.radvals.value="newreg";
}

function shownew1()
{
document.getElementById("newuser").style["display"]="block";
document.getElementById("common").style["display"]="none";
document.frmcart.radvals.value="newreg";
}

function getadddisb(disp)
{
document.getElementById("newuser").style["display"]=disp;

}
function viewsearch(order,orderval,orderrat,ordervalrat,bnid,lstbrand,lstfunituretype,srch_keywords)
{
document.frmviewshipping.action="products.php";
//document.frmviewshipping.ActionType.value="showshippingname";
document.frmviewshipping.order.value=order;
document.frmviewshipping.orderval.value=orderval;
document.frmviewshipping.orderrat.value=orderrat;
document.frmviewshipping.ordervalrat.value=ordervalrat;
document.frmviewshipping.bnid.value=bnid;
document.frmviewshipping.lstbrand.value=lstbrand;
document.frmviewshipping.lstfunituretype.value=lstfunituretype;
document.frmviewshipping.srch_keywords.value=srch_keywords;

document.frmviewshipping.submit();
}

function viewbrandsearch(order,orderval,orderrat,ordervalrat,bnid,lstbrand,lstfunituretype,srch_keywords)
{
//document.frmviewshipping.action="brandproducts.php";
//document.frmviewshipping.ActionType.value="showshippingname";
document.frmviewshipping.order.value=order;
document.frmviewshipping.orderval.value=orderval;
document.frmviewshipping.orderrat.value=orderrat;
document.frmviewshipping.ordervalrat.value=ordervalrat;
document.frmviewshipping.bnid.value=bnid;
document.frmviewshipping.lstbrand.value=lstbrand;
document.frmviewshipping.lstfunituretype.value=lstfunituretype;
document.frmviewshipping.srch_keywords.value=srch_keywords;

document.frmviewshipping.submit();
}
function showcur(getcur,url)
{
document.frmcurrency.getcur.value=getcur;
document.frmcurrency.url.value=url;
document.frmcurrency.submit();
}
function SubmitShopping(formnm)
{

		formnm.action="phistory.php";
		//formnm.ActionType.value= ActionType;
	 	formnm.submit();
}
function validate()
{
	if(document.frmreview.txtname.value=="")
	{
		alert("Please enter your name");
		document.frmreview.txtname.focus();
		return false;
	}
	if(document.frmreview.txtmail.value=="")
	{
		alert("Please enter your email");
		document.frmreview.txtmail.focus();
		return false;
	}
	var eID=document.frmreview.txtmail;
	
	if ((eID.value!=""))
	{
	if (echeck(eID.value)==false)
	{
		eID.value=""
		eID.focus()
		return false
	}
	}
	if(document.frmreview.txtcomment.value=="")
	{
		alert("Please enter your Comments");
		document.frmreview.txtcomment.focus();
		return false;
	}
}
function addwishlist(prodid,pqty,price,actiontype)
{
document.frmproduct.prodid.value=prodid;
document.frmproduct.pqty.value=pqty;
document.frmproduct.price.value=price;
document.frmproduct.actiontype.value=actiontype;
document.frmproduct.submit();
}

function addrequestquote(prodid,pqty,price,actiontype)
{
document.frmproduct.prodid.value=prodid;
document.frmproduct.pqty.value=pqty;
document.frmproduct.price.value=price;
document.frmproduct.actiontype.value=actiontype;
document.frmproduct.submit();
}

function echeck(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 ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function enquiry_validate()
{
if(document.frmenquiry.txtfname.value=="") 
   {
	 alert('Enter Your First Name');
	 document.frmenquiry.txtfname.focus();
	 return false;
   }
if(document.frmenquiry.txtlname.value=="") 
   {
	 alert('Enter Your Last Name');
	 document.frmenquiry.txtlname.focus();
	 return false;
   }
if(document.frmenquiry.txtemail.value=="") 
  {
	 alert('Enter Email-ID');
	 document.frmenquiry.txtemail.focus();
	 return false;
   }
var eID=document.frmenquiry.txtemail;
	
	if ((eID.value!=""))
	{
	if (echeck(eID.value)==false)
	{
		eID.value=""
		eID.focus()
		return false
	}
	}
if(document.frmenquiry.txthouse.value=="") 
   {
	 alert("Enter House Number");
	document.frmenquiry.txthouse.focus();
	 return false;
  }
if(document.frmenquiry.txtstreet.value=="") 
   {
	 alert("Enter Street");
	document.frmenquiry.txtstreet.focus();
	 return false;
  }
if(document.frmenquiry.txtcity.value=="") 
   {
	 alert("Enter City");
	document.frmenquiry.txtcity.focus();
	 return false;
  }
if(document.frmenquiry.txtpcode.value=="") 
   {
	 alert("Enter Post Code");
	document.frmenquiry.txtpcode.focus();
	 return false;
  }
if(document.frmenquiry.txtcountry.value=="") 
   {
	 alert("Enter Country");
	document.frmenquiry.txtcountry.focus();
	 return false;
  }
if(document.frmenquiry.txtcontact.value=="") 
   {
	 alert("Enter Contact Number");
	document.frmenquiry.txtcontact.focus();
	 return false;
  }

if(document.frmenquiry.txtquery.value=="") 
   {
	 alert("Enter Your Query Here");
	document.frmenquiry.txtquery.focus();
	 return false;
  }

}
function validshipaddress(object)
{
alert("Hello");
alert("Test");
alert("You Clicked On " + frmorder1.shipadd1.value);
//if(document.frmorder.action1.value=='new')
//{

	if(document.frmorder1.txtfname.value=="") 
	   {
		 alert("Enter First Name");
		document.frmorder1.txtfname.focus();
		 return false;
	  }
	if(document.frmorder.txtlname.value=="") 
	   {
		 alert("Enter Last Name");
		document.frmorder.txtlname.focus();
		 return false;
	  }
	if(document.frmorder.address.value=="") 
	   {
		 alert("Enter House Number");
		document.frmorder.address.focus();
		 return false;
	  }
}
//}
function showValue(obj){    alert('You Clicked On ' + obj.value);
document.frmlogin.submit();
}