var highlightcolor="#FFFFFF"
var ns6=document.getElementById&&!document.all
var previous=''
var eventobj
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

function checkel(which)
{
	if (which.style&&intended.test(which.tagName))
	{
		if (ns6&&eventobj.nodeType==3)
			eventobj=eventobj.parentNode.parentNode
		return true
	}
	else
		return false
}

function highlight(e)
{
eventobj=ns6? e.target : event.srcElement
	if (previous!='')
	{
		if (checkel(previous))
			previous.style.backgroundColor=''
		previous=eventobj
		if (checkel(eventobj))
			eventobj.style.backgroundColor=highlightcolor
	}
	else
	{
		if (checkel(eventobj))
			eventobj.style.backgroundColor=highlightcolor
		previous=eventobj
	}
}

function check_email(Email) // check for Email field
{
if (Email.length >0 )
	{
	var i   = Email.indexOf("@")
	var j   = Email.indexOf(".",i)
	var k   = Email.indexOf(",")
	var kk  = Email.indexOf(" ")
	var jj  = Email.lastIndexOf(".") + 1
	var len = Email.length

	if (!(i > 0 && j > (i + 1) && k == -1 && kk == -1 && (len - jj) >= 2 && (len - jj) <= 3))
		return false;
	}
else
	return false;

return true;
}

function check_field(str)    // check for an empty field
{
  if (str=="" || str=="null" ||  str.length==0)
    return false;
  else
    return true;
}

function club()  
{
user_mail=document.home_p.user_mail.value
	
if(!check_field(user_mail))
	document.home_p.mail_check.value="not_fill"
else if(!check_email(user_mail))
	document.home_p.mail_check.value="format"
else 
	document.home_p.mail_check.value="pass"

	
home_p.action ="club.asp"
home_p.method="post"
home_p.submit()
}



function recomend()    // check for an empty field
{
friend_mail=document.home_p.freind_name.value
	
if(!check_field(friend_mail))
	document.home_p.recomend_check.value="not_fill"
else if(!check_email(friend_mail))
	document.home_p.recomend_check.value="format"
else 
	document.home_p.recomend_check.value="pass"

	
home_p.action ="recomend.asp"
home_p.method="post"
home_p.submit()
}




