
var toppropertyforMenu="8";//This value to be given to start from top of page which has td with height 20.

function show_hide_menu1(param,index)
{
		
	if (flg==true && initiatedbyid!=eval(param).id)
	{
	
		
		initiatedbyid=eval(param).id  //who has initiated
		document.getElementById("myMenu1").style.left=bordersubMenuleft
		createsubMenu(param,index)
		eval('myMenu1').style.display=""
		
		i=bordersubMenuleft;
		
		if(positionsubmenu)
		{
			var OffsetTop
			var MenuTopOffset=12
			if(param=="menu3")
			{
				MenuTopOffset=13 //24				
			}
			else if(param=="menu5")
			{
				MenuTopOffset=0	
			}
			
			var OffsetindividualMenuItem=0;
			OffsetindividualMenuItem=(AlwaysStartsubMenufromFirstitem==true)? 0:document.getElementById(param).offsetTop;
			//parseFloat("20"),Subtracted this to cancel out the extra td(cell) that we are faking in the table with id myMenu1
			OffsetTop=parseFloat(OffsetindividualMenuItem) + parseFloat(toppropertyforMenu)-parseFloat("20")-MenuTopOffset
			document.getElementById('myMenu1').style.top=OffsetTop
		}//end if
		
		
		
		if(typeof(intShow) != "undefined") 
		{
		clearInterval(intShow);
		}//end if
		
				
		intShow=setInterval("show1()",1)
		
	}//end if
	
	
}//end function


function show1()
{
	if (i<parseFloat(bordersubMenuDistance))
	{
	i=i+speed
	document.getElementById('myMenu1').style.left=i
	}
}

function changeflgfalse()
{
flg=false
}

function changeflgtrue(param)
{

onloadflag=false
initiatedbyid=eval(param).id //who has initiated
flg=true
hidechildTable()
}

//This function will be used when the event is handled using javascript code.
function changeflgtrue1()
{
	if(typeof(document.getElementById("myMenu1"))!="undefined")
	{
		flg=true
		initiatedbyid=""

		hidechildTable()

	
		/*
			if (onloadflag)
			{
				//Uncomment this to avoid retaining the bold effect of the page clicked
				//once when the user mouse moves on the entire page
				//onloadflag=false
			}
			else
			{
		*/
				if (!onloadflag)
				{
				displayimg(null,-1)
				}
		  //}
	}
	
}


function hidechildTable()
{
	
	if (flg==true)
	{
		//document.getElementById("myMenu1").style.left=bordersubMenuleft
		max_rows=myMenu1.rows.length;
		curr_row=0;
		
		eval('myMenu1').style.left=eval(bordersubMenuDistance-7)
		eval('myMenu1').style.display=""
		
		for (curr_row = 0; curr_row < max_rows; curr_row++)
		{
			
			myMenu1.deleteRow(0)
		}//end for
		
			
		for (curr_row = 0; curr_row < 8; curr_row++)
		{
			oRow = myMenu1.insertRow();
			oCell = oRow.insertCell();
			oCell.style.background="transparent";
			oCell.height=20
			oCell.onmouseover=changeflgtrue1
			oRow.appendChild(oCell);
		}	
		
	}//end if	

}//end function

function putBorders(object,i,borderproperties)
{
		if (i==0)
		{
		object.style.borderTop=borderproperties
		} //end if
		object.style.borderBottom=borderproperties;
		object.style.borderLeft=borderproperties;
		object.style.borderRight=borderproperties;
}//end function

function createsubMenu(source,index)
{

//This function takes in an object ,just incase if one has to create more than one sub menu's.
	var strhtml="";
	var i;
	var oCell="";
	var oRow="";
	var curr_row="";
	var max_rows,i
	
	//var index=source.substring(source.length-1,source.length);
	var l_maxofMenuindex=eval('Menu'+index).length;  //This variable is to calculate length of Menu0,Menu1....
	
	/*
	This for loop below empties the table with id=myMenu1
	*/
	max_rows=myMenu1.rows.length;
		
	for (curr_row = 0; curr_row < max_rows; curr_row++)
	{
		myMenu1.deleteRow(0)
	}//end for
	
	oRow = myMenu1.insertRow();
	oCell = oRow.insertCell();
	oCell.style.background="transparent";
	oCell.colSpan=2
	oCell.height=20
	oCell.onmousemove=changeflgtrue1
	oCell.onmouseover=changeflgtrue1
	oRow.appendChild(oCell);
	
	for(i=0;i<l_maxofMenuindex;i++)
	{
			
		oRow = myMenu1.insertRow();
		
		
		
		if(eval('Menulinks'+index+'['+i+']')=='')
		{
			oCell = oRow.insertCell();
			oCell.style.background="transparent"//subMenuCellColor;
			oCell.id="menu1"+i;
			oCell.width="20";
			oCell.height=10
			oCell.innerHTML=eval('Menu'+index+'['+i+']');
			
		}//end if
		else
		{
			
			oCell = oRow.insertCell();
			oCell.style.background="transparent"//subMenuCellColor;
			oCell.id="menu1"+i;
			//oCell.width="20";
			oCell.width=125
			oCell.height=10
			
		//	if (typeof(eval('altMenu'+index))=='undefined'&& typeof(eval('altMenu'+index+'['+i+']'))=='undefined')
			if (eval('altMenu'+index+'['+i+']')=='')
			{
				oCell.innerHTML="<a   class='anchorstyle' onClick=submitpage('Menulinks"+index+"["+i+"]','"+index+"','"+i+"') onMouseover=this.className='onmouseoveranchorstyle' onMouseout=this.className='anchorstyle'>"+eval('Menu'+index+'['+i+']')+"</a>"
			}
			else
			{
				var alttag=eval('altMenu'+index+'['+i+']')
				oCell.innerHTML="<a   alt='"+alttag+"' title='"+alttag+"' class='anchorstyle' onClick=submitpage('Menulinks"+index+"["+i+"]','"+index+"','"+i+"') onMouseover=this.className='onmouseoveranchorstyle' onMouseout=this.className='anchorstyle'>"+eval('Menu'+index+'['+i+']')+"</a>"	
			}
			
		}//end else
		oRow.appendChild(oCell);
		document.getElementById("myMenu1").onmouseover=changeflgfalse;
				
		putBorders(oCell,i,borderpropertiesforSubMenu)
		
		oCell = oRow.insertCell();
		oCell.style.background="transparent";
	//	oCell.width=30;
	//	oCell.width=125;
		oCell.onmousemove=changeflgtrue1;
		oCell.onmouseover=changeflgtrue1;
		oRow.appendChild(oCell);
		
	}//end for 
	oRow = myMenu1.insertRow();
	oCell = oRow.insertCell();
	oCell.style.background="transparent";
	oCell.colSpan=2
	oCell.height=20
	oCell.onmousemove=changeflgtrue1
	oCell.onmouseover=changeflgtrue1
	oRow.appendChild(oCell);
	
}//end function

function createMenu()
{
	
	if (Menuindex=="")
	{
		Menuindex=0
	}
var strhtml="";
var i;
var oCell="";
var oRow="";
var classname="";
var l_maxofMenu=Menu.length
var content=document.getElementById("content")

	eval('myMenu').style.left=borderMenuleft;
	eval('myMenu1').style.left=bordersubMenuleft;
	eval('myMenu').style.top=toppropertyforMenu;
	eval('myMenu1').style.top=parseFloat(toppropertyforMenu)
	
	
	 //This line of code fakes a transparent tr to give the mouse over effect to hide the submenu
	oRow = myMenu.insertRow();
	oCell = oRow.insertCell();
	oCell.style.background="transparent";
	oCell.height=20
	oCell.colSpan=2
	//oCell.onmousemove=changeflgtrue1
	oCell.onmouseover=changeflgtrue1
	oRow.appendChild(oCell);

	for(i=0;i<l_maxofMenu;i++)
	{
	
	    //This line of code fakes a transparent td to give the mouse over effect to hide the submenu
		oRow = myMenu.insertRow();
		oCell=oRow.insertCell();
		oCell.style.background="transparent";
		oCell.width="10";//110
		//oCell.onmousemove=changeflgtrue1;
		oCell.onmouseover=changeflgtrue1;
		oRow.appendChild(oCell);
		putBorders(oCell,i,borderpropertiesforMenu)
		oCell=""
	
	
		if(Menulinks[i]=='')
		{
			
			oCell = oRow.insertCell();
			oCell.style.background="white";//MenuCellColor;
			oCell.id="menu"+i;
			// Just added this line of code
			//oCell.width="100";//110
			oCell.align="right"
			oCell.height=10
			classname="spanstyle"
			
			  if (Menuindex!="")
			  {
				if(eval("Menu["+Menuindex+"]")==eval("Menu["+i+"]"))
				{
					classname="spandefaultstyle"
					
				}
			  }
			
			oCell.innerHTML="<span style='width:100' class='"+classname+"'  onmouseover=flg=true;displayimg('menu"+i+"','"+i+"');show_hide_menu1('menu"+i+"','"+i+"') onClick=submitpage('Menulinks"+i+"[0]','"+i+"','0')>"+Menu[i]+"</span>"; //onmouseout=hidechildTable() navigateUrl('Menulinks"+i+"');
						
		}//end if
		else
		{
			
			oCell = oRow.insertCell();
			oCell.style.background="white";//MenuCellColor;
			oCell.id="menu"+i;
			oCell.align="right"
			oCell.height=10
			classname="hrefdefaultstyle"
			
			if (Menuindex!="")
			{
			 /*
			  if(eval("Menu["+Menuindex+"]")==eval("Menu["+i+"]"))
			  {
				classname="homedefaultstyle"
			  }
			  */
			  if(eval("Menu["+Menuindex+"]")!=eval("Menu["+i+"]"))
			  {
				classname="hrefnondefaultstyle"
			  }
			}
			
			// sangam modifies for home
			//This tag displays the home menu.
			oCell.innerHTML="<span style='width:100' class='spanstyle' onmouseover=displayimg('menu"+i+"','"+i+"');changeflgtrue('menu"+i+"')><a  style='width:90;text-align:right' class='"+classname+"'  onClick=submitpage('Menulinks["+i+"]','"+i+"','')>"+Menu[i]+"</a></span>";
						
		}//end else
		oRow.appendChild(oCell);
		putBorders(oCell,i,borderpropertiesforMenu)
		
		/*
		//faking td
		oCell=oRow.insertCell();
		oCell.style.background="transparent";
		oCell.id="fake"+i;
		oCell.width="20";
		oCell.style.display="none";
		//oCell.onmousemove=changeflgtrue1;
		oCell.onmouseover=changeflgtrue1;
		oRow.appendChild(oCell);
		oCell=""
		*/
		
	}//end for
	
	oRow = myMenu.insertRow();
	oCell = oRow.insertCell();
	oCell.style.background="transparent";
	oCell.height=11
	oCell.colSpan=2
	//oCell.onmousemove=changeflgtrue1
	oCell.onmouseover=changeflgtrue1
	oRow.appendChild(oCell);
	/*
	oRow = myMenu.insertRow();
	oCell = oRow.insertCell();
	oCell.style.background="transparent";
	oCell.height=2
	//oCell.width=10
	oCell.colSpan=2
	oCell.style.backgroundImage="url(/Zeus_Learning_India/eLearning_Design_Multimedia/dot.gif)"
	oCell.style.backgroundRepeat="repeat-x";
	oRow.appendChild(oCell);
	*/
//DisplayNavigation()	
//This line of code adds a handler to the table with id content for mousemove and mouseout
//content.onmouseover="flg=true;changeflgtrue1()" 
//content.onmousemove="flg=true;changeflgtrue1()"		
}//end function

function navigateUrl(obj)
{
	alert(obj)
}

function DisplayNavigation()
{
		
	if(Menuindex!="" && subMenuindex=="")
	{
	document.getElementById("DisplayNavigation").innerHTML=eval("Menu["+Menuindex+"]")
	}
	else if (Menuindex!="" && subMenuindex!="")
	{
	document.getElementById("DisplayNavigation").innerHTML=eval("Menu["+Menuindex+"]")+" > "+eval("Menu"+Menuindex+"["+subMenuindex+"]")
	}
	/*else if (Menuindex=="" && subMenuindex=="")
	{
	document.getElementById("DisplayNavigation").innerHTML=eval("Menu[0]")
	}
	*/
}



function displayimg(object,index)
{
//This function takes in an object ,just incase if the same functionality of the arrow
//has to be provided for the Submenus as well.
	//if (index!="-1")
	//{
		var i;
		//
		onloadflag=false
		//var index=object.substring(object.length-1,object.length);
		var l_maxofMenu1=Menu.length
		//alert(eval("menu1").childNodes[0].childNodes[0].tagName)
		for(i=0;i<l_maxofMenu1;i++)
		{
		
			var ofirstChild=eval("menu"+i).firstChild
				if (ofirstChild.tagName=="SPAN")
				{
					var osecondChild=ofirstChild.firstChild
					if(typeof(osecondChild.tagName)!="undefined" && osecondChild.tagName!="SPAN")
					{
					//This means there is a href tag
					ChangeHTMLContent(index,i,osecondChild,"onmouseoverhomestyle","anchorstyle;color:#a0a0a0")
					}//end if
					else if (typeof(osecondChild.tagName)=="undefined")
					{
					//This means there is a span tag
					ChangeHTMLContent(index,i,ofirstChild,"onmouseoverspanstyle","spanstyle")		
					}//end else if
					else if (typeof(osecondChild.tagName)!="undefined" && osecondChild.tagName=="SPAN")
					{
					//This means there is are two span tags,where by the second span tag was dynamically 
					//generated in function ChangeHTMLContent.
					ChangeHTMLContent(index,i,ofirstChild,"onmouseoverspanstyle","spanstyle")		
					}//end else if
								
				}//end if
		}//end for	
	
	//}//end if
		
}//end function

function ChangeHTMLContent(index,i,object,onmouseoverstyle,style)
{
	if(eval("Menu["+Menuindex+"]")!=eval("Menu["+i+"]"))
	{
		if (parseFloat(index)==parseFloat(i))
		{
			if(i!=0)
			{
				// sangam
				object.className=onmouseoverstyle
				object.innerHTML="<span><img src='/Zeus_Learning_India/eLearning_Design_Multimedia/Double Arrow.bmp' width=8 height = 7 border=0>&nbsp;</span>"+eval("Menu["+index+"]")
			}
			else
			{
				//This is to trap mouseover for Home where the 'object' tag is href link
				object.className=onmouseoverstyle
				object.innerHTML="<img src='/Zeus_Learning_India/eLearning_Design_Multimedia/Double Arrow.bmp' width=8 height = 7 border=0>&nbsp;"+eval("Menu["+index+"]")
			}
			
										
		}//end if
		else
		{
			//sangam
			
				object.className=style
				object.innerHTML=eval("Menu["+i+"]")
				
			
		}//end else
	}
	else
	{
		if(eval("Menu["+Menuindex+"]")==eval("Menu["+index+"]"))
		{
			object.setAttribute("style","text-decoration:none")
			object.innerHTML="<span><img src='/Zeus_Learning_India/eLearning_Design_Multimedia/Double Arrow.bmp' width=8 height = 7 border=0>&nbsp;</span>"+eval("Menu["+index+"]")
		}
		else
		{			
			//sangam
			object.innerHTML=eval("Menu["+i+"]")
					
		}//end else
	}
}//end function

function submitpage(obj,menuindex,subMenuindex)
{
var strdate=new Date().toString();
document.forms[0].method="post";
document.forms[0].Menuindex.value=menuindex;
document.forms[0].subMenuindex.value=subMenuindex;
document.forms[0].clientTime.value=strdate;
document.forms[0].action=eval(obj);
document.forms[0].submit();

}

function submitpage_path(path,menuindex,subMenuindex)
{
var strdate=new Date().toString();
document.forms[0].method="post";
document.forms[0].Menuindex.value=menuindex;
document.forms[0].subMenuindex.value=subMenuindex;
document.forms[0].clientTime.value=strdate;
document.forms[0].action=path;
document.forms[0].submit();

}

function display_hide_td_Menu(value)
{
	var i;
	var l_maxofMenu1=Menu.length
		for(i=0;i<l_maxofMenu1;i++)
		{
		eval("fake"+i).style.display=value
		}	
}

function windowresize()
{
document.getElementById("repeat-y").style.height=document.body.offsetHeight-34//25
document.getElementById("repeat-x").style.width =document.body.offsetWidth-23
}

function onload_resizeRepeat()
{
document.getElementById("repeat-y").style.height=document.body.offsetHeight-5
document.getElementById("repeat-x").style.width=document.body.offsetWidth-23
}