	
// MAIN NAVIGATION DROPDOWN MENU FUNCTIONALITY

	var delay = 100; // SetTimeout Delay, to prevent the menu closing immediately when losing focus
	var timeout; // Timeout menu variable

	var hide_dropdowns = true; // Configure if dropdowns should be hidden on IE
		
	var agt = navigator.userAgent.toLowerCase();
	var isMac = (agt.indexOf('mac') != -1);
	var isOpera = (agt.indexOf("opera") != -1);
	var IEver = parseInt(agt.substring(agt.indexOf('msie ') + 5));
	var isIE = ((agt.indexOf('msie')!=-1 && !isOpera && (agt.indexOf('webtv')==-1)) && !isMac);
	var isIE5win = (isIE && IEver == 5);
	var isIE5mac = ((agt.indexOf("msie") != -1) && isMac);
	
	function showMenu(objMenu, strMenu)
	{
			var menu = objMenu.parentNode.nextSibling;
	       // alert(menu);
			// Clear the menu timer
			hideMenuImmediate();
				
			if (menu)
			{		
					if (hide_dropdowns && isIE)
					{
							// Show the IFRAME overlay under the menu
							if ((menu.nextSibling) && (menu.nextSibling.tagName == "IFRAME"))
							{
									var iframe = menu.nextSibling;
												
									iframe.style.left = menu.offsetLeft + "px";
									iframe.style.height = menu.clientHeight + "px";
									iframe.style.visibility = "visible";
							}					
					}
					
					menu.style.visibility = "visible";					
			}
	}
	
	
			function showMenu4thLevel(objlink)
{
	if (objlink.childNodes.length > 1 && objlink.lastChild.tagName == "DIV")
	{
		// Obtain "+" link position on screen
		var coords = findPos(objlink.firstChild);
	

		objlink.lastChild.style.left = coords.x + objlink.firstChild.offsetWidth + "px";
		objlink.lastChild.style.top = (coords.y - 8) + "px";
		objlink.lastChild.style.visibility = "visible";
	}
}

	function hideMenu4thLevel(objlink)
	{
		if (objlink.childNodes.length > 1 && objlink.lastChild.tagName == "DIV")
		{
			objlink.lastChild.style.visibility = "hidden";

		}
	}

function findPos(element)
{
    var coordinates = new Object();
	coordinates.x = 0;
	coordinates.y = 0;
	
	if (element.offsetParent) 
	{
		coordinates.x = element.offsetLeft;
		coordinates.y = element.offsetTop;
		
		while (element = element.offsetParent)
		{
			coordinates.x += element.offsetLeft
			coordinates.y += element.offsetTop
		}
	}
	
	return coordinates;
}
	/*function showMenu4thLevel(objlink)
	{
		if(objlink.lastChild)
		{
		getPos=findPos(objlink.lastChild);	
		finalPos=getPos-3;	
		
		//objlink.lastChild.style.top= finalPos + "px";	
		objlink.lastChild.style.visibility= "visible";
		
		}
				 			
	}
			
			
	function hideMenu4thLevel(objlink)
	{	
	if(objlink.lastChild)
		{
			
			var elements = objlink.getElementsByTagName("div");
			objlink.lastChild.style.visibility="hidden";
		}
			
	}
function findPos(element)
{
	var curleft = 0;
	var curtop = 0;
	
	if (element.offsetParent) 
	{
		curleft = element.offsetLeft;
		curtop = element.offsetTop;
		
		while (element = element.offsetParent)
		{
			curleft += element.offsetLeft
			curtop += element.offsetTop
		}
	}
	
	return [curtop];
}
*/	
	
	function hideSubMenu5(item) 
	{
			//alert(item);
			item.style.visibility='hidden';
	}
	//till here 
	function hideMenuDelayed(objMenu)
	{
		if (objMenu)
		{		
			// setTimeout function to create a delay
			timeout = setTimeout(	function() 
														{ 
																try
																{																
																		hideSubMenu(objMenu);
																}
																catch(e)
																{
																	// Prevent error with FireFox still triggering after a page-reload
																}  
														}, delay);
		}
	}
	
	
	function hideMenuImmediate()
	{
		// Clear the existing timeout was set using setTimeout().
		if (timeout)
		{
				clearTimeout(timeout);
		}
	}
	


	function hideSubMenus(objContainer)
	{		
			// Find all the children menu's
			var elements = objContainer.getElementsByTagName("ul");
			
			MM_swapImgRestore();
		
			for (var i = 0; i < elements.length; i++)
			{
					hideSubMenu(elements[i]);																	
			}
	}

//added on 23rd aug 
function hideSubMenus4(objContainer)
	{		
			// Find all the children menu's
			var elements = objContainer.getElementsByTagName("table");
			
			//MM_swapImgRestore();
		
			for (var i = 0; i < elements.length; i++)
			{
					hideSubMenu(elements[i]);																	
			}
	}


	function hideSubMenu(objMenu) 
	{
			if (objMenu)
			{
					objMenu.style.visibility = "hidden";
					
					if (hide_dropdowns && isIE)
					{
							// Hide the IFRAME overlay under the menu
							if ((objMenu.nextSibling) && (objMenu.nextSibling.tagName == "IFRAME"))
							{
									objMenu.nextSibling.style.visibility = "hidden";
							}					
					}					
					
					MM_swapImgRestore();
			}
	}
	

	function SelectVisible(selects, hide) 
	{
			var i;
	
			if (hide_dropdowns && (isIE || isIE5win))
			{
					for (i = 0; i < selects.length; i++)
					{
							// Only combo-dropdownboxes	
							if (selects[i].type == "select-one")
							{
									if (hide)
									{
											selects[i].style.display = "none";
									}
									else
									{
											selects[i].style.display = "";											
									}
							}
					}
			}
	}

	
	
	
	