    // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerCase();

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
    var is_major = parseInt(navigator.appVersion);
    var is_minor = parseFloat(navigator.appVersion);


    // Note: Opera and WebTV spoof Navigator.  We do strict client detection.
    // If you want to allow spoofing, take out the tests for opera and webtv.
    var is_moz  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
    var is_ie   = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));


function Wait()
{
	var FadeINDiv   = document.getElementById("fadein");
	var WaitDiv		= document.getElementById("wait");
	FadeINDiv.style.display = "inline";
	WaitDiv.style.display = "inline";
}

//function List(value)
//{   
//	window.location =  "items.html?category="+value;	 
//}

function List(Category,CategoryName)
{     
	window.location =  "items.html?category="+Category;	
}

//function ViewItem(ID)
//{  
//	window.location = "detail.html?vi="+ID;	 
//}

function ViewItem(ID,ItemName)
{  
	window.location = "detail.html?vi="+ID;	 	 
}


//function ViewItemFromHome(IID,CID,IName)
//{  
//	window.location = "detail.html?category="+CID+"&vi="+IID+"&item="+IName;	 
//}

function ViewItemFromHome(IID,CID,IName)
{  
	window.location = "detail.html?category="+CID+"&vi="+IID;	 
}

//function ViewFrameItem(ID)
//{ 
//	parent.location  = "detail.html?vi="+ID;
//}

function ViewFrameItem(ID,ItemName)
{ 
	parent.location  = "detail.html?vi="+ID;
}

function SizeInfo(ID)
{ 
	var HiddenDIV = document.getElementById('hsid').value; 
	var DivIDArray = new Array();
	DivIDArray = HiddenDIV.split(',');
	for(i=0; i<DivIDArray.length; i++)
	{
		if(DivIDArray[i] != '')
		{
			if(DivIDArray[i] == ID)
			{
				document.getElementById(ID).style.display='inline';
			}
			else
			{
				document.getElementById(DivIDArray[i]).style.display='none';
			}
		}
	}	
}

function Show()
{	
	document.getElementById('showgifts').style.display='inline';	 
}
function Close()
{
	document.getElementById('showgifts').style.display='none';
}
 
function ValAddToCart(id,catid)
{
	
	var Quantity = document.getElementById(id).value;
	//alert(Quantity);
	if(Quantity == '' || Quantity == 0)
	{
		alert('Please enter valid quantity');
		document.getElementById(id).focus();
		return false;
	}
	else if(Quantity < 1)
	{
		alert('Please enter valid quantity');
		document.getElementById(id).value='';
		document.getElementById(id).focus();
		return false;
	}
	else if(isNaN(document.getElementById(id).value))
	{
		alert('Please enter valid quantity');
		document.getElementById(id).value='';
		document.getElementById(id).focus();
		return false;
	}
	else
	{
	   
		   // header("location:http://bcod11/epound/site/index.php");
		 location.href="../product_details.php?product_id="+id+"&qty="+Quantity+"&action=add&category="+catid;
		return true;
	} 
	return false;
}

function Login(Operation)
{
	var FadeINDiv   = document.getElementById("fadein");
	var LoginDiv	= document.getElementById("login");
	if(Operation == "open")
	{
		 FadeINDiv.style.display = "inline";
		 LoginDiv.style.display = "inline";
	}
	if(Operation == "close")
	{
		 FadeINDiv.style.display = "none";
		 LoginDiv.style.display = "none";
	}
}

function ForgotPassword(Operation)
{
	var FadeINDiv			= document.getElementById("fadein");
	var LoginDiv			= document.getElementById("login");
	var ForgotPasswordDiv	= document.getElementById("forgotpassword");
	if(Operation == "open")
	{		
		 LoginDiv.style.display = "none";
		 ForgotPasswordDiv.style.display = "inline";
	}

	if(Operation == "close")
	{
		 FadeINDiv.style.display = "none";
		 LoginDiv.style.display = "none";
		 ForgotPasswordDiv.style.display = "none";
	}

	if(Operation == "newpassword")
	{ 
		Error = false;
		var EmailIDFP = document.getElementById('emailfp');
	  
		if(EmailIDFP.value == '' )
		{
			alert('Please Enter Your Email address');
			EmailIDFP.focus();
			Error = true;
			return false;
		}
		if(EmailIDFP.value != '')
		{
			if( isEmail(EmailIDFP.value) == false)
			{					
				Error = true;
				return false; 
			}
		}
		if(Error == true)
		{
			return false;
		}
		else
		{	 			
			var xmlHttp;
			try
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
			}
			catch (e)
			{
				// Internet Explorer
				try
				{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					try
					{
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e)
					{
						alert("Your browser does not support AJAX!");
						return false;
					}
				}
			}

			xmlHttp.onreadystatechange=function()
			{
				if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
				{
					document.getElementById("forgotpassword").innerHTML=xmlHttp.responseText
				}
			}

			url="forgotpassword.html?email="+EmailIDFP.value;	 
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null); 			
		} 
	}
}


function ViewBasket(url)
{
	//window.location = "basket.html";
	location.href = url+"cart.php";
}

function ValLogin()
{
	var EmailID = document.getElementById('eid').value;
	var ThePassword = document.getElementById('pwd').value;
	if(EmailID == '')
	{
		alert('Please enter valid information / email');
		return false;
	}
	else if(isEmail(EmailID) == false)
	{
		alert('Please enter valid information / email');
		return false;
	}
	else if(ThePassword == '')
	{
		alert('Please enter valid information / password');
		return false;
	}
	else
	{
		return true;
	}	
}

//	FUNCTION FOR EMAIL VALIDATION -- STARTS
//	DO NOT CHANGE ANY PARAMENTER OR CODE
function isEmail(emailStr1)
{
		var emailPat=/^(.+)@(.+)$/
		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
		var validChars="\[^\\s" + specialChars + "\]"
		var quotedUser="(\"[^\"]*\")"
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
		var atom=validChars + '+'
		var word="(" + atom + "|" + quotedUser + ")"
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

		var matchArray=emailStr1.match(emailPat)
		if (matchArray==null) {
			alert("Email address seems incorrect (check @ and .'s)")		
			return false
		}
		
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) {
			alert("The user name doesn't seem to be valid.")
			return false
		}

		var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) {
			  for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					alert("Destination IP address is invalid!")
					return false
				}
			}	    
			return true
		}

		var domainArray=domain.match(domainPat)
		if (domainArray==null) {
			alert("The domain name doesn't seem to be valid.")
			return false
		}

		var atomPat=new RegExp(atom,"g")
		var domArr=domain.match(atomPat)
		var len=domArr.length
		if (domArr[domArr.length-1].length<2 || 
			domArr[domArr.length-1].length>3) {
		   alert("The address must end in a three-letter domain, or two letter country.")
		   return false
		}

		if (len<2) {
		   var errStr="This address is missing a hostname!"
		   alert(errStr)
		   return false
		}	
		return true
 }
//FUNCTION FOR EMAIL VALIDATION -- ENDS

//	BASKET FUNCTIONS -- STARTS
function ShowB(id)
{	
	document.getElementById('gifts'+id).style.display='inline';
	
}
function CloseB(id)
{
	document.getElementById('gifts'+id).style.display='none';
}
function ViewB(id)
{
	WinOpen('<?php echo $Config->GetBaseURL()?>basket.html?cart_id='+ id+'&replacegift=1',500,500);
}
//	BASKET FUNCTIONS -- ENDS

//	DROP DOWN MENUS  -- STARTS
	sfHover = function() {
		//alert(document.getElementById("ddl").getElementsByTagName("LI"));
		var sfEls = document.getElementById("ddl").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
//	DROP DOWN MENUS  -- ENDS

function Swap(ItemID, DivID)
{ 
	if(DivID == 'myimage' )
	{ 
		window.location='detail.html?vi='+ItemID+'&v='+1;
	}
	else
	{ 
		window.location='detail.html?vi='+ItemID+'&v='+2;
	}


//	{  
//		var xmlHttp;
//		xmlHttp=GetXmlHttpObject();
//		if (xmlHttp==null)
//		{
//			alert ("Browser does not support HTTP Request")
//			return
//		}
//		url='getbigview.html?vi='+ItemID+'&element='+DivID;
//	 
//		xmlHttp.onreadystatechange=stateChanged 
//		xmlHttp.open("GET",url,true)
//		xmlHttp.send(null)
//	}
//
//	function stateChanged()
//	{ 
//		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
//		{  
//			document.getElementById('bigview').innerHTML=xmlHttp.responseText
//		}
//	}
//
//	function GetXmlHttpObject()
//	{
//		var xmlHttp=null;
//		try
//		{
//			// Firefox, Opera 8.0+, Safari
//			xmlHttp=new XMLHttpRequest();
//		}
//		catch (e)
//		{
//			//Internet Explorer
//			try
//			{
//				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
//			}
//			catch (e)
//			{
//				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
//			}
//		}
//		return xmlHttp;
//	}


//	var DivHTML = document.getElementById('divhtml');
//	
//	if(div == 'myimage')
//	{ 		
//		document.getElementById('myimage').style.display = "inline";
//		document.getElementById('myimage1').style.display = "none";		 
//		document.getElementById('itemsequenceid').value	= 1;		
//	}
//	else
//	{
//		if(div == 'myimage1')
//		{ 
//			document.getElementById('myimage').style.display = "none";
//			document.getElementById('myimage1').style.display = "inline";			 
//			document.getElementById('itemsequenceid').value	= 2;		
//		}
//	}
}


/*	SCROLL BAR FUNCTIONS -- STARTS */
var ID;


// Scroll the iframe on the right
		function ScrollRight(){

			// is_ie is set in main.js
			if(is_moz) {
				frm = document.getElementById('products').contentDocument.defaultView;
			} else {
				frm = top.frames['products'];
			}


			frm.scrollBy(6,0);
			ID = setTimeout('ScrollRight()','21');
		}

		// Scroll the iframe on the left
		function ScrollLeft(){

			// is_ie is set in main.js
			if(is_moz) {
				frm = document.getElementById('products').contentDocument.defaultView;
			} else {
				frm = top.frames['products'];
			}

			frm.scrollBy(-6,0);
			ID = setTimeout('ScrollLeft()','21');
		}

		// Clear the scroll
		function StopScroll(){
			clearTimeout(ID);
		}

		function Hand(){
			if (is_moz){
				document.body.style.cursor = 'pointer';
			} else {
				document.body.style.cursor = 'hand';
			}
		}

		function Normal(){
			clearTimeout(ID);
			if (is_moz){
				document.body.style.cursor = '';
			} else {
				document.body.style.cursor = '';
			}
		}
/*	SCROLL BAR FUNCTIONS -- ENDS */
function UserLogin()
{
	var Error = false;
	var EmailID = document.getElementById('emailUL');
	var CompleteEmailID =EmailID.value;
	var ThePassword = document.getElementById('passwordUL'); 
//alert (CompleteEmailID);
	if(CompleteEmailID  == '' )
	{
		alert('Please enter the email address');
		EmailID.value='';
		EmailID.focus();
		Error = true;
		return false; 
	}
	
	if( isEmail(CompleteEmailID) == false)
	{	
		EmailID.value='';
		EmailID.focus();
		Error = true;
		return false; 
	}
	
	if(ThePassword.value == '')
	{
		alert('Please enter the password');
		ThePassword.value='';
		ThePassword.focus();
		Error = true;
		return false; 
	}

	if(Error == false)
	{
		alert(' Thank You ! ');
		return true;
	}	
}

function validateCheckout(Step)
{
	var Error			= false;
	switch(Step)
	{
		case 'registration': 				
			var Email			= document.getElementById('email');
			var ThePassword		= document.getElementById('password');
			var ConfirmPassword = document.getElementById('confirm_password');
			var TAC				= document.getElementById('tac'); 

			if(Email.value == '' )
			{
				alert('Please enter the email address');
				Email.focus();
				Error = true;
				return false;
			}
			if( isEmail(Email.value) == false)
			{	
				EmailID.value='';
				EmailID.focus();
				Error = true;
				return false; 
			}
			if(ThePassword.value == '')
			{
				alert('Please enter the password');
				ThePassword.focus();
				Error = true;
				return false;
			}
			if(ConfirmPassword.value == '')
			{
				alert('Please enter the confirm password');
				ConfirmPassword.focus();
				Error = true;
				return false;
			}
			if(ThePassword.value != '' && ConfirmPassword.value != '')
			{
				if(ThePassword.value != ConfirmPassword.value )
				{
					alert('Please enter the correct password');
					ThePassword.value = '';
					ConfirmPassword.value = '';
					Error = true;
					return false;
				}
			}
			if(TAC.checked == false)
			{
				alert('Please select the terms and condition');				
				TAC.focus();
				Error = true;
				return false

			}
			if(Error == false)
			{
				return true;
			}
		break;
		case 'billingshipping':
			var Same		= document.getElementById('checkDetails').checked;
			//var Company		= document.getElementById('company');
			var email		= document.getElementById('email');
			var BFName		= document.getElementById('name1');
			var BLName		= document.getElementById('name2');
			var BAddress1	= document.getElementById('add1');
			var BAddress2	= document.getElementById('add2');
			var BAddress3	= document.getElementById('add3');
			//var BCity		= document.getElementById('billing_city');
			var BPostal		= document.getElementById('billing_postcode');
			var BCountry	= document.getElementById('billing_country');
			var BState  	= document.getElementById('billing_state');
			var BPhone		= document.getElementById('billing_phone');
			//var BStd		= document.getElementById('billing_std');
			var BMobile		= document.getElementById('billing_mobile');

			var SFName		= document.getElementById('name3');
			var SLName		= document.getElementById('name4');
			var SAddress1	= document.getElementById('add4');
			var SAddress2	= document.getElementById('add5');
			var SAddress3	= document.getElementById('add6');
			//var SCity		= document.getElementById('shipping_city');
			var SPostal		= document.getElementById('shipping_postcode');
			var SCountry	= document.getElementById('shipping_country');	
			var SState  	= document.getElementById('shipping_state');
			var SPhone		= document.getElementById('shipping_phone');
			//var SStd		= document.getElementById('shipping_std');
			var SMobile 	= document.getElementById('shipping_mobile');
						
			if(email.value == '' )
			{
				alert('Please enter the email address');
				email.focus();
				Error = true;
				return false;
			}
			if( isEmail(email.value) == false)
			{	
				email.focus();
				Error = true;
				return false; 
			}
//			if(Company.value=='')
//			{
//				alert('Please enter the Company name');
//				Company.focus();
//				Error = true;
//				return false;
//			}
			if(BFName.value == '' )
			{
				alert('Please enter first name (Billing) ');
				BFName.value='';
				BFName.focus();
				Error = true;
				return false;
			}
			if(BLName.value == '' )
			{
				alert('Please enter last name (Billing) ');
				BLName.value='';
				BLName.focus();
				Error = true;
				return false;
			}
			if(BAddress1.value == '' )
			{
				alert('Please enter address line 1 ');
				BAddress1.value='';
				BAddress1.focus();
				Error = true;
				return false;
			}
//			if(BAddress2.value == '' )
//			{
//				alert('Please enter address line 2');
//				BAddress2.value='';
//				BAddress2.focus();
//				Error = true;
//				return false;
//			}
			if(BAddress3.value == '' )
			{
				alert('Please enter billing city.');
				BAddress3.value='';
				BAddress3.focus();
				Error = true;
				return false;
			}
			if(BCountry.value == '' )
			{
				alert('Please select country');
				BCountry.value='';
				BCountry.focus();
				Error = true;
				return false;
			}
			if(BState.value == '' )
			{
				alert('Please select county');
				BState.value='';
				BState.focus();
				Error = true;
				return false;
			}
//			if(BCity.value == '' )
//			{
//				alert('Please select city ');
//				BCity.value='';
//				BCity.focus();
//				Error = true;
//				return false;
//			}
			if(BPostal.value == '' )
			{
				alert('Please enter post code');
				BPostal.value='';
				BPostal.focus();
				Error = true;
				return false;
			}
			
//			if(BStd.value != '' )
//			{
//				if(isNaN(BStd.value)==true)
//				{
//					alert('Please enter digit in STD code');
//					BStd.value='';
//					BStd.focus();
//					Error = true;
//					return false;
//				}
//			}
			if(BPhone.value != '' )
			{
				if(isNaN(BPhone.value)==true)
				{
					alert('Please enter digit in Phone Number');
					BPhone.value='';
					BPhone.focus();
					Error = true;
					return false;
				}
			}
//			if(BMobile.value == '' )
//			{
//				alert('Please enter mobile no.');
//				BMobile.value='';
//				BMobile.focus();
//				Error = true;
//				return false;
//			}
			if(BMobile.value != '' )
			{
				if(isNaN(BMobile.value)==true)
				{
					alert('Please enter digit in Mobile number');
					BMobile.value='';
					BMobile.focus();
					Error = true;
					return false;
				}
			}
			if( document.getElementById('checkDetails').checked == false )
			{
				if(SFName.value == '' )
				{
					alert('Please enter first name (Shipping) ');
					SFName.value='';
					SFName.focus();
					Error = true;
					return false;
				}	
				if(SLName.value == '' )
				{
					alert('Please enter last name (Shipping) ');
					 SLName.value='';
					 SLName.focus();
					Error = true;
					return false;
				}	
				if(SAddress1.value == '' )
				{
					alert('Please enter address line 1 (Shipping) ');
					 SAddress1.value='';
					 SAddress1.focus();
					Error = true;
					return false;
				}	
//				if(SAddress2.value == '' )
//				{
//					alert('Please enter address line 2 (Shipping) ');
//					 SAddress2.value='';
//					 SAddress2.focus();
//					Error = true;
//					return false;
//				}
				if(SAddress3.value == '' )
				{
					alert('Please enter shippign city. ');
					 SAddress3.value='';
					 SAddress3.focus();
					Error = true;
					return false;
				}
				if(SCountry.value == '' )
				{
					alert('Please select country (Shipping) ');
					 SCountry.value='';
					 SCountry.focus();
					Error = true;
					return false;
				}	
				if(SState.value == '' )
				{
					alert('Please select county (Shipping) ');
					 SState.value='';
					 SState.focus();
					Error = true;
					return false;
				}	
//				if(SCity.value == '' )
//				{
//					alert('Please select city (Shipping) ');
//					SCity.value='';
//					SCity.focus();
//					Error = true;
//					return false;
//				}	
				if(SPostal.value == '' )
				{
					alert('Please enter post code (Shipping) ');
					 SPostal.value='';
					 SPostal.focus();
					Error = true;
					return false;
				}	
				
//				if(SStd.value != '' )
//				{
//					if(isNaN(SStd.value)==true)
//					{
//						alert('Please enter digit in STD code (Shipping)');
//						SStd.value='';
//						SStd.focus();
//						Error = true;
//						return false;
//					}
//				}
				if(SPhone.value != '' )
				{
					if(isNaN(SPhone.value)==true)
					{
						alert('Please enter digit in Phone Number (Shipping)');
						SPhone.value='';
						SPhone.focus();
						Error = true;
						return false;
					}
				}
//				if(SMobile.value == '' )
//				{
//					alert('Please enter mobile no. (Shipping) ');
//					 SMobile.value='';
//					 SMobile.focus();
//					Error = true;
//					return false;
//				}
				if(SMobile.value != '' )
				{
					if(isNaN(SMobile.value)==true)
					{
						alert('Please enter digit in Mobile number (Shipping)');
						SMobile.value='';
						SMobile.focus();
						Error = true;
						return false;
					}
				}
			}
			if(Error == false)
			{
				return true;
			}
			else
			{
				return false;
			}
		break;
		default: 
	}
}

function SameAs()
{
	
		if(document.getElementById('checkDetails').checked==true)
		{
			document.getElementById('name3').value = document.getElementById('name1').value;

			

			document.getElementById('name4').value = document.getElementById('name2').value;

			document.getElementById('companyshipping').value = document.getElementById('company').value;

			document.getElementById('add4').value = document.getElementById('add1').value;

			document.getElementById('add5').value = document.getElementById('add2').value;
			
			document.getElementById('add6').value = document.getElementById('add3').value;

			//document.getElementById('shipping_country').value = document.getElementById('billing_country').value;

			document.getElementById('shipping_state').value = document.getElementById('billing_state').value;

			//document.getElementById('shipping_city').value = document.getElementById('billing_city').value;

			document.getElementById('shipping_postcode').value = document.getElementById('billing_postcode').value;

			//document.getElementById('shipping_std').value = document.getElementById('billing_std').value;

			document.getElementById('shipping_phone').value = document.getElementById('billing_phone').value;

			document.getElementById('shipping_mobile').value = document.getElementById('billing_mobile').value;



		}
		else
		{			
			//document.getElementById('shipping_name').value = '';
			document.getElementById('name3').value = '';

			document.getElementById('name4').value = '';

			document.getElementById('companyshipping').value ='';

			document.getElementById('add4').value = '';

			document.getElementById('add5').value = '';

			document.getElementById('add6').value = '';

		//	document.getElementById('shipping_country').value = '';

		//	document.getElementById('shipping_state').value = '';

			//document.getElementById('shipping_city').value = '';

			document.getElementById('shipping_postcode').value = '';

			//document.getElementById('shipping_std').value = '';

			document.getElementById('shipping_phone').value ='';

			document.getElementById('shipping_mobile').value ='';

		}
}

function ShowReview(id)
{	
	document.getElementById('gifts'+id).style.display='inline';
	
}
function CloseReview(id)
{
	document.getElementById('gifts'+id).style.display='none';
}

function Myaccount()
{ 
	window.location = "myaccount.html";
}

function CheckPassword()
{
	if(document.getElementById('oldpswd').value=="")
	{
		alert("Enter old password.");
		document.getElementById('oldpswd').focus();
		return false;
	}	
	if(document.getElementById('newpswd').value=="")
	{
		alert("Enter new password.");
		document.getElementById('newpswd').focus();
		return false;
	}
	if(document.getElementById('newpswd').value.length<6)
	{
		alert("Password should be atleast 6 characters..");
		document.getElementById('newpswd').focus();
		return false;
	}
	if(document.getElementById('repswd').value=="")
	{
		alert("Re-enter new password.");
		document.getElementById('repswd').focus();
		return false;
	}
	if(document.getElementById('repswd').value!=document.getElementById('newpswd').value)
	{
		alert("New and re-entered password should be same.");
		document.getElementById('newpswd').focus();
		return false;
	}
	else
		return true;
}

function logout()
{
	window.location="cartlogin.html?logout=1";
}

function ShowLarge(DIVID)
{
	//document.getElementById(DIVID).style.display="inline";
	url = "viewitem.html?img="+DIVID;
	window.open(url,'Tantra','width=620,height=700,left=650,top=100,resizable=no,scrollbar=yes, toolbar=no,status=no,directories=no,location=no');
	 
}
function HideLarge(DIVID)
{
		document.getElementById(DIVID).style.display="none";
}

function ViewOrder(id)
{
	window.location= "myorder.php?id="+id;

}

function ViewInvoice(id)
{
	url = "myorder.php?invoice="+id;
	newwindow=window.open(url,'Invoice','width=600,height=600,left=50,top=50,scrollbars=yes,resizable=yes,toolbar=no,status=no,directories=no,location=no');
}


function SubscribeNewsletter(Operation)
{	
	var	Error				= false;
	var NewsLetterID		= document.getElementById('mod_search_searchword');
	var FadeINDiv			= document.getElementById("fadein");
	var ConfirmNL			= document.getElementById("confirmnewsletter"); 	
	var TAC					= document.getElementById("tac"); 	

	if(Operation == "open")
	{		 
		if(NewsLetterID.value == 'Type your email*')
		{
			alert('Please Enter Your Email address');
			NewsLetterID.focus();
			Error = true;
			return false;
		}
		if(NewsLetterID.value == '' )
		{
			alert('Please Enter Your Email address');
			NewsLetterID.focus();
			Error = true;
			return false;
		}
		if(NewsLetterID.value != '')
		{
			if( isEmail(NewsLetterID.value) == false)
			{	
				NewsLetterID.value='';
				NewsLetterID.focus();
				Error = true;
				return false; 
			}
		}
		
		if(Error == true)
		{
			return false;
		}
		else
		{			
			FadeINDiv.style.display = "inline"; 
			ConfirmNL.style.display = "inline"; 
		}
	}

	if(Operation == 'close')
	{
		FadeINDiv.style.display = "none"; 
		ConfirmNL.style.display = "none"; 
	} 

	if( Operation == 'submit' )
	{  
		if(TAC.checked == false)
		{
			alert('Please check the terms and conditions');
			return false;
		}
		else
		{
			var xmlHttp;
			try
			{
				// Firefox, Opera 8.0+, Safari
				xmlHttp=new XMLHttpRequest();
			}
			catch (e)
			{
				// Internet Explorer
				try
				{
					xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					try
					{
						xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e)
					{
						alert("Your browser does not support AJAX!");
						return false;
					}
				}
			}

			url="subscribe.html?email="+NewsLetterID.value;	
			xmlHttp.onreadystatechange=stateChanged;
			xmlHttp.open("GET",url,true);
			xmlHttp.send(null); 
		}
	} 	

	function stateChanged()
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
		{ 
			FadeINDiv.style.display = "inline"; 
			ConfirmNL.innerHTML=xmlHttp.responseText
			ConfirmNL.style.display = "inline"; 
			NewsLetterID.value='Type your email*';
		} 
	}
}

function Register()
{ 
	window.location="register.html";
}

function check_value()
{
	if(document.getElementById('firstName').value=='' || document.getElementById('firstName').value=='First name'){
	document.getElementById('firstName').value="";
	}
	if(document.getElementById('lastName').value=='' || document.getElementById('lastName').value=="Last name" ){
	document.getElementById('lastName').value="";
	}
}

//	ITEM PAGINATION -- STARTS
function ItemPagination(PageNumber,CategoryID)
{ 
	{  
		var xmlHttp;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		url='itempagination.html?pageno='+PageNumber+'&category='+CategoryID;		 
	 
		xmlHttp.onreadystatechange=stateChanged 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}

	function stateChanged()
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
		{  
			document.getElementById("middle_container1").innerHTML=xmlHttp.responseText
		}
	}

	function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			//Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return xmlHttp;
	}
}
//	ITEM PAGINATION -- ENDS


//	REGION MANAGEMENT -- STARTS
function GetRegionForRegistration(RegionValue, RegionValue1, ElementID, RegionName)
{ 
	{  
		var xmlHttp;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		}
		url='getregions.html?value='+RegionValue+'&element='+ElementID+'&field='+RegionName+'&value1='+RegionValue1;		 
	 
		xmlHttp.onreadystatechange=stateChanged 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
	}

	function stateChanged()
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") 
		{  
			document.getElementById(ElementID).innerHTML=xmlHttp.responseText
		}
	}

	function GetXmlHttpObject()
	{
		var xmlHttp=null;
		try
		{
			// Firefox, Opera 8.0+, Safari
			xmlHttp=new XMLHttpRequest();
		}
		catch (e)
		{
			//Internet Explorer
			try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
		}
		return xmlHttp;
	}
}

function validate()
{
	if(document.contactfrm.txt_name.value == "")
	{
		alert("Please Enter your name");
		document.contactfrm.txt_name.focus();
		return false;
	}
	emailStr1=document.contactfrm.txt_email.value;
	if(document.contactfrm.txt_email.value == "")
	{
		alert("Please Enter your email-id");
		document.contactfrm.txt_email.focus();
		return false;
	}
		if(isEmail(emailStr1) == false)
		{
			document.contactfrm.txt_email.focus();
			return false;
		}	

		function isEmail(emailStr1)
		{
			var emailPat=/^(.+)@(.+)$/
			var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
			var validChars="\[^\\s" + specialChars + "\]"
			var quotedUser="(\"[^\"]*\")"
			var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
			var atom=validChars + '+'
			var word="(" + atom + "|" + quotedUser + ")"
			var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
			var matchArray=emailStr1.match(emailPat)
			if (matchArray==null) {
				alert("Email address seems incorrect (check @ and .'s)")		
				return false
			}
			var user=matchArray[1]
			var domain=matchArray[2]
			if (user.match(userPat)==null) {
				alert("The username doesn't seem to be valid.")
				return false
			}
			var IPArray=domain.match(ipDomainPat)
			if (IPArray!=null) {
				  for (var i=1;i<=4;i++) {
					if (IPArray[i]>255) {
						alert("Destination IP address is invalid!")
						return false
					}
				}	    
				return true
			}
			var domainArray=domain.match(domainPat)
			if (domainArray==null) {
				alert("The domain name doesn't seem to be valid.")
				return false
			}
			var atomPat=new RegExp(atom,"g")
			var domArr=domain.match(atomPat)
			var len=domArr.length
			if (domArr[domArr.length-1].length<2 || 
				domArr[domArr.length-1].length>3) {
			   alert("The address must end in a three-letter domain, or two letter country.")
			   return false
			}
			if (len<2) {
			   var errStr="This address is missing a hostname!"
			   alert(errStr)
			   return false
			}	
			return true

		}

	if(document.contactfrm.txt_message.value == "")
	{
		alert("Please Enter your message");
		document.contactfrm.txt_message.focus();
		return false;
	}
}
//	REGION MANAGEMENT -- ENDS