function MenuBuild(section,displayText,linkUrl)
{
	this.section = section;
	this.displayText = displayText;
	this.linkUrl = linkUrl;
}

var mainMenu = new Array(7);
var subMenu = new Array();

mainMenu[0] = new MenuBuild("Home","Home","/");
mainMenu[1] = new MenuBuild("Bab","Bab - Life & Times","/bab.html");
mainMenu[2] = new MenuBuild("Beliefs","Bahai Teachings","/bahai02.html");
mainMenu[3] = new MenuBuild("Bbooks","Bahai Books","/books.html");
mainMenu[4] = new MenuBuild("Bsects","Bahai Sects","/sects.html");
mainMenu[5] = new MenuBuild("Prophethood","Prophethood","/kn.html");
mainMenu[6] = new MenuBuild("Qiyamat","Day of Judgement","/qiyamat.html");
mainMenu[7] = new MenuBuild("Shiah","Shiah Viewpoint","/shiah01.html");

function callHeaders(headerName)
{
	var dataTxt = ""
	
	for(i=0; i < mainMenu.length; i++)
	{
		if(mainMenu[i].section == headerName)
		{
			bgcolor = " bgcolor=#cc0000"
		}
		else
		{
			bgcolor = ""
		}
	
		if(i==0)
		{
		dataTxt = "<table border=0 cellpadding=0 cellspacing=0 width=760 align=center background='/subnav-bg.gif'><tr><td><table border=0 cellpadding=0 cellspacing=4><tr valign=middle height=20>";
		dataTxt += "<td align=center"+bgcolor+"><font class='headerfont'><b>&nbsp;<a href='"+mainMenu[i].linkUrl+"' class='headerFont'>"+mainMenu[i].displayText+"</a>&nbsp;</b></font></td>";
		}
		else
		{
		dataTxt += "<td align=center width=1 bgcolor=white></td><td align=center"+bgcolor+"><font class='headerFont'><b>&nbsp;<a href='"+mainMenu[i].linkUrl+"' class='headerFont'>"+mainMenu[i].displayText+"</a></td>";
		}
	}
	dataTxt += "</tr></table></td></tr></table>"
	document.write(dataTxt);

}

function topBand()
{
	document.write('<table border=0 cellpadding=0 cellspacing=0 width=760 align=center background=/bluebground.jpg>');
	document.write('<tr><td width=580><img src="/title.gif" width=311 align=left></td>');
	document.write('<td width=180>');
	document.write('<!-- Site search from Google -->');
	document.write('<table cellpadding=0 cellspacing=0 width=100% border=0>');
	document.write('<form action="http://www.google.com/cse" id="cse-search-box">');
	document.write('<input type="hidden" name="cx" value="002718603593732250350:tvyscotnojq" />');
	document.write('<input type="hidden" name="ie" value="UTF-8" />');
	document.write('<tr><td><font class="headerFont"><b>Search this web site</b></font></td></tr>');
	document.write('<tr><td height=2></td></tr>');
	document.write('<tr valign=middle height=25><td><input type="text" name="q" size="17" /><input type="submit" name="sa" value="Go" /></td></tr>');
	document.write('<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=en"></script>');
	document.write('<tr><td><font class="headerFont""><b><a href="whatsnew.html" style="color:white">What\'s New</a> | <a href="feedback.html" style="color:white">Feedback?</a></td></tr>');
	document.write('</form></table>');
	document.write('<!-- Site Search from Google -->');
	document.write('</td></tr>');
	document.write('<tr><td colspan=2 height=1 bgcolor=#4a7dca></td></tr>');
	document.write('</table>');
}


function callSubHeaders()
{

	document.write('<table width=760 align=center background="greenbground.jpg" cellpadding=0 cellspacing=0>');
	document.write('<tr height=22>');
	document.write('<td width=10%><font class="subheaderFont"><b>&nbsp;&nbsp;Also Read:</td>');
	document.write('<td width=22%><font class="subheaderFontw">&nbsp;&#187;&nbsp;</font><a href="/introurdu.html" class="subheaderFont" target="new">Now available in Urdu!</a></td>');
	document.write('<td width=22%><font class="subheaderFontr">&nbsp;&#187;&nbsp;</font><a href="/fatwas.html" class="subheaderFontr">Fatwas For Bahais (NEW)</a></td>');
	document.write('<td width=22%><font class="subheaderFontw">&nbsp;&#187;&nbsp;</font><a href="/kayhan.html" class="subheaderFont">Articles from Kayhan</a></td>');
	document.write('<td width=24%><font class="subheaderFontw">&nbsp;&#187;&nbsp;</font><a href="/belief.html" class="subheaderFont">The Importance of Belief</a></td>');
	document.write('</tr>');
	document.write('</table>');
}

function bottom()
{

	document.write("<table width=760 cellpadding=0 cellspacing=0 border=0 align=center>");
	document.write("<tr valign=middle><td background=bluebground.jpg height=20 align=center><b><font style='font-family:arial; font-size:8pt;color:white'><a href='readers.html' class='bottomFont'>THE READER'S VIEW</a> | <a href='feedback.html' class='bottomFont'>FEEDBACK</a> | <a href='javascript:window.history.back()' class='bottomFont'>BACK</a> | <a href='/' class='bottomFont'>HOME</a></td></tr>");
	document.write("</table>");
}

function bottomhp()
{

	document.write("<table width=760 cellpadding=0 cellspacing=0 border=0 align=center>");
	document.write("<tr valign=middle><td background=bluebground.jpg height=20 align=center><b><font style='font-family:arial; font-size:8pt;color:white'><a href='readers.html' class='bottomFont'>THE READER'S VIEW</a> | <a href='feedback.html' class='bottomFont'>FEEDBACK</a></td></tr>");
	document.write("</table>");
}

function bottompr()
{

	document.write("<table width=760 cellpadding=4 cellspacing=0 border=0 align=center>");
	document.write("<tr align=center><td style='border-top:1px solid #000000'><b><font style='font-family:arial; font-size:8pt;color:black'>&copy; BahaiAwareness.com</td></tr>");
	document.write("</table>");
}


function feedbackBox()
{
	document.write('<!--feedback start-->')
	document.write('<a name=feedback><p><table cellspacing=1 cellpadding=4 border=0 bgcolor=#bbbbbb align=center>')
	document.write('<tr bgcolor=eeeeee><td>')
	document.write('<table cellspacing=1 cellpadding=0 align=center border=0><form name="ba" method="post" action="./mailform.php">')
	document.write('<input type="hidden" name="subject" value="'+docTitle+'">')
	document.write('<input type="hidden" name="url" value="/'+Plink+'.html">')
	document.write('<tr><td colspan=4><font style="font-family:arial; font-size:9pt;color:000000"><b>Send in your feedback!</td></tr>')
	document.write('<tr><td colspan=4 bgcolor=#bbbbbb height=1></td></tr>')
	document.write('<tr><td><font style="font-family:arial; font-size:9pt">Name: </td><td><input type="text" name="name" onFocus="javascript:window.document.ba.name.select();" size="21"></td>')
	document.write('<td><font style="font-family:arial; font-size:9pt">E-mail: </td><td><input type="text" name="email" onFocus="javascript:window.document.ba.email.select();" size="21"></td></tr>')
	document.write('<tr valign=top><td><font style="font-family:arial; font-size:9pt">Comments: </td><td colspan=3><textarea name="feedback" rows="5" cols="45"></textarea></td></tr>')
	document.write('<tr><td colspan=3><i><font style="font-family:arial; font-size:9pt">You can also write to me at <a href="mailto:imranshaykh@gmail.com" style="color:#000088">imranshaykh@gmail.com</a></td><td align=right>')
	document.write('<input type="button" value="Go!" style="font-family:arial; font-size:9pt" onClick="java'+'script:baSubmit();"> <input type="reset" value="Reset" style="font-family:arial; font-size:9pt"></td></tr>')
	document.write('</form>')
	document.write('</table>')
	document.write('</td></tr></table>')
	document.write('<!--feedback end-->')
}

function isEmail(emailStr)
{
	var a = emailStr;
	check1 = emailStr.length;
	check2 = emailStr.indexOf("@");
	check5 = emailStr.indexOf("bahaiawareness.com");
	check3 = emailStr.indexOf(".");
	check4 = emailStr.lastIndexOf(".");
	if(check5 == -1 && check1 != 0 && check2 != -1 && check3 != -1 && check2 != 0 && check3 !=0 && check2 != a.length-1 && check3 != a.length-1 && check4 > check2 && check4 < a.length-1)
		return true;
	else
		return false;
}
function trimSpace(x)
{
	var emptySpace = / /g;
	var trimAfter = x.replace(emptySpace,"");
	return(trimAfter);
}
function doPost()
{
	if(document.all)
	{
		submissionForm = document.ba;
	}
	if(document.layers)
	{
		submissionForm = document.Layer1.document.ba;
	}
	submissionForm.submit();
}
function baSubmit()
{
	f = window.document.ba;

    if(trimSpace(f.name.value).length == 0)
    {
		alert("Please enter your name.");
		f.name.value = "";
		f.name.focus();
		return false;
    }

	if(!isEmail(f.email.value))
    {
		alert("Please give your Email id ");
		f.email.select();
		f.email.focus();
		return false;
    }
    comm = f.feedback.value;
    if(trimSpace(comm).length == 0)
    {
		alert("Please enter your comments.");
		f.feedback.value = "";
		f.feedback.focus();
		return false;
    }

    doPost();
}
