var QTopMenu;
var QSubMenu;
var QMenuItems;
var QMenuSubItem;
var QLS;
var QLSS;
var QLM;
  
// IE fade Effect
effect = "Fade(duration=0.2);Alpha(style=0,opacity=88);Shadow(color='#777777', Direction=135, Strength=5)"

style1 = "";
style1 = style1 + "[";					// style1 is an array of properties. You can have as many property arrays as you need. This means that menus can have their own style.
style1 = style1 + "\"" + COLOR5 + "\",";		// Mouse Off Font Color
style1 = style1 + "\"" + COLOR3 + "\",";		// Mouse Off Background Color
style1 = style1 + "\"293476\",";					// Mouse On Font Color
style1 = style1 + "\"" + COLOR3 + "\",";				// Mouse On Background Color
style1 = style1 + "\"5C75B5\",";				// Menu Border Color 
style1 = style1 + "13,";						// Font Size in pixels
style1 = style1 + "\"normal\",";				// Font Style (italic or normal)
style1 = style1 + "\"normal\",";				// Font Weight (bold or normal)
style1 = style1 + "\"Arial,sans-serif\",";		// Font Name
style1 = style1 + "2,";	 						// Menu Item Padding
style1 = style1 + ",";		// Sub Menu Image (Leave this blank if not needed)
style1 = style1 + ",";							// 3D Border & Separator bar
style1 = style1 + "\"66ffff\",";				// 3D High Color
style1 = style1 + "\"000099\",";				// 3D Low Color
style1 = style1 + "\"\",";						// Current Page Item Font Color (leave this blank to disable)
style1 = style1 + "\"\",";						// Current Page Item Background Color (leave this blank to disable)
style1 = style1 + ",";		// Top Bar image (Leave this blank to disable)
style1 = style1 + "\"ffffff\",";				// Menu Header Font Color (Leave blank if headers are not needed)
style1 = style1 + "\"000099\",";				// Menu Header Background Color (Leave blank if headers are not needed)
style1 = style1 + "\"5C75B5\",";				// Menu Item Separator Color
style1 = style1 + "]";      


QTopMenu = topmenulist.split('~');
QLT = "";
for ( var i = 0; i < QTopMenu.length; i++ )
{	
	QSubMenu = QTopMenu[i].split('*');	

	QMenuItems = QSubMenu[0].split('|');
	if ((i == 0) || (i == QTopMenu.length-1) || (QMenuItems[1] >= 0) ) {
		if (QSubMenu.length == 1)
			QLT = QLT + ",\"&nbsp;"+ QMenuItems[0] + "\",\"" + QMenuItems[2] + "\",,\"\",1\n";
		else if ( QMenuItems[2] == 0) 
			QLT = QLT + ",\"&nbsp;"+ QMenuItems[0] + "\",\"show-menu=" + QMenuItems[1] + "\",,\"\",1\n";
		else
		    QLT = QLT + ",\"&nbsp;"+ QMenuItems[0] + "\",\"show-menu=" + QMenuItems[1] + "\",\"" + QMenuItems[2] + "\",\"\",1\n";
	}		
}	

QLS="\n";
for ( var i = 0; i < QTopMenu.length; i++ )
{	
	QSubMenu = QTopMenu[i].split('*');	
	if (QSubMenu.length > 1)
	{
	for ( var k = 0; k < QSubMenu.length; k++ )	
	{
		QMenuItems = QSubMenu[k].split('|');
		if (k == 0)
			QLS = QLS + "\ninsertmenu(menu=[\"" + QMenuItems[1] + "\",,,190,1,\"\"," + style1 + ",,\"left\",\"" + effect + "\",,,,,,,,,,,,\n";
		else
		{
			if ((i == 0) || (i == QTopMenu.length-1) || (QMenuItems[1] >= 0) ) {		
				if ( QMenuItems[2] == 2) 
					QLS = QLS + ",\"&nbsp;"+ QMenuItems[0] + "\",\"show-menu=" + QMenuItems[4] + "\",,\"\",1\n";
				else
					QLS = QLS + ",\"&nbsp;"+ QMenuItems[0] + "&nbsp;\",\"" + QMenuItems[2] + "\",,,1\n";	
			}
		}
	}	
	QLS = QLS + "])\n";
	}
}
 
QLSS = "\n";
for ( var i = 0; i < QTopMenu.length; i++ )
{	
	QSubMenu = QTopMenu[i].split('*');	
	if (QSubMenu.length > 1)
	{
	for ( var k = 0; k < QSubMenu.length; k++ )	
	{
		QMenuItems = QSubMenu[k].split('|');
		if (QMenuItems[2] == 2) 
		{ 
			if (QMenuItems[1] >= 0)  {		
				QLSS = QLSS + "insertmenu(menu=[\"" + QMenuItems[4] + "\",,,190,1,\"\"," + style1 + ",,\"left\",\"" + effect + "\",,,,,,,,,,,,\n";
				for ( var x = 5; x < QMenuItems.length; x++ )	
				{
					QMenuSubItem = QMenuItems[x].split('^');
					QLSS = QLSS + ",\"&nbsp;"+ QMenuSubItem[0] + "&nbsp;\",\"" + QMenuSubItem[1] + "\",,,1\n";	
				}
				QLSS = QLSS + "])\n";
			}
		}
	}	
	}
}

opera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false
menunum=0;
menus=new Array();
_d = document;
function insertmenu() {
	menunum++;menus[menunum]=menu;
}
function showmenus() {

menustr="<script language=javascript>";
for(a=1;a<menus.length;a++) {
	menustr+=" menu"+a+"=menus["+a+"];"
	}
menustr+="<\/script>";
_d.write(menustr)
}


timegap=500			// The time delay for menus to remain visible
followspeed=5		// Follow Scrolling speed
followrate=40		// Follow Scrolling Rate
suboffset_top=10;	// Sub menu offset Top position 
suboffset_left=10;	// Sub menu offset Left position
closeOnClick = true

////////////////////////////////////
// The following can be editied
////////////////////////////////////

var dynSetMenuLeft = (screen.width - 740)/2;

QLM = "";
QLM = QLM + "insertmenu(menu=[";	// This is the array that contains your menu properties and details
QLM = QLM + "\"mainmenu\",";		// Menu Name - This is needed in order for the menu to be called
QLM = QLM + "277,";					// Menu Top - The Top position of the menu in pixels

QLM = QLM + dynSetMenuLeft+",";					// Menu Left - The Left position of the menu in pixels
/*if ((screen.width>=1280)) {
	QLM = QLM + "290,";					// Menu Left - The Left position of the menu in pixels
}
if ((screen.width>=1024 && screen.width<1280)) {
	QLM = QLM + "167,";					// Menu Left - The Left position of the menu in pixels
}
if ((screen.width<850)) {
	QLM = QLM + "55,";					// Menu Left - The Left position of the menu in pixels
}*/

QLM = QLM + "85,";					// Menu Width - Menus width in pixels
QLM = QLM + "0,";					// Menu Border Width 
QLM = QLM + ",";					// Screen Position - here you can use "center;left;right;middle;top;bottom" or a combination of "center:middle"
QLM = QLM + style1 + ",";			// Properties Array - this is set higher up, as above
QLM = QLM + "1,";					// Always Visible - allows the menu item to be visible at all time (1=on/0=off)
QLM = QLM + "\"center\",";			// Alignment - sets the menu elements text alignment, values valid here are: left, right or center
QLM = QLM + ",";					// Filter - Text variable for setting transitional effects on menu activation - see above for more info
QLM = QLM + ",";					// Follow Scrolling - Tells the menu item to follow the user down the screen (visible at all times) (1=on/0=off)
QLM = QLM + "1,"; 					// Horizontal Menu - Tells the menu to become horizontal instead of top to bottom style (1=on/0=off)
QLM = QLM + ",";					// Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on/0=off)
QLM = QLM + ",";					// Position of TOP sub image left:center:right
QLM = QLM + ",";					// Set the Overall Width of Horizontal Menu to 100% and height to the specified amount (Leave blank to disable)
QLM = QLM + ",";					// Right To Left - Used in Hebrew for example. (1=on/0=off)
QLM = QLM + ",";					// Open the Menus OnClick - leave blank for OnMouseover (1=on/0=off)
QLM = QLM + ",";					// ID of the div you want to hide on MouseOver (useful for hiding form elements)
QLM = QLM + ",";					// Background image for menu when BGColor set to transparent.
QLM = QLM + ",";					// Scrollable Menu
QLM = QLM + ",";					// Reserved for future use
									// "Description Text", "URL", "Alternate URL", "Status", "Separator Bar"
QLM = QLM + "\n" + QLT; + "\n" 
QLM = QLM + "])";									
//QLX =  "<PRE>" + QLM + "\n\n" + QLS + "\n" + "</pre>";
QLX = "<script language=JavaScript1.2>" + "\n" + QLM + "\n\n" + QLS + "\n" + QLSS + "\n" + "<\/script>";
//alert(QLX);
_d.write(QLX);

showmenus();
