/********** Initialization ********************/

var menuStyle = "horizontal" // value should be "horizontal" OR "vertical"

var totalSubMenus = 2; // Total number of dropdown menus.

if(menuStyle == "horizontal"){

	var menu1LeftPos = 500; // left position of the Dropdown menu 1
	

	

}else if(menuStyle == "vertical"){

	var menuLeftPos = 100; // left position of all the Dropdown menu.

}

var table_width=1003; // Width of the table containing actual contents.

/********** End of Initialization ********************/



/********** Start Function to show menus. ********************/

function show(menuNo){

 	for(i=1; i<=totalSubMenus; i++){	

 		document.getElementById("menuComm"+i).style.visibility='hidden'

 	}

 	document.getElementById('menuComm'+menuNo).style.visibility='visible';

}

function show1(menuNo){ 

 	document.getElementById('menuComm'+menuNo).style.visibility='visible';

}
/********** End Function to show menus. ********************/



/********** Start Function to hide menus. ********************/

function hideAllMenus(){

 	for(i=1; i<=totalSubMenus; i++){	

 		document.getElementById("menuComm"+i).style.visibility='hidden'

 	}

}

function hideAllMenus1(){ 		

 		document.getElementById("menuComm4").style.visibility='hidden' 	

}

/********** End Function to hide menus. ********************/



/********** Start Function to Relocate menus. ********************/

function locateDiv(){

	 var x;

	 x = document.body.offsetWidth; // Window width

	 var margine = x-table_width;

	 var leftx = (margine/2);

	 var ieOffset = 11;  // For WINDOWS IE Browser, left border width is 2px and right scrollbar width is 19px 

	 // So browser offset is (2+19)/2 that is approx 11px

	 var detect = navigator.userAgent.toLowerCase(); // Browser info string.

	 var OS,browser,version,total,thestring;



	/********** Start Function to check OS, Browser, Version string in the Browser info string. ********************/

	function checkIt(string)

	{

		place = detect.indexOf(string) + 1;

		thestring = string;

		return place;

	}

	/********** End Function to check OS, Browser, Version string in the Browser info string. ********************/



	/********** Start Browser Detection ********************/

	if (checkIt('konqueror')){

		browser = "Konqueror";

		OS = "Linux";

	}

	else if (checkIt('safari')) browser = "Safari"

	else if (checkIt('firefox')) browser = "Firefox"

	else if (checkIt('netscape')) browser = "Netscape"

	else if (checkIt('omniweb')) browser = "OmniWeb"

	else if (checkIt('opera')) browser = "Opera"

	else if (checkIt('webtv')) browser = "WebTV";

	else if (checkIt('icab')) browser = "iCab"

	else if (checkIt('msie')) browser = "Internet Explorer"

	else if (!checkIt('compatible')){

		browser = "Netscape"

		version = detect.charAt(8);

	}

	else browser = "An unknown browser";

	/********** End Browser Detection********************/



	/********** Start Version Detection********************/

	if (!version) version = detect.charAt(place + thestring.length);

	/********** End Version Detection********************/



	/********** Start OS Detection********************/

	if (!OS){

		if (checkIt('linux')) OS = "Linux";

		else if (checkIt('x11')) OS = "Unix";

		else if (checkIt('mac')) OS = "Mac"

		else if (checkIt('win')) OS = "Windows"

		else OS = "an unknown operating system";

	}

	/********** End OS Detection********************/



	//alert('OS = '+OS);

	//alert('browser = '+browser);

	//alert('version = '+version);



	/********** Start Repositioning the menu ********************/

	for(i=1; i<=totalSubMenus; i++){

		if(menuStyle == "horizontal"){

			if(x>table_width) {

				if((OS == "Windows")&&(browser == "Internet Explorer")){					

 					document.getElementById("menuComm"+i).style.left=leftx+eval("menu"+i+"LeftPos")-ieOffset;

				} else {

					document.getElementById("menuComm"+i).style.left=leftx+eval("menu"+i+"LeftPos");

				}

			} else {

 				document.getElementById("menuComm"+i).style.left=eval("menu"+i+"LeftPos");

			}

		}else if(menuStyle == "vertical"){

			if(x>table_width) {

				if((OS == "Windows")&&(browser == "Internet Explorer")){					

 					document.getElementById("menuComm"+i).style.left=leftx+menuLeftPos-ieOffset;

				} else {

					document.getElementById("menuComm"+i).style.left=leftx+menuLeftPos;

				}

			} else {

 				document.getElementById("menuComm"+i).style.left=menuLeftPos;

			}

		}

	}

	/********** End Repositioning the menu ********************/



}

/********** End Function to Relocate menus. ********************/
