function init() {
	if(ie) {
		try1.onmouseover = hideall;
		try2.onmouseover = hideall;
		tryhelp.onmouseover = hideall;
		tryabout.onmouseover = hideall;
		trycontact.onmouseover = hideall;
	}
	
	if(ns) {
		document.try1.captureEvents(Event.MOUSEDOWN);
		document.try1.onmouseover = hideall;
		document.try2.captureEvents(Event.MOUSEDOWN);
		document.try2.onmouseover = hideall;
		document.tryhelp.captureEvents(Event.MOUSEDOWN);
		document.tryhelp.onmouseover = hideall;
		document.tryabout.captureEvents(Event.MOUSEDOWN);
		document.tryabout.onmouseover = hideall;
		document.trycontact.captureEvents(Event.MOUSEDOWN);
		document.trycontact.onmouseover = hideall;
	}
}


function hideall() {
	if(ie) {
		try1.style.visibility = "hidden";
		try2.style.visibility = "hidden";
		tryhelp.style.visibility = "hidden";
		tryabout.style.visibility = "hidden";
		trycontact.style.visibility = "hidden";
		divhelp.style.visibility = "hidden";
		divabout.style.visibility = "hidden";
		divcontact.style.visibility = "hidden";
//		document.aboutimg.src = aboutn.src;
//		document.helpimg.src = helpn.src;
//		document.contactimg.src = contactn.src;
	}
	if(ns) {
		document.try1.visibility = "hide";
		document.try2.visibility = "hide";
		document.tryhelp.visibility = "hide";
		document.tryabout.visibility = "hide";
		document.trycontact.visibility = "hide";
		document.divhelp.visibility = "hide";
		document.divabout.visibility = "hide";
		document.divcontact.visibility = "hide";
//		document.aboutimg.src = aboutn.src;
//		document.helpimg.src = helpn.src;
//		document.contactimg.src = contactn.src;
	}
}

function showall(disp) {
	hideall();
	if(ie) {
	 eval("div"+disp).style.visibility="visible";
	 eval("try"+disp).style.visibility="visible";
//	 eval("document."+disp+"img").src = eval(disp+"m").src;
	 try1.style.visibility="visible";
	 try2.style.visibility="visible";
	}
	if(ns) {
	 eval("document.div"+disp).visibility="show";
	 eval("document.try"+disp).visibility="show";
//	 eval("document."+disp+"img").src = eval(disp+"m").src;
	 document.try1.visibility="show";
	 document.try2.visibility="show";
	}
}
//function for opening anywindow for size as bookadspace window
//add by sheetal
function winopen2(x,xname)
	{
	window.open(x,xname,"height=362,width=460,left=300,top=50");
	}
function winopen1(x,xname)
	{
	window.open(x,xname,"height=400,width=460,left=300,top=50");
	}
function winopen(x,xname)
	{
	window.open(x,xname,"height=275,width=352,left=300,top=50");
	}

//function for opening the photo gallery window.
//add by preeti
function openPhotoWin(movieid,imgsrc)
	{
	arrtmp=imgsrc.split('/');
	var winpic=window.open("../photopop.aspx?movieid="+movieid+"&imgsrc=" + arrtmp[arrtmp.length-1],"PhotoGal","toolbar=no,left=300,location=no,menubar=no,scrollbars=yes,width=460,height=350,top=50");
	winpic.focus();
	}

//function for opening the subscription window.
//add by shubhangi
function winOpen()
		{
			var win=window.open("subscription/subscribe.aspx","","width=352,height=275,resizable=no,left=300,top=50");
			win.focus();
		}

function allempty(x)
{
//x=document.formname
for(i=0;i<x.elements.length;i++)
			  { 		
					if(x.elements[i].type=="text"||x.elements[i].type=="password")
						{
							if(x.elements[i].value=="")	
							{
							x.elements[i].focus();
							return false;
							}				
						}	
			  }
}
function chkusername(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[0-9a-zA-Z_\-\. ]+/;
	fnameflag=fname.match(regname);	
	if (fnameflag!=fname && fname !="")
	{		
		x.focus();	
		return false;
	}
}
function chktmpname(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[0-9a-zA-Z_\-\.\' ]+/;
	fnameflag=fname.match(regname);	
	if (fnameflag!=fname && fname !="")
	{		
		x.focus();	
		return false;
	}
}
function ratingchk(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[a-zA-Z\/\\ ]+/;
	fnameflag=fname.match(regname);	
	if (fnameflag!=fname && fname !="")
	{		
		x.focus();	
		return false;
	}
}

function dropdownchk(x,y)
{
	if(x.selectedIndex == 0)
	{
		alert("Please select a valid option for "+y);
		x.focus();
		return false;
	}
	return true;
}

function chkemail(x)
{
fmail=x.value;
regmail=/[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9]+\.[a-zA-Z0-9.]+/
fmailflag=fmail.match(regmail)
if (fmailflag!=fmail)
	{
		alert("Please enter a valid E-Mail address.");
		x.select();
		return true;
	 }
	 return false;
	 
}

function chkurl(x)
{
	fmail=x.value;
	regmail=/http:[a-zA-Z0-9_\-\. \/]+\.[a-zA-Z0-9\&\?\-\=\.\/\\]+/
	//regmail=http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
	fmailflag=fmail.match(regmail)
	if (fmailflag!=fmail)
	{
		alert("Invalid URL. Please add http://, www and .com");
		x.focus();
		return false;
	}
	return true;
}
function chknumber(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[0-9]+/;
	fnameflag=fname.match(regname);	
	if (fnameflag!=fname && fname !="")
	{		
		x.focus();	
		return false;
	}
}
function chknum(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[0-9\s\.\(\)]+/;
	fnameflag=fname.match(regname);	
	if (fnameflag!=fname && fname !="")
	{		
		x.focus();
		return false;
	}
	return true;
}
function chkalpha(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[a-zA-Z\s]+/;
	fnameflag=fname.match(regname);
	if (fnameflag!=fname || fname =="")
	{
		x.focus();
		return false;
	}
	return true;
}
function chkcast(x)
{
//x=document.formname.elementname
nname=x.name;
fname=x.value;     
regname=/[&:'-<>()a-zA-Z\,\.\/\\ ]+/;
	fnameflag=fname.match(regname);
	if (fnameflag!=fname || fname =="")
	{
		x.focus();
		return false;
	}
}
function chkempty(x)
{
//x=document.formname.elementname
e=0;
var a=x.value;
if (a=="")
	 {	
	 x.focus();
	 return false; 
   }
}

function chkselect(x)
{
//x=document.formname.selectname x.value=="0"||x.value==0||
if(x.value=="dd"||x.value=="mm"||x.value=="yy"||x.value=="yyyy"||x.value=="-1")
{
x.focus();
return false;
}
}

function trimit(x)
{
//x=document.formname
for(k=0;k<x.elements.length;k++)
			{
					if(x.elements[k].type=="text"||x.elements[k].type=="textarea")
										{
										splitstr=x.elements[k].value.split("");
										var i=0;
										if(splitstr[i]==" ")
										{
										x.elements[k].value=""
										while(splitstr[i]==" ")
										i++;
										for(j=i;j<splitstr.length;j++,i++)
										x.elements[k].value=x.elements[k].value+splitstr[i];
										}
										splitstr=x.elements[k].value.split("");
	
										i=splitstr.length-1
										if(splitstr[i]==" ")
										{
										x.elements[k].value="";
										while(splitstr[i]==" ")
										i--;
										for(j=0;j<=i;j++)
										x.elements[k].value=x.elements[k].value+splitstr[j];
										}
										}
					}
}
function vdatetomm(dd,mm,yy)
{
	var date1=new Date();
	mydd=date1.getDate();
	mymm=date1.getMonth() + 1;
	myyy=date1.getFullYear();
	var mydate= new Date(myyy,mymm,mydd)
	var bdate= new Date(yy,mm,dd)	
	if (mydate>bdate)
	{alert("Select a Date today onwards."); return false;}
}
function vdatetomtod(dd,mm,yy)
{
	var date1=new Date();
	mydd=date1.getDate();
	mymm=date1.getMonth() + 1;
	myyy=date1.getFullYear();
	var mydate= new Date(myyy,mymm,mydd)
	var bdate= new Date(yy,mm,dd)	
	if (mydate>=bdate)
	{alert("Select a Date after today."); return false;}
}
function duration(dd1,mm1,yy1,dd2,mm2,yy2)
{	
	if(mm1<10) mm1="0"+mm1;
	if(dd1<10) dd1="0"+dd1;
	if(mm2<10) mm2="0"+mm2;
	if(dd2<10) dd2="0"+dd2;
	var date1=new Date(mm1+"/"+dd1+"/"+yy1);
	var date2=new Date(mm2+"/"+dd2+"/"+yy2);
	if (date1>date2)
	{alert("Inappropriate Duration"); return false;}
	
}
function vdatebirth(dd,mm,yy)
{
	var date1=new Date();
	mydd=date1.getDate();
	mymm=date1.getMonth() + 1;
	myyy=date1.getFullYear();
	var mydate= new Date(myyy,mymm,mydd)
	var bdate= new Date(yy,mm,dd)
	if (mydate<bdate)
	{
		alert(" The Date should be Todays or Prior to today"); 
		return false;
	}
	return true;
}
function validdate(dd,mm,yy)
{
	
	 if  (((yy % 4 == 0) && (yy % 100 != 0)) || (yy % 400 == 0))
	  {
		  if(mm == 2)
	  	{
				if(dd > 29)
				{
					alert("This is a Leap Year, Select a date upto 29th.");
					return false;
				}
			}
		}
	 else
	  {
			if(mm == 2)
			{
				if(dd > 28)
				{
					alert("Select a date upto 28th for the month of February");
					return false;
				}
			}
	  }
		if(mm == 4 || mm == 6 || mm == 9 || mm == 11)
		{
			if(dd > 30)
			{
				alert("Select date upto 30th for this Month")
				return false;
			}
		}
		return true;
	
}

function chkgroup(x)
{
//x=document.formname.groupname 
count=0;
if(x.length>1) 
{
for(i=0;i<x.length;i++)
				{		
				if(x[i].type=="text") 
									{if(x[i].value=="") count=count+1;}
				if(x[i].type=="hidden") 
									{alert("HIDDEN");}
				else
				{if(x[i].checked==false) count=count+1;}
				}			
if (count==x.length) {return false;}
}
else {if(x.checked==false) return false;}
}

function singleq(x)
{
//x=document.formname
for(k=0;k<x.elements.length;k++)
			{
					if(x.elements[k].type=="text"||x.elements[k].type=="textarea")
						{
							mystr="";
							splitstr=x.elements[k].value.split("");
							for(i=0;i<splitstr.length;i++)
							{							
							if(splitstr[i]=="'") {splitstr[i]="''";}
							mystr=mystr+splitstr[i];
							}
							x.elements[k].value=mystr;
							
						}
			}
}
function isBlank(x,y)
{
	if(x.value=="")
	{
		alert("Field "+y+" cannot be left blank.");
		x.focus();
		return true;		
	}
	return false;
	
}

function numchk(x,y)
{
	var num=/[0-9\.\s]+/;
	uidflag=x.value.match(num);	
	if(uidflag != x.value)
	{
		alert("Please enter numbers only for "+y);
		x.focus();
		x.select();
		return false;
	}
	return true;
}