function AllCheck(str,dot)
		{
		CountSt = new Number(0)
		Newstr	=	new String("")
		var proceed = new Boolean(false)
		proceed	= false;
		i   = new Number(0);
		while((i<str.length))
			{
			if(((str.charAt(i)>='A' && str.charAt(i)<='Z') ||(str.charAt(i)>='a' && str.charAt(i)<='z') || (str.charAt(i)>='0' && str.charAt(i)<='9')))
				{
				Newstr=Newstr+str.charAt(i);
				if(proceed==false)
				{
					CountSt++
					proceed=true;
				}
			}
			else
				if(dot)
					{
					//	(str.charAt(i)=='.') ||(str.charAt(i)=='-')||
					if((str.charAt(i)=='_'))
						{
						Newstr=Newstr+str.charAt(i);
						if(proceed==false)
						{
							CountSt++
							proceed=true;
						}	
					}
					else proceed=false;
				}
				else proceed=false //if(str.charAt(i)==' ') 
			i++
		}
		if((CountSt==1) && (Newstr.length==str.length))
		{
			return true;
		}
		else return false
	}

function chkValidDate(valday,valmonth,valyear)
{
	
	//alert('Entered Day ' + valday);
	//alert('Entered Month ' + valmonth);
	//alert('Entered Year ' + valyear);

	//alert(IsNumeric(valday));
	//alert(IsNumeric(valmonth));
	//alert(IsNumeric(valyear));

	if(IsNumeric(valday) && IsNumeric(valmonth) && IsNumeric(valyear))
		{
			var strMonDays='0,31,28,31,30,31,30,31,31,30,31,30,31';
			var ArrMonDays = strMonDays.split(',');
			if(((valyear)%4==0) && (valmonth==2)) //Leap Year Feb
				{
				if(!(valday <= 29))
					{
					return false;
					}
				}
			else
				{
				if(!(valday <= ArrMonDays[valmonth]))
					{
					return false;
					}
				}
			return true;
		}
	else
		{
			return false;
		}
}

function chkPastDate(valday,valmonth,valyear)
{
	var DtCurrDate = new Date();	//Get Current Date
	var intCurrDay = DtCurrDate.getDate();
	var intCurrMonth = DtCurrDate.getMonth() + 1;//Shows 0-11 months hence add 1 to get Normal Months
	var intCurrYr = DtCurrDate.getFullYear(); // fullYear is four digit Year

	//alert('Current Day ' + intCurrDay);
	//alert('Current Month ' + intCurrMonth);
	//alert('Current Year ' + intCurrYr);
	
	//alert('Entered Day ' + valday);
	//alert('Entered Month ' + valmonth);
	//alert('Entered Year ' + valyear);

		if(valyear < intCurrYr)
			{
			return(false);
			}
		else if(valyear == intCurrYr)
				{
					if(valmonth < intCurrMonth)
						{
						return(false);
						}
					else if(valmonth == intCurrMonth)
							{
								if(valday < intCurrDay)
									{
									return(false);
									}
								else
								 	{
									return(true);
									}
							}
					else	//Entered Month > Current Month and Current Year = Entered Year, hence future date
						{
						return(true);
						}
				}	
		else	//Entered Year > Current Year, So Future Date
		 	{
			return(true);
			}
}

function validemail(email) 
{
	invalidChars = " /:"
	if (email == "")
	{
		return (false);
	}
	for (i=0; i < invalidChars.length; i++) 
	{
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar,0) != -1) 
		{
			return (false);
		}
	}
	atPos = email.indexOf("@", 1)
	if (atPos == -1) 
	{
		return (false);
	}
	periodPos = email.indexOf(".", atPos)
	if (periodPos == -1) 
	{
		return (false);
	}
	if (periodPos + 3 > email.length) 
	{
		return (false);
	}
	return (true);
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
   }


function val_check(txt,msg,ChkTypNum)
{
//alert(ChkTypNum);
   var txt1=txt;
   if(ChkTypNum==0)//for empty Check
	{
		if(txt1.value=="")
		{
			alert(msg);
			txt1.focus();
			return false;
		}
	}
   else if(ChkTypNum==1) //for empty and only numeric Check
	{
		if(txt1.value=="")
		{	
			alert(msg);
			txt1.focus();
			return false;
		}
		else
		{
		var n=parseInt(txt1.value.length);
    			for(i=0;i<n;i++)
			{
			var s=txt1.value.substring(i,i+1);
			//alert(s);
			if(!(s>="0" && s<="9"))
				{
				if(!(s=="."))
					{
					alert('Invalid Number');
					txt1.focus();
					return(false);
					}
				}
			}
		}
	}
   else if(ChkTypNum==2) //for empty and Check for no alphabet (e.g. Tel)
	{
		if(txt1.value=="")
		{	
			alert(msg);
			txt1.focus();
			return false;
		}
		else
		{
    			var n1=parseInt(txt1.value.length);
    			for(i=0;i<n1;i++)
			{
			var s=txt1.value.substring(i,i+2);
			if((s>="A" && s<="Z")||(s>="a" && s<="z"))
				{
				alert('Invalid Number!');
				txt1.focus();
				return(false);
				}
			}
		}
	}
   else if(ChkTypNum==3) //for empty and alphabet only Check (e.g. Name of the Person)
	{
		if(txt1.value=="")
		{	
			alert(msg);
			txt1.focus();
			return false;
		}
		else
		{
    			var n2=parseInt(txt1.value.length);
    			for(i=0;i<n2;i++)
			{
			var s=txt1.value.substring(i,i+1);
			if(s>="0" && s<="9")
				{
				alert('Invalid Text Numeric Present!');
				txt1.focus();
				return(false);
				}
			}
		}
	}
   else if(ChkTypNum==4) //for empty and Email Check
	{
		if(txt1.value=="")
		{	
			alert(msg);
			txt1.focus();
			return false;
		}
		else
		{
			if(!(validemail(txt1.value)))
			{
				alert('Invalid Email!');
				txt1.focus();
				return false;
			}
		}
	}
   return true;   
}


function winOpen(href, target, width, height) 
{
	var openWin;
	if (openWin && !openWin.closed) 
		{
			openWin.close();
		}
	openWin = window.open(href, target, 'width=' + width + ',height=' + height);
}
				

function WinRefreshOpener()
{
	window.opener.location.reload();
	window.close();
}

function MoveCenter(strheight,strwidth)
{
	var intScrH;
	var intScrW;
	intScrH=screen.availHeight;
	intScrW=screen.availWidth;
	intScrH=((parseFloat(intScrH)/2)-(parseFloat(strheight)/2));
	intScrW=((parseFloat(intScrW)/2)-(parseFloat(strwidth)/2));
	self.moveTo(intScrW,intScrH);
}

function ScrNL_chk(formName)
{
	if(val_check(formName.txtScrNLEmail,"Please Enter Your Email to Subscribe Newsletters",4)==false)
	{
		return false;
	}
   return true;
}