//darkcolor="#106363";
darkcolor="#c7e2e2";
function registration()
{
aform=document.register
//Personal Details Fields Validation starts here
	if(aform.first_name.value=="" || aform.first_name.value==null)
	{
		alert("Enter your first name")
		aform.first_name.focus()
		return false
	}
	if(aform.last_name.value=="" || aform.last_name.value==null)
	{
		alert("Enter your last name")
		aform.last_name.focus()
		return false
	}
	if(aform.degree.value=="" || aform.degree.value==null)
	{
		alert("Enter your degree")
		aform.degree.focus()
		return false
	}
	if(aform.address.value=="" || aform.address.value==null)
	{
		alert("Enter your address")
		aform.address.focus()
		return false
	}
	if(aform.street.value=="" || aform.street.value==null)
	{
		alert("Enter your street")
		aform.street.focus()
		return false
	}
	if(aform.town.value=="" || aform.town.value==null)
	{
		alert("Enter your city/town")
		aform.town.focus()
		return false
	}
	if(aform.pincode.value=="" || aform.pincode.value==null)
	{
		alert("Enter your city/town pincode")
		aform.pincode.focus()
		return false
	}
	
	if(document.register.email.value.indexOf("@") == "-1" || document.register.email.value.indexOf(".") == "-1")
	{
		alert("Enter valid email address")
		document.register.email.focus()
		document.register.email.select()		
		return false		
	}
	if(aform.state_id[aform.state_id.selectedIndex].value==null || aform.state_id[aform.state_id.selectedIndex].value=="")
	{
		alert("Please select your state")
		aform.state_id.focus()
		return false
	}
//Login Details Fields Validation starts here
	if(aform.login.value=="" || aform.login.value==null)
	{
		alert("Enter your login name")
		aform.login.focus()
		return false
	}
	if(aform.password.value=="" || aform.password.value==null)
	{
		alert("Enter a password")
		aform.password.focus()
		return false
	}
	if(aform.cpassword.value=="" || aform.cpassword.value==null)
	{
		alert("Confirm your password")
		aform.cpassword.focus()
		return false
	}
	if(aform.password.value!=aform.cpassword.value)
	{
		alert("Your password and confirm password does not match")
		aform.password.select()
		aform.cpassword.value=""
		return false
	}
	if(aform.secret_question.value=="" || aform.secret_question.value==null)
	{
		alert("Enter your secret question.\nThe secret question should be such as \n1)what is my vehicle number?\n2)What is my pet name?. etc\nWhich can be easily memorised.\nThis is used in case you forget your password")
		aform.secret_question.focus()
		return false
	}
	if(aform.secret_answer.value=="" || aform.secret_answer.value==null)
	{
		alert("Enter your secret answer.\nThe secret answer will be the answer for the above secret question which you only know.\nThis is used in case you forget your password")
		aform.secret_answer.focus()
		return false
	}
return true	
}

function validate_login()
{
	aform=document.login
	if(aform.login_name.value=='' || aform.login_name.value==null)
	{
		alert("Enter your login name")
		aform.login_name.focus()
		return false
	}
	else if(aform.login_password.value=='' || aform.login_password.value==null)
	{
		alert("Enter your login password")
		aform.login_password.focus()
		return false	
	}
	return true	
}

function validate_password_lost()
{
	if(document.login.login_name.value=='' || document.login.login_name.value==null)
	{
		alert("Enter your login name and click on \"Forgot my password help me\" link")
		document.login.login_name.focus()
	}
	else
	location.href="template.php?incfile=login.php&title=Lost+Password&page=lost&login_name=" + document.login.login_name.value
}

function validatemail()
{
	if(document.sendmail.subject.value=="" || document.sendmail.subject.value==null)
	{
		alert("Please enter the subject of the mail")
		return false
	}	
	else if(document.sendmail.from.value=="" || document.sendmail.from.value==null)
	{
		alert("Enter email address from")
		document.sendmail.from.focus()
		return false
	}	
	else if(document.sendmail.from.value.indexOf("@") == "-1" || document.sendmail.from.value.indexOf(".") == "-1")
	{
		alert("Enter valid email address from")
		document.sendmail.from.focus()
		document.sendmail.from.select()		
		return false		
	}

	else if(document.sendmail.msg_text.value=="" || document.sendmail.msg_text.value==null)
	{
		alert("Enter the message")
		document.sendmail.msg_text.focus()		
		return false
	}
	return true
}

img0=new Image
img1=new Image
img0.src="img/pt0.gif"
img1.src="img/pt1.gif"
function rollon(img){
document[img].src = eval("img" + "1.src");
}
function rolloff(img){
document[img].src = eval("img" + "0.src");
}
var count=1;
function links(atitle,apage,atxt){
document.write("<tr>\n<th height='26'><img src='img/pt0.gif' name='btn" + count + "'></th>\n<TD background='img/btn.gif' width='120' height='25'>\n&nbsp;&nbsp;&nbsp;<A href='" + apage + "' onmouseover=\"rollon('btn" + count + "')\" onmouseout=\"rolloff('btn" + count + "')\"' title='" + atxt + "' class='white'>" + atitle + "</A>\n</TD>\n</tr>\n")
count++
}

function putleft(){
links("Home","template.php?incfile=home.html&title=Home","Go To Home Page")
links("Login","template.php?incfile=login.php&title=Login&page=default","Go To Login Page")
links("Register","template.php?incfile=register.php&title=Registration&page=default","Go To Registration Page")
links("People Behind","template.php?incfile=peoplebehind.html&title=People+Behind","Go To People Behind Page")
//links("CME News","template.php?incfile=cmenews.html&title=CME+News","Go To CME News Page")
links("Source Books","template.php?incfile=books.html&title=Books","Go To Books Page")
links("Help","template.php?incfile=help.html&title=Help","Go To Help Page")
links("diabetes.org.in","http://diabetes.org.in' target='_blank'","Go To diabetes.org.in website")
links("rssdi.com","http://www.rssdi.com' target='_blank'","Go To RSSDI website")
}

function contact(contact_flag)
{
	document.location.href="template.php?incfile=mail.php&title=Contact+Us&flag="+contact_flag
}

function copyright(){
     document.write("<table border=0 bordercolor=blue align='center' bgcolor='"+darkcolor+"' width='100%' cellpadding='6' cellspacing='0'><tr><td align='center'>{ <a href='template.php?incfile=home.html&title=Home' class='white'>Home</a> | <a href='template.php?incfile=login.php&title=Login&page=default' class='white'>Login</a> | <a href='template.php?incfile=register.php&title=Registration&page=default' class='white'>Register</a> | <a href='template.php?incfile=peoplebehind.html&title=People+Behind' class='white'>People Behind</a> | <a href='template.php?incfile=books.html&title=Books' class='white'>Source Books</a> | <a href='template.php?incfile=help.html&title=Help' class='white'>Help</a> | <a href='template.php?incfile=admin.php&title=Admin+Area' class='white'>Admin Area</a> }</td></tr><tr><td valign=top align=center class='copy'>&copy; 2003 WebCME is designed and developed by <a href=\"javascript:contact('dnr')\" class='white'>Paturi Vishnupriya Rao</a>. All rights reserved.</td></tr></table>");
}

