/*'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
	Page Name: validations.js
	Desc: Javascript validations
	Author: Meenakshi Choudhary
	Date: June 27th 2003
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''*/


function formreset()
{
	theform.reset();
}
	
function empty(object,str)
{
	var value=object.value;
	if (value=="")
	 {
		alert("Please enter the "+str+".");
		object.focus();
		return false;
	 }
	str1=object.value;
	x=0
	for(var i=0;i<str1.length;i++)
	{	
		if (str1.charAt(i)!=" ") { x=1 }
	
	}
	if (x==0)
	{
		alert("Please enter the "+str+".");
		object.value=""
		object.focus();
		return false;
	}
	str1=object.value;
	x=0
	y=0
	len=str1.length;
	for(var i=0;i<str1.length;i++)
	{	
		if ((str1.charAt(i)=="\r") && (str1.charAt(i+1)=="\n")) { y++; }
	
	}
	if (y==(len/2))
	{
		alert("Please enter the "+str+".");
		object.value=""
		object.focus();
		return false;
	}
	
	 return true;
}


function selectbox(object)
{
//var value=object.options[object.selectedIndex].value;
var value=object.value;
if (value=="")
	{
		alert("Please select the domain name.");
		object.focus();
		return false;
	}else return true;
}

function isvalidname(obj,msg)
{
	var chk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-'0123456789. ";
	var str=obj.value;
	var allvalid=1;
	for (i = 0;i<str.length;  i++)
	 {
		ch = str.charAt(i);
		if(chk.indexOf(ch)==-1)
		{
			allvalid=0;
		}	
	}	
  if (allvalid==0)
  {
    alert(msg+" can not have special characters.");
    obj.focus();
	obj.select();
	return false;
  }
return true;
}

function emailcheck(object)
{
	var email=object.value;
	var matcharray=email.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) 
	if(matcharray==null){
	alert("Please enter valid email address.");
	 	object.focus();
		object.select();
	return false;
	}
	else return true
}

function numericcheck(object,str)
{
	var value=object.value;
	if (isNaN(value)==true){
		alert("Please enter numeric values for "+str+".");
	object.focus();
	object.select();
	return false;
	}else return true;
	
}

function usernamecheck(obj)
{
	var chk="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_0123456789.";
	var str=obj.value;
	var allvalid=1;
	for (i = 0;i<str.length;  i++)
	 {
		ch = str.charAt(i);
		if(chk.indexOf(ch)==-1)
		{
			allvalid=0;
		}	
	}	
  if (allvalid==0)
  {
    alert("Please change your username, special characters and spaces are not permitted.");
    obj.focus();
	obj.select();
	return false;
  }
return true;
}


