var message="Right click Disabled!";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")




function Pop_Bag(url)
{
	xx = 15;
	yy = 15;
	width = window.screen.width -(4 * xx);
	height = window.screen.height -(8 * yy);
	style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=yes,scrollbars=no,status=no,toolbar=no,resizable=yes';
	var NewWin = window.open(url,'ShoppingBag',style);
	NewWin.focus();
}
function SubGiftDtls()
{
	if (document.basket.rdGift[0].checked)
	{
		document.basket.onsubmit = "return Val_GiftDtls();";
		if(Val_GiftDtls())
		{
			document.basket.action="shoppingbag.aspx?gift=y";
			document.basket.submit();
		}
	}
	else
	{
		document.basket.action="shoppingbag.aspx?gift=y";
		document.basket.submit();
	}
}
function Var_CountChar()
{
	elem = document.getElementById("txtMsg");
	max = 250;
	if(elem != null)
	{
		if(elem.value.length >= max)
		{
			elem.value = elem.value.substring(0,max);
		}
		elem1 = document.getElementById("lblcharCount");
		elem1.innerHTML = ((max-elem.value.length));
	}
}
function Val_SpecMsg()
{
	var elemnt = document.getElementById("dg_productlist__ctl2_txtRequest");
	if(elemnt != null && elemnt.value == "")
	{
		alert("Enter Request");
		elemnt.focus();
		return false;
	}
}
function Val_GiftDtls()
{
	//TrimTxtBoxes();
	var elem = document.getElementById("txtRecpName");
	if(elem != null && elem.value == "")
	{
		alert("Please Enter Name");
		elem.focus();
		return false;
	}
	elem = document.getElementById("txtMsg");
	if(elem != null && elem.value == "")
	{
		alert("Please Enter Message");
		elem.focus();
		return false;
	}
	if(elem.value.length > 250)
	{
		alert("Your Message should be less than 250 words!");
		elem.focus();
		return false;
	}
	elem = document.getElementById("txtFromName");
	if(elem != null && elem.value == "")
	{
		alert("Please Enter Recipents Name");
		elem.focus();
		return false;
	}
	
}
/*function validbasket()
{
	var totrec=document.basket.qty.length;
	if (totrec>=2)
	{
		for(var j=0;j<totrec;j++)
		{
			
			if(document.basket.qty[j].value=="")
			{
				alert ("Please enter a valid Numeric Quantity.");
				document.basket.qty[j].focus();
				return false;
			}
			else if(document.basket.qty[j].value==0)
			{
				alert ("Please enter a valid Numeric Quantity.");
				document.basket.qty[j].focus();
				return false;
			}
			else
			{
				var result = true;
				charset="1234567890";
				str=document.basket.qty[j].value;
				for (var i=0;i<str.length;i++) 
				{
					if (charset.indexOf(str.substr(i,1))<0)
					{
						result = false;
						break;
					}
				}
				if(result==false) 
				{
				document.basket.qty[j].value="";
				alert ("Please enter a valid Numeric Quantity.");
				document.basket.qty[j].focus();
				return false;
				}
			}
		}
	
	}
	else
	{
		if(document.basket.qty.value=="")
		{
			alert ("Please enter a valid Numeric Quantity.");
			document.basket.qty.focus();
			return false;
		}
		else if(document.basket.qty.value==0)
		{
			alert ("Please enter a valid Numeric Quantity.");
			document.basket.qty.focus();
			return false;
		}
		else
		{
			var result = true;
			charset="1234567890";
			str=document.basket.qty.value;
			for (var i=0;i<str.length;i++) 
			{
				if (charset.indexOf(str.substr(i,1))<0)
				{
					result = false;
					break;
				}
			}
			if(result==false) 
			{
			document.basket.qty.value="";
			alert ("Please enter a valid Numeric Quantity.");
			document.basket.qty.focus();
			return false;
			}
		}
	}
	/*
	var MaxResult = true;
	for(var i = 0 ;i < document.basket.MaxQty.length;i++)
	{
		var MyMax = parseInt(document.basket.MaxQty[i].value);
		var MyQty = parseInt(document.basket.qty[i].value);
		if(MyMax < MyQty)
		{
			alert("Maximum Available Quantity : "+document.basket.MaxQty[i].value)
			MaxResult = false;
			document.basket.qty[i].focus();
			break;
		}
	}
	if(MaxResult == false)
	{
		return false;
	}
	
	return true;
}*/
function showhiderequest()
{
	if(document.getElementById("RequestDtls") != null)
	{
		if(document.Form1.rdMsg[0].checked==true)
		{
			document.getElementById('RequestDtls').style.visibility='visible';
			document.getElementById('RequestDtls').style.display='';
		}
		else
		{
			document.getElementById('RequestDtls').style.visibility='hidden';
			document.getElementById('RequestDtls').style.display='none';
		}
	}
}
function showhidegift()
{
	if(document.getElementById("HideTR3") != null)
	{
		if(document.Form1.rdGift[0].checked==true)
		{
			document.getElementById('Giftdtls').style.visibility='visible';
			document.getElementById('Giftdtls').style.display='';
		}
		else
		{
			document.getElementById('Giftdtls').style.visibility='hidden';
			document.getElementById('Giftdtls').style.display='none';
		}
	}
}
	
		
function ValidateFaq()
			{
				var strd;
					if (document.frmFaq.search11.value == "")
					{
						strd=document.frmFaq.MF1.value;
						alert (strd);
						document.frmFaq.search11.focus();
						return false;
					}
					return true;
			}
		//Validation for Contact Us
		function clearTip(field)
			{
				if(field.defaultValue == field.value)
				field.value = "";
			}
		function ValidateSearch()
		{
			if (document.frmsearch.Nsearch.value=="" || document.frmsearch.Nsearch.value=="Search here....")
			{
				alert("Please enter search string to search.");
				document.frmsearch.Nsearch.focus();
				return false;
			}	
		}	
		function writeTip(field)
			{
				if(field.value == "")
				field.value = field.defaultValue;
			}	
			
			function Contactusvalidation()
			{	
				var strd;
				if (document.frmContactUs.txtFirstName.value == " " || document.frmContactUs.txtFirstName.value == "First Name")
				{
					strd="Nome Próprio Obrigatório";
					alert(strd);
					document.frmContactUs.txtFirstName.focus();
					return false;
				}
				if (document.frmContactUs.txtLastName.value == " " || document.frmContactUs.txtLastName.value == "Last Name")
				{
					strd="Apelido Obrigatório";
					alert(strd);
					document.frmContactUs.txtLastName.focus();
					return false;
				}
				if (document.frmContactUs.txtEmail.value == " ")
				{
					strd=document.frmContactUs.MRF33.value;
					alert(strd);
					document.frmContactUs.txtEmail.focus();
					return false;
				}
				else
				{	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
					var matchArray = frmContactUs.txtEmail.value.match(emailPat);
					if (matchArray == null)
					{
						strd=document.frmContactUs.MRF44.value;
						alert (strd);
						document.frmContactUs.txtEmail.focus();
						return false;
					}					
				}
				if (document.frmContactUs.cmbCountry.value == "Select Country")
				{
					strd="País Obrigatório";
					alert(strd);
					document.frmContactUs.cmbCountry.focus();
					return false;
				}
				
			}
			
			function popupContact(url)
			{
				
				width = 270;
				height = 145;
				xx = window.screen.width;
				yy = window.screen.height;
				xx = (xx/2) - (width/2);
				yy = (yy/2) - (height);
				style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
				newwindow=window.open(url,'name',style);
				if (window.focus) {newwindow.focus()}
			}
		function popitupContact(url)
		{
			newwindow=window.open(url,'name','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=270,height=145,left = 350,top = 400');
			if (window.focus) {newwindow.focus()}
		}
				
				//Validation for Contact Us Ends
				
		//Validation for Suggestions		
				
		function validateSuggestion()
			{	
			    
				var strd;
				if (document.frmsugst.txtFirstName.value == "")
				{ 
					alert("Nome Próprio Obrigatório");
					document.frmsugst.txtFirstName.focus();
					return false;
				}
				if (document.frmsugst.txtEmail.value == "")
				{
					alert("Email Obrigatório");
					document.frmsugst.txtEmail.focus();
					return false;
				}
				else 
				{	 var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
					var matchArray = frmsugst.txtEmail.value.match(emailPat);
					if (matchArray == null)
					{
						alert ("Please enter your valid email address.");
						document.frmsugst.txtEmail.focus();
						return false;
						}
									
				}
			  
			}
			
			//Validations for Unsubscribe
			
				function validateUnsubscribe()
			{
				var strd;
				if (document.frmContactUs.txtEmail.value == "")
				{
					strd=document.frmContactUs.MRF1.value;
					alert(strd);
					document.frmContactUs.txtEmail.focus();
					return false;
				}
				else
				{	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
					var matchArray = frmContactUs.txtEmail.value.match(emailPat);
					if (matchArray == null)
					{
						strd=document.frmContactUs.MRF2.value;
						alert (strd);
						document.frmContactUs.txtEmail.focus();
						return false;
					}					
				}	
			}

//Validation for MyAccount

	function validAccount()
		{
			if (document.abc.txtFirstName.value=="")
			{
				alert('Please enter first name');
				document.abc.txtFirstName.focus();
				return false;
			}
			if (document.abc.txtLastName.value=="")
			{
				alert('Please enter last name');
				document.abc.txtLastName.focus();
				return false;
			}
			var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
			var matchArray = document.abc.txtEmail.value.match(emailPat);
			if (matchArray == null)
			{
				alert('Please enter valid email address');
				document.abc.txtEmail.focus();
				return false;
			}	
			if (document.abc.txtVAT.value=="")
			{
				alert('Please enter your VAT No.');
				document.abc.txtVAT.focus();
				return false;
			}
			if (document.abc.txt_address1.value=="")
			{
				alert('Please enter Address.');
				document.abc.txt_address1.focus();
				return false;
			}
			if (document.abc.txtPostalCode.value=="")
			{
				alert('Please enter postal Code');
				document.abc.txtPostalCode.focus();
				return false;
			}
		
			if(document.getElementById("cmbstate").value==":: Select State ::")
				{
					alert('Please Select  State');
					document.abc.cmbstate.focus();
					return false;
				}
			if(document.getElementById("cmbstate").value=="Others")
				{
					if (document.abc.txtState.value=="")
					{
						alert('Please enter your State');
						document.abc.txtState.focus();
						return false;
					}
				}
			if (document.abc.cmbCountry.value=="")
			{
				alert('Please select country name');
				document.abc.cmbCountry.focus();
				return false;
			}
			if (document.abc.txtPhone.value=="")
			{
				alert('Please enter phone number');
				document.abc.txtPhone.focus();
				return false;
			}
			var anum2=/(^\d+$)|(^\d+\\d+$)/
				if (!anum2.test(document.abc.txtPhone.value))
				{
					alert("please enter phone number only in figures.");
					document.abc.txtPhone.focus();
					return false;
				}
			if (document.abc.txtpassword.value=="")
			{
				alert('Please enter your password');
				document.abc.txtpassword.focus();
				return false;
			}
			if (document.abc.txtpasswordconfm.value=="")
			{
				alert('Please enter confirm password');
				document.abc.txtpasswordconfm.focus();
				return false;
			}
			if (document.abc.txtpasswordconfm.value!=document.abc.txtpassword.value)
			{
				alert('Password & confirm password must be same.');
				document.abc.txtpasswordconfm.focus();
				return false;
			}
			
			if (document.abc.ddlQuestion.value == "1")
			{
				alert('Please select Question.');
				document.abc.ddlQuestion.focus();
				return false;
			}
			
			if (document.abc.txtAns.value == "")
			{
				alert('Please select Answer.');
				document.abc.txtAns.focus();
				return false;
			}
			return true;
		}		
		
		
		//Validate Login
		
		  function validateLogin()
			  {	
					
					if (document.frmlogin.txt_username.value == "")
					{
						alert('Please enter UserName');
						document.frmlogin.txt_username.focus();
						return false;
					}	
				   if (document.frmlogin.txt_password.value == "")
					{
						alert("Please enter password");
						document.frmlogin.txt_password.focus();
						return false;
					}		
			  return true;						
	   	     }	
	   	     
	   	     
	   	     
	   	     //Validation for new user Registration
	   	     
	   	     
	   	 function validateNewUser()
			{	 
				if (document.frmregister.txtusername.value=="")
				{ 
					alert('Please enter Utilizador');
					document.frmregister.txtusername.focus();
					return false;
				}
				if (document.frmregister.txtFirstName.value=="")
				{
					alert('Please enter Nome Próprio');
					document.frmregister.txtFirstName.focus();
					return false;
				}
				if (document.frmregister.txtLastName.value=="")
				{
					alert('Please enter Apelido');
					document.frmregister.txtLastName.focus();
					return false;
				}
				var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
				var matchArray = document.frmregister.txtEmail.value.match(emailPat);
				if (matchArray == null)
				{
					alert('Please enter valid email address');
					document.frmregister.txtEmail.focus();
					return false;
				}	
				if (document.frmregister.txtPhone.value=="")
				{
					alert('Please enter Telefone');
					document.frmregister.txtPhone.focus();
					return false;
				}
				var anum2=/(^\d+$)|(^\d+\\d+$)/
				if (!anum2.test(document.frmregister.txtPhone.value))
				{
					//strd = document.Form1.MRF5.value;
					alert("please enter numeric phone number.");
					document.frmregister.txtPhone.focus();
					return false;
				}
				if (document.frmregister.txtVAT.value =="")
				{
					alert('Please enter your NIF/VAT No.');
					document.frmregister.txtVAT.focus();
					return false;
				}
				if (document.frmregister.txtAddress1.value=="")
				{
					alert('Please enter Morada');
					document.frmregister.txtAddress1.focus();
					return false;
				}
				/*if (document.frmregister.txtPhone.value=="")
				{
					alert('Please enter phone number');
					document.frmregister.txtPhone.focus();
					return false;
				}*/
					if (document.frmregister.txtCity.value=="")
				{
					alert('Please enter Cidade name');
					document.frmregister.txtCity.focus();
					return false;
				}
				if (document.frmregister.txtPostalCode.value=="")
				{
					alert('Please enter Código Postal');
					document.frmregister.txtPostalCode.focus();
					return false;
				}
				/*if(document.frmregister.cmbstate.value=="")
				{
					alert('Please Select  Estado');
					document.frmregister.cmbstate.focus();
					return false;
				}
				if(document.getElementById("cmbstate").value=="Others")
				{
					if (document.frmregister.txtState.value=="")
					{
						alert('Please enter your State');
						document.frmregister.txtState.focus();
						return false;
					}
				}
					*/
			
				if (document.frmregister.cmbCountry.value==":: Select Country ::")
				{
					alert('Please select País');
					document.frmregister.cmbCountry.focus();
					return false;
				}
				if (document.frmregister.txtpassword.value=="")
				{
					alert('Please enter your Palavra Passe');
					document.frmregister.txtpassword.focus();
					return false;
				}
				if (document.frmregister.txtcpassword.value=="")
				{
					alert('Please enter Confirmar Palavra Passe');
					document.frmregister.txtcpassword.focus();
					return false;
				}
				if (document.frmregister.txtcpassword.value!=document.frmregister.txtpassword.value)
				{
					alert('Palavra Passe & Confirmar Palavra Passe must be same.');
					document.frmregister.txtcpassword.focus();
					return false;
				}
				
				if (document.frmregister.ddlQuestion.value == "1")
				{
					alert('Please select Pergunta.');
					document.frmregister.ddlQuestion.focus();
					return false;
				}
				
				if (document.frmregister.txtAns.value ==" ")
				{
					alert('Please select Resposta.');
					document.frmregister.txtAns.focus();
					return false;
				}
				return true;
			}
			
			function checkstate()
			{
				if(document.getElementById("cmbstate").value=="Others")
				{
					//document.frmregister.txtState.Enabled=true;
					document.getElementById("txtState").disabled=false
				}
				else
				{
					document.getElementById("txtState").disabled=true;
				}
				return true;
			}
			
			function checkbillingstate()
			{
				if(document.getElementById("drp_billstate").value=="Others")
				{	
					document.getElementById("txt_otherbillstate").disabled=false
				}
				else
				{
					document.getElementById("txt_otherbillstate").disabled=true;
				}
				return true;
			}
			
			
			function checkshippingstate()
			{
				if(document.getElementById("drp_ShippingState").value=="Others")
				{	
					document.getElementById("txt_othershipstate").disabled=false
				}
				else
				{
					document.getElementById("txt_othershipstate").disabled=true;
				}
				return true;
			}
			
			
		//Validation For LoginManage	
			function checkPass()
			{
				
					if (document.Form1.txtPassword.value == "")
					{
						alert("Please, Enter your Password.");
						document.Form1.txtPassword.focus();
						return false;
					}
					if (document.Form1.txtPassword.value != document.Form1.txtConfirmPass.value)
					{
						alert("Password and Confirm Password should be same.");
						document.Form1.txtConfirmPass.value = "";
						document.Form1.txtConfirmPass.focus();
						return false;
					}
					return true;
				
			}
		
		
		//Validation for Advance Search
		
			function validateAdvSearch()
			{	
				/*var strd;
				if (document.Form1.txtsearchcriteria.value == "" || document.Form1.txtsearchcriteria.value == "Enter Search Criteria")
				{
					//strd=document.Form1.MRF11.value;
					alert('Please enter search Criteria...');
					document.Form1.txtsearchcriteria.focus();
					return false;
				}
				
				var anum=/(^\d+$)|(^\d+\.\d+$)/
				if (document.Form1.txtpfrom.value  != "" )
				{
					if (!anum.test(document.Form1.txtpfrom.value))
					{
						alert('Invalid Price')
						document.Form1.txtpfrom.focus();
						return false;
					}
				}
				if (document.Form1.txtto.value  != "" )
				{	
					if (!anum.test(document.Form1.txtto.value))
					{
						alert('Invalid Price')
						document.Form1.txtto.focus();
						return false;
					}
				}	*/
				
			}	
			
			function validatsearch()
			{
				var strd;
					if (document.frm.search.value == "")
					{
						strd=document.frm.MRF1.value;
						alert (strd);
						document.frm.search.focus();
						return false;
					}
			}
			
			
			//Validation for shipping info
			
			function validateShippingInfo()
			{
				var strd;
				if (document.Form1.txt_FirstName.value=="")
				{
					strd="Nome Próprio Obrigatório";
					alert(strd);
					document.Form1.txt_FirstName.focus();
					return false;
				}
				
				if (document.Form1.txt_LastName.value=="")
				{
					strd="Apelido Obrigatório";
					alert(strd);
					document.Form1.txt_LastName.focus();
					return false;
				}
				
				if (document.Form1.txt_Email.value=="")
				{
					strd="Email Obrigatório";
					alert(strd);
					document.Form1.txt_Email.focus();
					return false;
				}
				
				var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
				var matchArray = document.Form1.txt_Email.value.match(emailPat);
				if (matchArray == null)
				{   
					strd=document.Form1.MRF44.value;
					alert(strd);
					document.Form1.txt_Email.focus();
					return false;
				}
				
				if (document.Form1.txt_address1.value=="")
				{
					strd="Morada Obrigatório";
					alert(strd);
					document.Form1.txt_address1.focus();
					return false;
				}
				
				if (document.Form1.txt_billCity.value=="")
				{
					strd="Cidade Obrigatório";
					alert(strd);
					document.Form1.txt_billCity.focus();
					return false;
				}	
				
				if (document.Form1.txt_billpostalcode.value=="")
				{
					strd="Código postal Obrigatório";
					alert(strd);
					document.Form1.txt_billpostalcode.focus();
					return false;
				}	
				
				if (document.Form1.txt_Phone.value=="")
				{
					strd="Telefone Obrigatório";
					alert(strd);
					document.Form1.txt_Phone.focus();
					return false;
				}	
				
				if (document.Form1.drp_billstate.value=="")
				{
					strd="Estado Obrigatório";
					alert(strd);
					document.Form1.drp_billstate.focus();
					return false;
				}	
				
				if (document.Form1.drp_billcountry.value=="")
				{
					strd="País Obrigatório";
					alert(strd);
					document.Form1.drp_billcountry.focus();
					return false;
				}	
				
				if (document.Form1.drp_shippingmethod.value==""||document.Form1.drp_shippingmethod.value=="No Shipping Methods Available")
				{
					strd="Modo de entrega Obrigatório";
					alert(strd);
					document.Form1.drp_shippingmethod.focus();
					return false;
				}
				
				if (document.Form1.txt_shiptoname.value=="")
				{
					strd="Enviar para Name Obrigatório";
					alert(strd);
					document.Form1.txt_shiptoname.focus();
					return false;
				}
				
				if (document.Form1.txt_address.value=="")
				{
					strd="Morada Obrigatório";
					alert(strd);
					document.Form1.txt_address.focus();
					return false;
				}	
				
				if (document.Form1.txt_city.value=="")
				{
					strd="Cidade Obrigatório";
					alert(strd);
					document.Form1.txt_city.focus();
					return false;
				}	
				
				if (document.Form1.txt_pincode.value=="")
				{
					strd="Código postal Obrigatório";
					alert(strd);
					document.Form1.txt_pincode.focus();
					return false;
				}
				
				if (document.Form1.drp_Country.value=="")
				{
					strd="País Obrigatório";
					alert(strd);
					document.Form1.drp_Country.focus();
					return false;
				}	
				
				return true;					
			}
			
// Search Validation
function ValidateSearch()
{
	if (document.frmsearch.Nsearch.value=="")
	{
		alert("Please enter search string to search.");
		document.frmsearch.Nsearch.focus();
		return false;
	}	
}


//Popups for Reports

function popup(url)
			{
				width = 270;
				height =300;
				xx = window.screen.width;
				yy = window.screen.height;
				xx = (xx/2) - (width/2);
				yy = (yy/2) - (height);
				style = 'left = ' +  xx + ',top = ' + yy + ',width='+ width +',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no';
				newwindow=window.open(url,'name',style);
				if (window.focus) {newwindow.focus()}
			}
function popitup(url)
{
	newwindow=window.open(url,'name','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=650,left = 100,top =20');
	if (window.focus) {newwindow.focus()}
}
function HeaderEmailValidation()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray =document.newsletter.m_txtNewsLetter.value.match(emailPat);
	if(document.newsletter.m_txtNewsLetter.value==" " || document.newsletter.m_txtNewsLetter.value=="insira aqui o seu e-mail" )
	{
		alert("Enter Email address.");
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format.");
		document.newsletter.m_txtNewsLetter.value="";
		document.newsletter.m_txtNewsLetter.focus();
		return false;
	}
}
function Mailfriendvalidation()
    {
    
        var strd;
		var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
		var matchArray = form1.txtfriendemail.value.match(emailPat);
		var matchArray2 = form1.txtfriendemail1.value.match(emailPat);
		var matchArray3 = form1.txtfriendemail2.value.match(emailPat);
		var matchArray4 = form1.txtselfEmail.value.match(emailPat);
	    
	    if(form1.txtfriendemail.value=="")
	    {
			alert("Please enter your Friend's valid Email-ID.");
		    document.form1.txtfriendemail.focus();
		    return false;
	    }
	  if(matchArray == null)
	    {
		    
		    alert("Please enter your valid Email-ID. for 1st Recipient");
		    document.form1.txtfriendemail.focus();
		    return false;
	    }
	   
	  /*   if(matchArray1 == null)
	    {
		    
		    alert("Please enter your valid Email-ID. for 2nd Recipient");
		    document.form1.txtfriendemail1.focus();
		    return false;
	    }
	     alert(form1.txtselfEmail.value);
    	if(matchArray2 == null)
	    {
		    
		    alert("Please enter your valid Email-ID. for 3rd Recipient");
		    document.form1.txtfriendemail2.focus();
		    return false;
	    }*/
	    
	    if(form1.txtselfEmail.value=="")
	    {
			alert("Please enter your Email-ID.");
		    document.form1.txtselfEmail.focus();
		    return false;
	    }
	    if(matchArray4 == null)
	    {
		    strd=document.form1.MRF2.value;
		    alert("Please enter your valid Email-ID.");
		    document.form1.txtselfEmail.focus();
		    return false;
	    }
	    return true;
    }
    function validBooksearch()
    {
		if(frmcollection.m_BookName.value=="")
	    {
			alert("Please enter Book Name.");
		    document.frmcollection.m_BookName.focus();
		    return false;
	    }
	    var anum2=/(^\d+$)|(^\d+\\d+$)/
		if (anum2.test(frmcollection.m_BookName.value))
		{
			alert("please enter only text.");
			document.frmcollection.m_BookName.focus();
			return false;
		}
	     return true;
    }