counter=1
darkcolor="#306161"

img0=new Image
img1=new Image
img0.src="images/ball.gif"
img1.src="images/ball1.gif"
function rollon(img)
{
	document[img].src = eval("img" + "1.src");
}
function rolloff(img)
{
	document[img].src = eval("img" + "0.src");
}

function maketoplinks(atitle,apage,alink)
{
document.write("<td bgcolor='"+darkcolor+"' width='130'><a href='template.php?incfile="+apage+"&title="+atitle+"' class='whitelinks'>"+alink+"</a></td>")
}

function puttoplinks()
{
maketoplinks("Home","home.html","Home")
maketoplinks("Find+a+Doctor","search.php","Find a Doctor")
maketoplinks("Queries+to+Doctor","query.php","Queries to Doctors")
maketoplinks("Diet+Recipes","recipes.php","Diet Recipes")
maketoplinks("Old+Queries","oldquery.php","Old Queries")
}

function makelinks(atext,apage,atip,atitle)
{
document.write("<TR><TD><IMG src='images/ball.gif' name='btn"+counter+"'></TD><TD background='images/backbtn.gif' width='130'><a href='template.php?incfile="+apage+"&title="+atitle+"' onmouseover='javascript:rollon(\"btn"+counter+"\")' onmouseout='javascript:rolloff(\"btn"+counter+"\")' class='whitelinks' title='"+atip+"'>&nbsp;"+atext+"</a></TD></TR>")
counter++;
}

function putlinks()
{
makelinks("India Tops","worldtop.html","Go To India Tops The World","India+Tops+The+World")
makelinks("Alternate Medicine","alternate.html","Go To Alternate Medicines Page","Alternate+Medicines")
makelinks("Diabetic Bhoj","bhoj.html","Go To Diabetic Bhoj Page","Diabetic+Bhoj")
makelinks("Diabetic Cure","cure.html","Go To Diabetic Cure Page","Dibetic+Cure")
makelinks("What Is New","newdiab.html","Go To What Is New In Diabetes?","What+Is+New+In+Diabetes?")
makelinks("Diabetes 1997","diab97.html","Go To Diabetes 1997 Page","Diabetes+1997")
makelinks("Exhibitions","diab00.html","Go To Exhibitions Page","Exhibitions")
makelinks("Publications","indbooks.html","Go To Indian Books And Periodicals Page","Indian+Books+And+Periodicals")
makelinks("Code of Conduct","code.html","Go To Code Of Conduct Page","Code+Of+Conduct")
makelinks("Rare Case","jali02.html","Go To Rare Case Of A Baby With Diabetes","Rare+Case+Of+A+Baby+With+Diabetes ")
makelinks("Foot Wear","elite.html","Go To Foot Care and Wear Page","Foot+Care")
}

function makeadvertizements(atxt,apage,atip)
{
document.write("<TR><TD><IMG src='images/ball.gif' name='btn"+counter+"'></TD><TD background='images/backbtn.gif' width='130'><a href='"+apage+"' onmouseover='javascript:rollon(\"btn"+counter+"\")' onmouseout='javascript:rolloff(\"btn"+counter+"\")' class='whitelinks' title='"+atip+"' target='_blank'>&nbsp;"+atxt+"</a></TD></TR>")
counter++;
}

function putadvertizements()
{
makeadvertizements("diabetes.org.in","http://www.diabetes.org.in","Go To www.diabetes.org.in")
makeadvertizements("rssdi.org","http://www.rssdi.org","Go To www.rssdi.org")
}

function contact(contact_flag)
{
document.location.href="template.php?incfile=mail.php&title=Contact+Us&flag="+contact_flag
}
/*
function changepass()
 {
   if(!document.forms[0].id.value="" && !document.forms[0].pwd.value="")
   {
   document.forms[0].action="./inc/changepassword.php";
   //document.forms[0].sumbit();
   }
 else
   alert(" id & Password Should not blank ");
 }*/

function copywrite()
{
document.write ("<TABLE border='0' align='center' bordercolor='#885fff' cellspacing='0' cellpadding='2' bgcolor='" + darkcolor + "' width='100%'><tr><td valign='top' align='center' class='copy'>&copy;2010 Diabetes-India.com is designed and developed by <a href=\"javascript:contact('dnr')\" class='whitelinks' title='Rao PV'>Paturi Vishnupriya Rao</a>. All rights reserved.</font></td></tr></table>")
}

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
}

function validatequery(aform)
{
	if(aform.question.value=="" || aform.question.value==null)
	{
		alert("Enter the question")
		aform.question.focus();
		return false		
	}	
	for(i=0;i<=aform.elements.length,aform.elements[i].type=="text";i++)
		if(aform.elements[i].value=="" || aform.elements[i].value==null)
		{
			alert("Please enter all the fields.\nAll the fields are mandatory.")
			aform.elements[i].focus()
			return false
		}
	return true	
}
