
//var _siteURL = 'http://127.0.0.1/changefactory';
//var _cgiBinURL = 'http://127.0.0.1/cgi-bin/changefactory';
var _siteURL = 'http://www.changefactory.com.au';
var _cgiBinURL = 'http://www.changefactory.com.au/cgi-bin';

var _fgColor = document.color;
var _bgColor = document.bgcolor;
var _hlColor = document.bgcolor;

var ugly_selectorText_workaround_flag = false;
var allStyleRules;

function ugly_selectorText_workaround() {
	if((navigator.userAgent.indexOf("Gecko") == -1) ||
	   (ugly_selectorText_workaround_flag)) {
		return; // we've already been here or shouldn't be here
	}
	var styleElements = document.getElementsByTagName("style");
	
	for(var i = 0; i < styleElements.length; i++) {
		var styleText = styleElements[i].firstChild.data;
		allStyleRules = styleText.match(/\b[\w-.]+(\s*\{)/g);
	}
	if (allStyleRules != null){
		for(var i = 0; i < allStyleRules.length; i++) {
			allStyleRules[i] = allStyleRules[i].substr(0, (allStyleRules[i].length - 2));
		}
	}
	ugly_selectorText_workaround_flag = true;
}


function getStyleByID(i, p) 
{
	var n = document.getElementById(i);
	var s = "";
	if (n !=null){
	   s = eval("n.style." + p);
	}
	// try inline
	if((s != "") && (s != null)) {
		return s;
	}

	// try currentStyle
	if ((n != null) && (n.currentStyle)) {
		var s = eval("n.currentStyle." + p);
		if((s != "") && (s != null)) {
			return s;
		}
	}
	
	// try styleSheets
	var sheets = document.styleSheets;
	if(sheets.length > 0) {
		// loop over each sheet
		for(var x = 0; x < sheets.length; x++) {
			// grab stylesheet rules
			var rules = sheets[x].cssRules;
			if(rules.length > 0) {
				// check each rule
				for(var y = 0; y < rules.length; y++) {
					var z = rules[y].style;
					// selectorText broken in NS 6/Mozilla: see
					// http://bugzilla.mozilla.org/show_bug.cgi?id=51944
					ugly_selectorText_workaround();
					if(allStyleRules) {
						if(allStyleRules[y] == i) {
							return z[p];
						}			
					} else {
						// use the native selectorText and style stuff
						if(((z[p] != "") && (z[p] != null)) ||
						   (rules[y].selectorText == i)) {
							return z[p];
						}
					}
				}
			}
		}
	}
	return null;
}

// allow the user to select a CSS for the site and reflect their colour choices in the menu
_fgColor = getStyleByID("global","color");
_bgColor = getStyleByID("global","backgroundColor");
_hlColor = getStyleByID("global","borderColor");

// the position for the TL of the menu varies from browser to browser
var _menuTop = 127;	// top left of main menu
var _nu = navigator.userAgent.toLowerCase();
if (_nu.indexOf("firefox")!=-1){
	_menuTop = 120;
}
else 
if  (_nu.indexOf("gecko")!=-1){
	_menuTop = 120;
}

_menuCloseDelay=500           // The time delay for menus to remain visible on mouse out
_menuOpenDelay=150            // The time delay before menus open on mouse over
_followSpeed=5                // Follow scrolling speed
_followRate=40                // Follow scrolling Rate
_subOffsetTop=10             // Sub menu top offset
_subOffsetLeft=-10            // Sub menu left offset
_scrollAmount=3               // Only needed for Netscape 4.x
_scrollDelay=20               // Only needed for Netcsape 4.x

//blue is "#4176BA";

with(menuStyle=new mm_style()){
onbgcolor = _bgColor;
oncolor= _fgColor;
onbold=true;
offbgcolor= _bgColor;
offcolor= _fgColor;
bordercolor= _fgColor;
borderstyle="solid";
borderwidth=1;
separatorcolor=_fgColor;
separatorsize="1";
padding=5;
fontsize="100%";
fontstyle="normal";
fontfamily="Verdana, Tahoma, Arial";
pagecolor=_fgColor;
pagebgcolor= _bgColor;
headercolor="#000000";
headerbgcolor= _bgColor;
subimage=_siteURL + "/images/custom_menu_arrow.gif";
subimagepadding="2";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.3)";
}

with(subMenuStyle=new mm_style()){
oncolor=_hlColor;
onbold=true;
offcolor=_hlColor;
bordercolor=_bgColor;
borderstyle="solid";
borderwidth=1;
separatorcolor=_bgColor;
separatorsize="1";
padding=5;
fontsize="100%";
fontstyle="normal";
fontfamily="Verdana, Tahoma, Arial";
pagecolor=_bgColor;
pagebgcolor=_bgColor;
headercolor="#000000";
headerbgcolor="#FFFFFF";
subimage=_siteURL + "/images/custom_menu_arrow.gif";
subimagepadding="2";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)";
outfilter="randomdissolve(duration=0.3)";
bgimage=_siteURL+"/images/custom_menu_bg2.gif";
overbgimage=_siteURL+"/images/custom_menu_bg2.gif";
}

with(milonic=new menuname("Main Menu")){
	style=menuStyle;
	top=_menuTop;
	left=10;
	alwaysvisible=1;
	orientation="horizontal";
	aI("text=Home;url="+_siteURL+"/index.shtml;status=Back To Home Page;");
	aI("text=Who We Work With;url="+_siteURL+"/who_we_work_with.shtml;status=Background Information;");
	aI("text=Services;showmenu=services;url="+_siteURL+"/services.shtml;status=Services;");
	aI("text=Training;showmenu=training;url="+_siteURL+"/training.shtml;status=Training;");
	aI("text=My Factory;showmenu=my factory;url="+_siteURL+"/my_factory.shtml;status=My Factory;");
	aI("text=Articles;url="+_siteURL+"/article_list.shtml;status=Articles;");
	aI("text=Bookstore;url=http://astore.amazon.com/changefactory-20;status=Bookstore;");
	aI("text=Downloads;url="+_siteURL+"/downloads.shtml;status=Downloads;");
	aI("text=Contact Us;url="+_siteURL+"/contact_us.shtml;status=Contact Us;");
}

with(milonic=new menuname("My Factory")){
	style=subMenuStyle;
	aI("text=Sales;url="+_siteURL+"/sales.shtml;status=Improving Sales;");
	aI("text=Hospitality;url="+_siteURL+"/hospitality.shtml;status=Improving Hospitality Performance and Reducing Risk;");
	}

with(milonic=new menuname("Training")){
	style=subMenuStyle;
	aI("text=Change Management Tips;url="+_siteURL+"/games/man_change_email_101tips2.shtml;status=Change Management Tips;");
	aI("text=Customer Service Tips;url="+_siteURL+"/games/cust_service_email_101tips2.shtml;status=Customer Service Tips;");
	aI("text=Emotional Intelligence Tips;url="+_siteURL+"/games/eq_email_101tips2.shtml;status=Emotional Intelligence Tips;");
	aI("text=EQmentor;url="+_siteURL+"/eqmentor/eqmentor.shtml;status=EQmentor;");
	aI("text=Helping Customers Buy Retail Training Toolbox;url="+_siteURL+"/training/helping_customers_buy.shtml;status=Helping Customers Buy Retail Training Toolbox;");
	aI("text=Leading Change;url="+_siteURL+"/training/leading_change.shtml;status=Leading Change;");
	aI("text=Living with Change;url="+_siteURL+"/training/coping_with_change.shtml;status=Living with Change");
	aI("text=On-line Induction Services;url="+_siteURL+"/training/online_induction.shtml;status=On-line Induction Services;");
	aI("text=Training Effectiveness Tips;url="+_siteURL+"/training/treff_email_101tips_list.shtml;status=Training Effectiveness Tips;");

	
}


with(milonic=new menuname("services")){
	style=subMenuStyle;
	aI("text=Execute;url="+_siteURL+"/services/execute.shtml;status=Execute;");
	aI("text=Remedy;url="+_siteURL+"/services/remedy.shtml;status=Remedy;");
	aI("text=Purpose;url="+_siteURL+"/services/purpose.shtml;status=purpose;");
	aI("text=eValuate;url="+_siteURL+"/services/evaluate.shtml;status=eValuate;");
	aI("text=Sales ProMap;url="+_siteURL+"/services/sales_promap.shtml;status=ProMap;");
	aI("text=Sales RaciMap;url="+_siteURL+"/services/sales_racimap.shtml;status=RaciMap;");
	aI("text=GameDesign;url="+_siteURL+"/services/gamedesign.shtml;status=GameDesign;");
	aI("text=Competency Frameworks;url="+_siteURL+"/competence_framework_general.shtml;status=Competency Frameworks;");

}

with(milonic=new menuname("login")){
	style=subMenuStyle;
	aI("text=Client Login;url="+_siteURL+"/client_login.shtml;status=Client Login;");
	aI("text=Consultant Login;url="+_siteURL+"/client_login.shtml;status=Consultant Login;");	
}


with(milonic=new menuname("search")){
	style=subMenuStyle;
	overflow="scroll";
	aI("text=Google;showmenu=subSearch;url=http://www.google.com;image="+_siteURL+"/images/custom_menu_google_icon.gif;");
	aI("text=Yahoo;url=http://www.yahoo.com;image="+_siteURL+"/images/custom_menu_yahoo_icon.gif;");
	aI("text=Excite;url=http://www.excite.com;image="+_siteURL+"/images/custom_menu_excite_icon.gif;");
	aI("text=Alta Vista;url=http://www.altavista.com;image="+_siteURL+"/images/custom_menu_av_icon.gif;");
}

with(milonic=new menuname("contact")){
	style=subMenuStyle;
	aI("text=Contact Us;url="+_siteURL+"/contact_us.shtml;");
}

with(milonic=new menuname("subSearch")){
	style=subMenuStyle;
	aI("text=International;url=http://www.google.com;");
	aI("text=Australian;url=http://www.google.com.au;");
}
drawMenus();

