function msgBox(msg)
{
	alert(msg);
}

////////////////////////////////

function clearit(obj)
{
	if(obj.defaultValue==obj.value)
	obj.value="";
}

function chkval(obj)
{
	if(trim(obj.value)=="")
	obj.value=obj.defaultValue;
}

/////////////////////////

function numchk(e)
{
	
var keynum;
var keychar;
var numcheck;

if(window.event) // IE
  {
  keynum = e.keyCode;
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which;
  }
  if(keynum>31 && keynum<48 || keynum>57 )
return false;
else
return true;

}

////////////////////////////////////////////////////////////////
function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

// Removes ending whitespaces
function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

// Removes leading and ending whitespaces
function trim( value ) {
	
	return LTrim(RTrim(value));
	
}


function chkempty(object)
{
	if(trim(object.value)=="" || object.defaultValue==object.value)
	{
		object.style.backgroundColor = '#FFDFE0';
		object.focus();
		return false;
	}
	else
	{
		object.style.backgroundColor='White';
		return true;
	}
}


///////////////////////////////////////////////////
function chkempty1(object)
{
	if(trim(object.value)=="")
	{
		object.style.backgroundColor = '#FFDFE0';
		object.focus();
		return false;
	}
	else
	{
		object.style.backgroundColor='White';
		return true;
	}
}


///////////////////////////////////////////////////

function comp(obj)
{
		vresult=passcomp(obj.Password1,obj.Password2);
		if(obj.Password1.value=='' && obj.Password2.value=='')
{		obj.Password1.style.backgroundColor="#FFFFFF";
		obj.Password2.style.backgroundColor="#FFFFFF";
		document.getElementById("confirm_pass").innerHTML='';
		
}
		return vresult;
}

////////////////////////////////////////////////////////////

function chkemail(object)
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if(filter.test(object.value)){
	object.style.backgroundColor = 'White';
	object.focus();
	return true;
	}
	else{
			object.style.backgroundColor='#FFDFE0';
		return false;
	}
}

/////////////////////////////////////////////////////////////

function nlechk(obj)
{
	vresult=chkemail(obj.Email);
	
	if(vresult)
	{
		var uname=prompt("Please Enter Your Name","");
		if(uname)
		vresult=true;
		else
		vresult=false
	}
	
	if(!vresult)
	{
	alert("Enter Correct Email Address");
	return false;
	}
	
	
	$.post("nlesubmit.php", { Email: obj.Email.value, Name: uname }, function(response)
	  		{
				$('#email_sub_tr').show('Slow');
				$('#email_sub_msg').html(response);
				setTimeout('$("#email_sub_tr").hide("Slow")',3000);
			});
	return false;
	
}

///////////////////////////////////////////////////////////

function send_friend_frmchk(obj)
{
		
	vresult=chkemail(obj.Email);
	vresult=vresult&chkempty(obj.Name);
	vresult=vresult&chkemail(obj.FriendsEmail);
	vresult=vresult&chkempty(obj.FriendsName);

	if(vresult==false)
	{
	alert("Enter Information in Highlighted fields");
	return false;
	}
	return true;
	
}

function sendregfrmchk(obj)
{
		
	vresult=chkemail(obj.Email);
	vresult=vresult&chkempty(obj.First_Name);
	vresult=vresult&chkemail(obj.Phone);


	if(vresult==false)
	{
	alert("Enter Information in Highlighted fields");
	return false;
	}
	else
	{
		obj.result.value=true;
	return true;
	}
	
}