// JavaScript Document
function registerchecking(Myform)
{

	if(Myform.username.value=="")
	{
		alert("User name cannot be empty")
		Myform.username.focus();
		return false;
		
	}
	else
	{
		if(!isValidStr(Myform.username.value))
		{
			alert("User name contain space or special character: < >  \ / | * $ ' * # % ( ) @ \" ");
			Myform.username.select();
			return false;
		}
	}
	if(Myform.password.value=="")
	{
		alert("Password cannot be empty")
		Myform.password.focus();
		return false;

	}
	else
	{
		if(!isValidStr(Myform.password.value))
		{
			alert("Password contain space or special character: < >  \ / | * $ ' * # % ( ) @ \" ");
			Myform.password.select();
			return false;
		}
	}
	if(Myform.email.value=="")
	{
		alert("Email cannot be empty")
		Myform.email.focus();
		return false;

	}
	else{
		if(!checkMail(Myform.email.value)){
			alert("Please insert valid email")
			Myform.email.select();
			 return false;
		}
	}
}
function checkMail(str)
{
	var x = str
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;

}
function isValidStr(str)
{
	var invalidChar = /[<>"'|*#%* ()@$]/
	var found = invalidChar.test(str);
	return !found;
}
function open_window(win_name,the_url, args)
{
  if (args == null)
     window.open(the_url,win_name,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=300')
  else
     window.open(the_url,win_name,args)
}
function alertmsg(str)
{
	var temp = document.createElement('div')
	temp.innerHTML =str;
	alert(temp.innerHTML)
}
function hideads(sec)
{
  setTimeout("hidenow()",sec);
}
function hidenow()
{
	ads1.style.display="none";
	ads2.style.display="block";
}