function validatefaq()
{
	if (document.frmFaq.search.value == "")
	{
		alert("Enter text for search");
		document.frmFaq.search.focus();
		return false;
	}
	frmFaq.action="faqdetails.aspx?flag=2&search="+document.frmFaq.search.value;
	return true;
}

function ValidateContactUs()
{
 	var ErrMsg="";
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.Contactus2_txtEmail.value.match(emailPat);
	var ErrorDisp = "You are missing following entries.\n";
	ErrorDisp += "----------------------------------------\n";
	
	if(document.Form1.Contactus2_txtFname.value=="" )
	{
		alert("First name required\n");
		document.Form1.Contactus2_txtFname.focus();
		return false;
	}
	
	if(document.Form1.Contactus2_txtFname.value.charAt(0)==' ')
	{    alert("First name required"); 
		 document.Form1.Contactus2_txtFname.focus();
		 return false;
	 }
	if(document.Form1.Contactus2_txtLName.value=="" )
	{
		alert("Last name required\n");
		document.Form1.Contactus2_txtLName.focus();
		return false;
	}
	if(document.Form1.Contactus2_txtLName.value.charAt(0)==' ')
	{    alert("Last name required"); 
		 document.Form1.Contactus2_txtLName.focus();
		 return false;
	}	
	if(document.Form1.Contactus2_txtPhone.value=="" )
	{
		alert("Phone number required\n");
		document.Form1.Contactus2_txtPhone.focus();
		return false;
	}
	if(document.Form1.Contactus2_txtPhone.value.charAt(0)==' ')
	{    alert("Phone number required"); 
		 document.Form1.Contactus2_txtPhone.focus();
		 return false;
	}	
	
	if (ErrMsg=="")
	{
		return true;
	}
	else
	{	
		alert(ErrorDisp+ErrMsg);
		return false;
	}
}

function ValidateFaqDetails()
{
	var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
	var matchArray = Form1.TextBox2.value.match(emailPat);
	if(document.Form1.TextBox2.value=="")
	{
		alert("Email required");
		document.Form1.TextBox2.focus();
		return false;
	}
	else if (matchArray == null)
	{
		alert("Invalid Email format");
		document.Form1.TextBox2.focus();
		return false;
	}
	if(document.Form1.txtArea.value=="")
	{
		alert("Question required");
		document.Form1.txtArea.focus();
		return false;
	}
	return true;
}

function ValidateProfile()
{
	
 		var emailPat = /^[A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)*[@][A-Za-z0-9_\-]+([.][A-Za-z0-9_\-]+)+$/
		var matchArray = Form2.Profile1_txtEmail.value.match(emailPat);
		if(document.Form2.Profile1_txtFName.value=="")
		{  
			alert("First name required");
			document.Form2.Profile1_txtFName.focus();
			return false;
		}
		if(document.Form2.Profile1_txtFName.value.charAt(0)==' ')
		{   alert("No spaces allowed.\n");
			document.Form2.Profile1_txtFName.focus();
			return false;
		}
		if(document.Form2.Profile1_txtUserName.value=="")
		{
			alert("User name required");
			document.Form2.Profile1_txtUserName.focus();
			return false;
		}
		if(document.Form2.Profile1_txtUserName.value.charAt(0)==' ')
		{   alert("No spaces allowed.\n");
			document.Form2.Profile1_txtUserName.focus();
			return false; 
		}
		if(document.Form2.Profile1_txtPassword.value=="")
		{
			alert("Password required");
			document.Form2.Profile1_txtPassword.focus();
			return false;
		}
		if(document.Form2.Profile1_txtPassword.value.charAt(0)==' ')
		{    alert("No spaces allowed.\n"); 
			document.Form2.Profile1_txtPassword.focus();
			return false;
		}
		if(document.Form2.Profile1_txtEmail.value=="")
		{
			alert("Email required");
			document.Form2.Profile1_txtEmail.focus();
			return false;
		}
		else if (matchArray == null)
		{
			alert("Invalid Email format");
			document.Form2.Profile1_txtEmail.focus();
			return false;
		}
	
		if(document.Form2.Profile1_ddlCountry.value==".::Please Select::.")
		{
			alert("Country required");
			return false;
		}
		
		if(document.Form2.Profile1_txtAns.value=="")
		{
			alert("Answer required");
			document.Form2.Profile1_txtAns.focus();
			return false;
		}
		if(document.Form2.Profile1_txtAns.value.charAt(0)==' ')
		{    alert("No spaces allowed.\n");
			document.Form2.Profile1_txtAns.focus(); 
			return false;
		}
	return true;
}
	
function loopy() 
{
		loc = window.location.href
		sPos =loc.lastIndexOf("/")+1;
		if (sPos != -1) loc = loc.substring(0,sPos); // loose existing search
		window.location = loc+'logout.aspx';
}
function popup(url)
{
	width = 450;
	height = 345;
	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 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==" ")
	{
		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 HeaderLoginValidation()
{
	if(document.login.m_txtUserName.value==" ")
	{
		alert("Enter your username.");
		document.login.m_txtUserName.focus();
		return false;
	}
	
	if(document.login.m_txtPassword.value=="")
	{
		alert("Enter your password.");
		document.login.m_txtPassword.focus();
		return false;
	}
	return true;
}

function HeaderSearchValidation()
{
	if(document.Search.m_txtSearch.value==" ")
	{
		alert("Enter search text.");
		document.Search.m_txtSearch.focus();
		return false;
	}
}
///Photo Gallery////
function HideAll(LayerCount)
{	
	for (i=1;i<=LayerCount;i++)
	{
		MM_showHideLayers('Layer'+i,'','hide');
	}
}
function MM_findObj(n, d) 
{ 
	//v4.01
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) 
	{
		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); 
	return x;
}
function MM_showHideLayers() 
{ 
	//v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
	if ((obj=MM_findObj(args[i]))!=null) 
	{ 
		v=args[i+2];
		if (obj.style) 
		{ 
			obj=obj.style; 
			v=(v=='show')?'visible':(v=='hide')?'hidden':v; 
		}
		obj.visibility=v; 
	}
}
function Pre(LayerCount)
{
	
	for (i=1;i<=LayerCount;i++)
	{
		var layer='Layer'+i;
		var style2 = document.getElementById(layer).style.visibility;
		if(style2=='visible')
		{
			var layno=parseInt(layer.substring(5));		
		}
	}	
	/* MERA CODE[START]*/
	var t_layno=parseInt(layno);
	//alert(parseInt(t_layno));	
	if(parseInt(t_layno)>=1)
	{
		//alert("");
		document.getElementById('nxt').src='dynamicdata/images/nxt.gif'
	}
	if(t_layno==2)
	{
		document.getElementById('pre').src='dynamicdata/images/pre1.jpg'
		//alert("It is first picture on this page.");
	}
	/* MERA CODE[END]*/	
	if(layno==1)
	{
		//alert("It is first picture on this page.");
	}
	else
	{
		if(layno!=null)
		{
			HideAll(LayerCount);
			var newlay=layno-1;			
			MM_showHideLayers('Layer'+newlay,'','show');
		}
		
	}
}

function Nex(LayerCount)
{
		//alert(LayerCount);	
		
		if(LayerCount!=1)
		{
					/*** step1**/
					for (i=1;i<=LayerCount;i++)
					{					
						var layer='Layer'+i;
						//alert(layer);
						var style2 = document.getElementById(layer).style.visibility;
						//salert(style2);
						if(style2=='visible')
						{
							var layno=parseInt(layer.substring(5));				
						}
					}				
					/*** step2**/
					if(parseInt(LayerCount)> 1)
					{
					/* MERA CODE[START]*/
					var t_layno=layno;
					var t_layercnt=parseInt(LayerCount)-1
					if(isNaN(t_layno))
					{
						t_layno="1";
					}
					//alert(t_layno);
					//alert(t_layercnt);
						if(parseInt(t_layno)>=1)
						{
							document.getElementById('pre').src='dynamicdata/images/pre.gif'
						}
					if(t_layno==t_layercnt)
					{
						//alert("It is last picture on this page.");
						document.getElementById('nxt').src='dynamicdata/images/nxt1.jpg'
					}
					/* MERA CODE[END]*/
					}
					else
					{
						//alert(layer);
						document.getElementById(layer).style.visibility='visible';
						//alert("It is last picture on this page.");
						
						
					}		
					/*** step3**/
					if(layno==parseInt(LayerCount))
					{		
						
					}
					else
					{
						HideAll(LayerCount);
						if(layno!=null)
						{
							var newlay=layno+1;
							MM_showHideLayers('Layer'+newlay,'','show');
						}
						else
						{
							MM_showHideLayers('Layer2','','show');
						}
					}
		}
		else
		{
			document.getElementById('nxt').src='dynamicdata/images/nxt1.jpg'
			document.getElementById('pre').src='dynamicdata/images/pre1.jpg'
		}
}
function ResetCtrl()
{
	//alert(document.Form1.cnt.value);
	if(document.Form1.cnt.value=="1")
	{
			document.getElementById('nxt').src='dynamicdata/images/nxt1.jpg'
			document.getElementById('pre').src='dynamicdata/images/pre1.jpg'
	}	
	if(document.Form1.cnt.value=="0")
	{
		document.getElementById('pre').style.visibility='hidden';
		document.getElementById('nxt').style.visibility='hidden';
		
	
	}	
}		




