/*
+--------------------------------------------------------------------+
|                                                                    |
|  Website     : Amirthalingam Website                               |
|  File Name   : content.js                                          |
|  Type        : JavaScript Script File                              |
|  Description : Content Generating JavaScript Functions             |
|  Author      : Srinivasan A. Paul Joseph                           |
|  Created On  : May 10, 2005                                        |
|  Updated On  : May 10, 2005                                        |
|  Version     : 1.0.0                                               |
|                                                                    |
|  Copyright � 2004, TinyDOT Pvt. Ltd.                               |
|  All Rights Reserved.                                              |
|                                                                    |
|  Version History                                                   |
|  ^^^^^^^^^^^^^^^                                                   |
|  1.0.0 - Initial Write up of the Functions.                        |
|                                                                    |
+--------------------------------------------------------------------+
*/

/*********************************************************************
 * Description : Global Variables                                    *
 *********************************************************************/
var arrMons = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var arrDays = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");

var arrTTMenu = new Array(
	new Array("Kjy; gf;fk;", "index.html", 80, new Array(
		new Array(1, 101),
		new Array("mwpKfk;", "index.html")
		)
	),
	new Array("tho;f;if tuyhW", "t_history1.html", 120, new Array(
		new Array(85, 101),
		new Array("rpW Fwpg;G", "t_history1.html"),
		new Array("KOf; Fwpg;G", "t_history2.html")
		)
	),
	new Array("kw;wth;fspd; ghh;itapy;", "t_views1.html", 160, new Array(
		new Array(210, 101),
		new Array("je;ij nry;th", "t_views1.html"),
		new Array("K. fUzhepjp", "t_views2.html"),
		new Array("kq;ifah;f;furp", "t_views3.html"),
		new Array(",uhrhuhk;", "t_views4.html"),
		new Array("Nrdhjpuhrh", "t_views5.html"),
		new Array("Mde;j rq;fup", "t_views6.html"),
		new Array("Fkup mde;jd;", "t_views7.html"),
		new Array("tPukzp", "t_views8.html"),
		new Array("jpfk;guypq;fk;", "t_views9.html"),
		new Array("khyp", "t_views10.html")
		)
	),
	new Array("Gifg;glj; njhFg;G", "photo_album.php?lang=tam&photo=1", 130, new Array(
		new Array("=", "=")
		)
	),
	new Array("ftpijfs;", "t_poem1.html", 70, new Array(
		new Array(510, 101),
		new Array("caph; vOj;J", "t_poem1.html"),
		new Array("vij vOj?", "t_poem2.html"),
		new Array("epiyj;j Gfo;", "t_poem3.html"),
		new Array("gpujpepjp", "t_poem4.html"),
		new Array("vq;Nf?", "t_poem5.html")
		)
	),
	new Array("Gj;jfq;fs;", "t_books1.html", 70, new Array(
		new Array(585, 101),
		new Array("xspapy; vOJjy;", "t_books1.html"),
		new Array("tuyhw;wpd; kdpjd;", "t_books2.html"),
		new Array(",yl;rpa ,jaq;fNshL...", "t_books3.html"),
		new Array("<font face='arial'>The Murder of a Moderate</font>", "t_books4.html")
		)
	),
	new Array("njhlh;G nfhs;s...", "t_contact1.html", 0, new Array(
		new Array(640, 101),
		new Array("epWtzj; njhlh;G", "t_contact1.html"),
		new Array("Mf;fpNahh; njhlh;G", "t_contact2.html"),
		new Array("cq;fs; fUj;Jf;fs;", "t_contact3.php")
		)
	)
);

var arrETMenu = new Array(
	new Array("Home", "e_index.html", 90, new Array(
		new Array(1, 101),
		new Array("Introduction", "e_index.html")
		)
	),
	new Array("History", "e_history1.html", 110, new Array(
		new Array(95, 101),
		new Array("Brief History", "e_history1.html")
		)
	),
	new Array("Testimonials", "e_message1.html", 150, new Array(
		new Array(210, 101),
		new Array("Personal Messages", "e_message1.html"),
		new Array("Articles", "e_article1.html"),
		new Array("Interviews", "e_interview1.html"),
		new Array("Press Clippings", "e_press1.html")
		)
	),
	new Array("Photo Album", "photo_album.php?lang=eng&photo=1", 150, new Array(
		new Array("=", "=")
		)
	),
	new Array("Books", "e_books1.html", 110, new Array(
		new Array(520, 101),
		new Array("The Murder of a Moderate", "e_books1.html"),
		new Array("<font face='bamini'>xspapy; vOJjy;</font>", "e_books2.html"),
		new Array("<font face='bamini'>tuyhw;wpd; kdpjd;</font>", "e_books3.html"),
		new Array("<font face='bamini'>,yl;rpa ,jaq;fNshL...</font>", "e_books4.html")
		)
	),
	new Array("Contact Us...", "e_contact1.html", 0, new Array(
		new Array(621, 101),
		new Array("Organisation Contact", "e_contact1.html"),
		new Array("Web Developer Contact", "e_contact2.html"),
		new Array("Your Feedback", "e_contact3.php")
		)
	)
);

/*********************************************************************
 * Function    : WriteTopBar(pgTitle,pgLang)                         *
 * Description : Writes the Top Bar of the Page                      *
 * Arguments   : pgTitle - Title of the Page that needs Top Bar      *
 *             : pgLang  - Language of the Page that needs Top Bar   *
 *********************************************************************/
function WriteTopBar(pgTitle,pgLang)
{
	var chrLang=((pgLang==0)?"t":"e");
	
	document.write("<table border=0 width=100% height=80 cellpadding=0 cellspacing=0 class=tblTrans>");
	document.write("<tr><td><img src='images/"+chrLang+"tb_"+pgTitle+"_1.jpg' border=0></td>");
	document.write("<td><img src='images/"+chrLang+"tb_"+pgTitle+"_2.jpg' border=0></td>");
	document.write("<td><img src='images/"+chrLang+"tb_right.jpg' border=0></td></tr>");
	document.write("</table>");
	document.write("<div nowrap onClick=\"LoadURL('downloads.html');\" style={font-family:Arial;font-size:10pt;color:blue;position:absolute;left:560px;top:5px;cursor:pointer;cursor:hand;}><b>Can't view in Tamil? Click Here</b></div>");
	if(pgLang==0)
		document.write("<div nowrap onClick=\"LoadURL('e_index.html');\" style={font-family:Arial;font-size:10pt;font-weight:bold;color:darkgreen;position:absolute;left:560px;top:32px;cursor:pointer;cursor:hand;}>English Version Website</div>");
	else
		document.write("<div nowrap onClick=\"LoadURL('index.html');\" style={font-family:Arial;font-size:10pt;font-weight:bold;color:darkgreen;position:absolute;left:560px;top:32px;cursor:pointer;cursor:hand;}>Tamil Version Website</div>");
	document.write("<div nowrap id='divDT' style={font-family:Arial;font-size:10pt;font-weight:bold;color:darkred;position:absolute;left:560px;top:60px;}></div>");
	ShowDT();
}

/*********************************************************************
 * Function    : WriteFooter(pgLang)                                 *
 * Description : Writes the Footer of the Page                       *
 * Arguments   : pgLang - Language of the Page that needs Footer     *
 *********************************************************************/
function WriteFooter(pgLang)
{
	var curDT=new Date();
	
	if(pgLang==0)
	{
		document.write("<hr width=80%>");
		document.write("<div align=center style={font-size:10pt;}>fhg;Gupik <font face='arial'>&copy;</font> 2000 - "+curDT.getFullYear()+"> <b>m. mkph;jypq;fk; epidT mwf;fl;lis</b><br>");
		document.write("midj;J cupkq;fSk; ngwg;gl;Ls;sd.<br><br>cUthf;fk; kw;Wk; Nkyhz;ik: ");
		document.write("<a href='http://www.ishatechnologies.in/' target='_blank'><img src='images/logo_small.png' align=middle border=0 /></a></div><br>");
	}
	else
	{
		document.write("<hr width=80%>");
		document.write("<div align=center style={font-size:8pt;}>Copyright &copy; 2000 - "+curDT.getFullYear()+", <b>A. Amirthalingam Memorial Foundation</b><br>");
		document.write("All Rights Reserved.<br><br>Developed and Maintained By: ");
		document.write("<a href='http://www.ishatechnologies.in/' target='_blank'><img src='images/logo_small.png' align=middle border=0 /></a></div><br>");
	}
}
 
/*********************************************************************
 * Function    : WriteTopMenu(pgLang)                                *
 * Description : Writes the Top Menu Bar of the Page                 *
 * Arguments   : pgLang - Language of the Page that needs Top Menu   *
 *********************************************************************/
function WriteTopMenu(pgLang)
{
	if(pgLang==0)
	{
		//Main Menu Bar Writing
		document.write("<table border=0 width=100% height=100% cellpadding=2 cellspacing=1 class=tblTrans><tr>");
		for(x=0;x<arrTTMenu.length;x++)
		{
			document.write("<td id='barT"+x+"' align=center width="+arrTTMenu[x][2]+" onMouseOver='ShowTopMenu("+x+","+pgLang+");' onClick=\"LoadURL('"+arrTTMenu[x][1]+"');\" class='mnuOut'>"+arrTTMenu[x][0]+"</td>");
		}
		document.write("</tr></table>");
		//Drop-Down Menus Writing
		for(x=0;x<arrTTMenu.length;x++)
		{
			document.write("<table border=0 id='mnuT"+x+"' cellpadding=4 cellspacing=1 class=tblTrans style={position:absolute;left:"+arrTTMenu[x][3][0][0]+"px;top:"+arrTTMenu[x][3][0][1]+"px;display:none;}>");
			if(arrTTMenu[x][3][0][0]!="=")
			{
				for(y=1;y<arrTTMenu[x][3].length;y++)
				{
					if(arrTTMenu[x][3][y][0]=="-")
						document.write("<tr><td onMouseOver=\"this.className='mnuOver';\" onMouseOut=\"this.className='mnuOut';\" class='mnuOut'></td></tr>");
					else
						document.write("<tr><td onMouseOver=\"this.className='mnuOver';\" onMouseOut=\"this.className='mnuOut';\" onClick=\"LoadURL('"+arrTTMenu[x][3][y][1]+"');\" nowrap class='mnuOut'>&nbsp;"+arrTTMenu[x][3][y][0]+"&nbsp;&nbsp;</td></tr>");
				}
			}
			document.write("</table>");
		}
	}
	else
	{
		//Main Menu Bar Writing
		document.write("<table border=0 width=100% height=100% cellpadding=2 cellspacing=1 class=tblTrans><tr>");
		for(x=0;x<arrETMenu.length;x++)
		{
			document.write("<td id='barT"+x+"' align=center width="+arrETMenu[x][2]+" onMouseOver='ShowTopMenu("+x+","+pgLang+");' onClick=\"LoadURL('"+arrETMenu[x][1]+"');\" class='mnuOut'>"+arrETMenu[x][0]+"</td>");
		}
		document.write("</tr></table>");
		//Drop-Down Menus Writing
		for(x=0;x<arrETMenu.length;x++)
		{
			document.write("<table border=0 id='mnuT"+x+"' cellpadding=4 cellspacing=1 class=tblTrans style={position:absolute;left:"+arrETMenu[x][3][0][0]+"px;top:"+arrETMenu[x][3][0][1]+"px;display:none;}>");
			if(arrETMenu[x][3][0][0]!="=")
			{
				for(y=1;y<arrETMenu[x][3].length;y++)
				{
					if(arrETMenu[x][3][y][0]=="-")
						document.write("<tr><td onMouseOver=\"this.className='mnuOver';\" onMouseOut=\"this.className='mnuOut';\" class='mnuOut'></td></tr>");
					else
						document.write("<tr><td onMouseOver=\"this.className='mnuOver';\" onMouseOut=\"this.className='mnuOut';\" onClick=\"LoadURL('"+arrETMenu[x][3][y][1]+"');\" nowrap class='mnuOut'>&nbsp;"+arrETMenu[x][3][y][0]+"&nbsp;&nbsp;</td></tr>");
				}
			}
			document.write("</table>");
		}
	}
}

/*********************************************************************
 * Function    : ShowTopMenu(mnuID,pgLang)                           *
 * Description : Shows the Top Menu Bar Menu                         *
 * Arguments   : mnuID  - ID Number of the Menu to be Shown          *
 *             : pgLang - Language of the Page                       *
 *********************************************************************/
function ShowTopMenu(mnuID,pgLang)
{
	var objBar,objMenu;
	
	//Hide all Open Menus
	HideTopMenu(-1,pgLang);
	
	//Get the Requested Menu Objects
	objBar=document.getElementById("barT"+mnuID);
	objMenu=document.getElementById("mnuT"+mnuID);
	
	//Show the Menu
	if(objBar.className!="mnuOver")
		objBar.className="mnuOver";
	if(objMenu.style.display!="")
		objMenu.style.display="";
}

/*********************************************************************
 * Function    : HideTopMenu(mnuID,pgLang)                           *
 * Description : Hides the Top Menu Bar Menu                         *
 * Arguments   : mnuID  - ID Number of the Menu to be Hidden         *
 *             : pgLang - Language of the Page                       *
 *********************************************************************/
function HideTopMenu(mnuID,pgLang)
{
	var objBar,objMenu;
	
	if(mnuID==-1)
	{
		//Hide all Open Menus
		if(pgLang==0)
		{
			for(m=0;m<arrTTMenu.length;m++)
			{
				//Get the Requested Menu Objects
				objBar=document.getElementById("barT"+m);
				objMenu=document.getElementById("mnuT"+m);
				
				//Hide the Menu
				if(objBar.className!="mnuOut")
					objBar.className="mnuOut";
				if(objMenu.style.display!="none")
					objMenu.style.display="none";
			}
		}
		else
		{
			for(m=0;m<arrETMenu.length;m++)
			{
				//Get the Requested Menu Objects
				objBar=document.getElementById("barT"+m);
				objMenu=document.getElementById("mnuT"+m);
				
				//Hide the Menu
				if(objBar.className!="mnuOut")
					objBar.className="mnuOut";
				if(objMenu.style.display!="none")
					objMenu.style.display="none";
			}
		}
	}
	else
	{
		//Get the Requested Menu Objects
		objBar=document.getElementById("barT"+mnuID);
		objMenu=document.getElementById("mnuT"+mnuID);
		
		//Hide the Menu
		if(objBar.className!="mnuOut")
			objBar.className="mnuOut";
		if(objMenu.style.display!="none")
			objMenu.style.display="none";
	}
}

/*********************************************************************
 * Function    : ShowDT()                                            *
 * Description : Shows the Date and Time in the Page                 *
 *********************************************************************/
function ShowDT()
{
	var objDT, objDiv, curHour;
	
	objDT = new Date();
	objDiv = document.getElementById("divDT");
	//Check whether AM or PM
	curHour=objDT.getHours();
	if(curHour==0) curHour = 12;
	if(curHour>12)
		objDiv.innerHTML=arrMons[objDT.getMonth()]+" "+objDT.getDate()+" "+objDT.getFullYear()+" - "+PadText(curHour-12,2,"0",0)+":"+PadText(objDT.getMinutes(),2,"0",0)+":"+PadText(objDT.getSeconds(),2,"0",0)+" PM&nbsp;";
	else
		objDiv.innerHTML=arrMons[objDT.getMonth()]+" "+objDT.getDate()+" "+objDT.getFullYear()+" - "+PadText(curHour,2,"0",0)+":"+PadText(objDT.getMinutes(),2,"0",0)+":"+PadText(objDT.getSeconds(),2,"0",0)+" AM&nbsp;";
	setTimeout("ShowDT()",1000);
}

/*********************************************************************
 * Function    : LoadURL(urlPath,[urlTarget])                        *
 * Description : Loads a given URL into the Browser                  *
 * Arguments   : urlPath   - Path of the URL to be Loaded            *
 *               urlTarget - Optional. Specifies Target of URL       *
 *********************************************************************/
function LoadURL(urlPath)
{
	if(arguments.length==1)
		document.location=urlPath;
	else
	{
		window.open(urlPath,arguments[1]);
	}
}

/*********************************************************************
 * Function    : PadText(strText,lngLen,optChar,optAlign)            *
 * Description : Pads given Text leaving given Character in the side *
 *               given in optAlign using given Length of Characters. *
 * Arguments   : strText  - Text to be Padded                        *
 *               lngLen   - Length of Characters to Return           *
 *               optChar  - Character to be filled in the Sides      *
 *               optAlign - Alignment of Padded Text                 *
 *                          (0 - Left, 1 - Right, 2 - Center)        *
 * Returns     : Padded Text as a String                             *
 *********************************************************************/
function PadText(strText,lngLen,optChar,optAlign)
{
	var lftLen, rgtLen, strOut, strIn;
	
	strIn = new String(strText);
	strOut = "";
	//Check if the given Text is more or equal to the given Length
	if(strIn.length>=lngLen)
		return strIn;
	if(optAlign==0)
	{
		//Left Alignment
		lftLen = lngLen-strIn.length;
		for(x=0;x<lftLen;x++)
			strOut = strOut+optChar;
		strOut = strOut+strIn.toString();
		return strOut;
	}
	else if(optAlign==1)
	{
		//Right Alignment
		rgtLen = lngLen-strIn.length;
		strOut = strIn.toString();;
		for(x=0;x<rgtLen;x++)
			strOut = strOut+optChar;
		return strOut;
	}
	else
	{
		//Center Alignment
		rgtLen = Math.round((lngLen-strIn.length)/2);
		lftLen = (lngLen-strIn.length)-rgtLen;
		for(x=0;x<lftLen;x++)
			strOut = strOut+optChar;
		strOut = strOut+strIn.toString();
		for(x=0;x<rgtLen;x++)
			strOut = strOut+optChar;
		return strOut;
	}
}
