// Define system location : TEST, LIVE, or LOCAL
var SYSTEM = "LIVE";

		/*********************************************************************
		 * No onMouseOut event if the mouse pointer hovers a child element 
		 * *** Please do not remove this header. ***
		 * This code is working on my IE7, IE6, FireFox, Opera and Safari
		 * 
		 * Usage: 
		 * <div onMouseOut="fixOnMouseOut(this, event, 'JavaScript Code');"> 
		 *		So many childs 
		 *	</div>
		 *
		 * @Author Hamid Alipour Codehead @ webmaster-forums.code-head.com		
		**/
		function is_child_of(parent, child) {
			if( child != null ) {			
				while( child.parentNode ) {
					if( (child = child.parentNode) == parent ) {
						return true;
					}
				}
			}
			return false;
		}
		function fixOnMouseOut(element, event, JavaScript_code) {
			var current_mouse_target = null;
			if( event.toElement ) {				
				current_mouse_target 			 = event.toElement;
			} else if( event.relatedTarget ) {				
				current_mouse_target 			 = event.relatedTarget;
			}
			if( !is_child_of(element, current_mouse_target) && element != current_mouse_target ) {
				eval(JavaScript_code);
			}
		}
		/*********************************************************************/


function MenuItem(id,h,w,t,lnk) {
	this.id = id;
	this.w = w;
	this.h = h;
	this.title = t;
	if ( lnk.match(/^http/) ) {
	
	} else {
		if ( SYSTEM == "TEST" ) {
			lnk = "http://test.flexperienceconsulting.com/cms/" + lnk;
		} else if ( SYSTEM == "LOCAL" ) {
			lnk = "http://localhost/FLX/site/" + lnk;
		} else {
			//lnk = "http://www.flexperienceconsulting.com/" + lnk;
			lnk = "" + lnk;
		}	
	}
	this.link = lnk;
}

var IMG_DIR = "images/";
var menu = new Array();
menu[0] = new MenuItem( "business",23,164,"Business Solutions","index.php?page=business");
menu[1] = new MenuItem( "talent",23,164,"Flexperience Talent","index.php?page=talent");
menu[2] = new MenuItem( "forum",23,164,"Forums &amp; Events","index.php?page=flex");
menu[3] = new MenuItem( "resources",23,100,"Resources","index.php?page=resources-newsletter");
menu[4] = new MenuItem( "about",23,100,"About Us","index.php?page=about");
menu[5] = new MenuItem( "contact",23,100,"Contact","index.php?page=contact");
function drawMenu() { 
	var html = "";
	var	evnts;
	if ( current_sub == "" ) {
		//evnts = ' onmouseover="roll_on(\'nav\',this)" ' ;
		evnts = ' onmouseover="drop_menu(\'nav\',this)" ' ;
		//evnts = ' onmouseover="roll_on(\'nav\',this)" onmouseout="roll_off(\'nav\',this)"' ;
	} else {
		evnts = ' onmouseover="drop_menu(\'nav\',this)" ' ;
		//evnts = ' onmouseover="roll_on(\'nav\',this)" onmouseout="roll_off(\'nav\',this)"' ;
	}	
	for ( i = 0; i < menu.length; i ++ ){
		var itm = menu[i];
		var imgtype = "_u";
		//var	evnts = ' onmouseover="roll_on(\'nav\',this)" ' ;
		var cls = "";
		if ( current_page == itm.id ) {
			// imgtype = "_o";
			//evnts = ' ' ;
			cls = "navmenu-on";
		} else {
			cls = "navmenu";
		}
		//html += '<a class="' + cls + '" style="width:' + itm.w + ';" id="m-' + itm.id + '" href="' + itm.link + '">';
		html += '<a ' + evnts + ' class="' + cls + '"  id="m-' + itm.id + '" href="' + itm.link + '">';
		html += itm.title;
		html += '</a>';	
		// IMAGE version
		//html += '<a class="navmenu" href="' + itm.link + '">';
		//html += '<img src="images/nav/m-' + itm.id + imgtype +'.gif" alt="' + itm.title + '" name="m-' + itm.id + '" width="' + itm.w + '" height="' + itm.h + '" border="0" id="m-' + itm.id + '" ' + evnts + '/>';
		// html += '</a>';	
	}
	return html;
}

var submenu = new Array();
submenu["forum"] = new Array();
//submenu["forum"].push ( new MenuItem( "index",21,100,"Overview","index.php?page=forum") );
submenu["forum"].push ( new MenuItem( "forum",21,150,"Annual Working Mothers Panel","index.php?page=forum1008") );
submenu["forum"].push ( new MenuItem( "flex",21,100,"Flexibility : the Future of Work","index.php?page=flex") );
submenu["forum"].push ( new MenuItem( "events",21,100,"Upcoming Events","index.php?page=forum-events") );
submenu["forum"].push ( new MenuItem( "program-2007",21,100,"Women Redefining Success Awards","index.php?page=program-2007") );
//submenu["forum"].push ( new MenuItem( "overview",21,100,"Other Resources","index.php?page=forum-res") );

submenu["business"] = new Array();
submenu["business"].push ( new MenuItem( "index",21,100,"Overview","index.php?page=business") );
submenu["business"].push ( new MenuItem( "marketing",21,100,"Marketing","index.php?page=bus-marketing") );
submenu["business"].push ( new MenuItem( "hr",21,100,"Human Resources","index.php?page=bus-hr") );
submenu["business"].push ( new MenuItem( "finance",21,100,"Finance","index.php?page=bus-finance") );
submenu["business"].push ( new MenuItem( "legal",21,100,"Legal","index.php?page=bus-legal") );

submenu["resources"] = new Array();
//submenu["resources"].push ( new MenuItem( "index",21,100,"25 Women Redefining Success Award","index.php?page=program") );
//submenu["resources"].push ( new MenuItem( "2007",21,100,"2007 Awardees","index.php?page=program-2007") );
//submenu["resources"].push ( new MenuItem( "2008",21,100,"2008 Nomination Form","index.php?page=program-2008") );
submenu["resources"].push ( new MenuItem( "newsletter",21,100,"Newsletter","index.php?page=resources-newsletter") );
submenu["resources"].push ( new MenuItem( "blog",21,100,"Sally's Blog","/blog/") );
submenu["resources"].push ( new MenuItem( "links",21,100,"Flexibility Articles &amp; Research","index.php?page=resources-links") );
//submenu["resources"].push ( new MenuItem( "qa",21,100,"Ask The Experts","index.php?page=resources-qa") );
submenu["resources"].push ( new MenuItem( "oher",21,100,"Other Resources","index.php?page=resources-other") );



submenu["about"] = new Array();
submenu["about"].push ( new MenuItem( "index",21,100,"Company History","index.php?page=about") );
submenu["about"].push ( new MenuItem( "management",21,100,"Management","index.php?page=about-management") );
submenu["about"].push ( new MenuItem( "news",21,100,"Flexperience in the News","index.php?page=about-news") );
submenu["about"].push ( new MenuItem( "press",21,100,"Press Kit","index.php?page=about-press") );
//submenu["about"].push ( new MenuItem( "links",21,100,"Links","index.php?page=about-links") );
//submenu["about"].push ( new MenuItem( "newsletter",21,100,"Newsletter","index.php?page=about-newsletter") );
submenu["talent"] = new Array();
submenu["talent"].push ( new MenuItem( "index",21,100,"Overview","index.php?page=talent") );
submenu["talent"].push ( new MenuItem( "how",21,100,"How It Works","index.php?page=talent-how") );
submenu["talent"].push ( new MenuItem( "benefits",21,100,"Why Join","index.php?page=talent-benefits") );
//submenu["talent"].push ( new MenuItem( "resume",21,100,"Submit Resume","http://careers.vurvexpress.com/registration.cfm?szWID=14577&szCID=65598&szSiteID=524&szOrderID=0") );
submenu["talent"].push ( new MenuItem( "resume",21,100,"Talent Registration","index.php?page=talent-reg") );
submenu["talent"].push ( new MenuItem( "spotlight",21,100,"In The Spotlight","index.php?page=spotlight") );
submenu["contact"] = new Array();
//submenu["contact"].push ( new MenuItem( "index",22,100,"Overview","index.php?page=talent") );



function drawSubMenu(mnu) { 
	var html = "";
	if ( mnu == null ) { 
		mnu = current_page;
	} 
	var qs = document.location.search.substring(1); 

	// attach on mouse out to 
	if ( submenu[mnu] ) {
	var m = submenu[mnu];
	var cls;
	for ( i = 0; i < m.length; i ++ ){
		var itm = m[i];

		if (( itm.link.match(new RegExp(qs + "$")) ) && (qs != "")) { 
		 cls = ' class="submenu-on" ';
	//	 cls = ' class="submenu" ';
		} else {
		 cls = ' class="submenu" ';
		}
		html += '<a  ' + cls + ' href="' + itm.link + '">';
		//html += '<img src="images/subnav/sm-' + current_page + "_" + itm.id + '_u.gif" alt="' + itm.title + '" name="sm-' + itm.id + '" width="' + itm.w + '" height="' + itm.h + '" border="0" id="sm-' + itm.id + '" onmouseover="sub_roll_on(\'subnav\',this)"/>';
		html += itm.title;
		html += '</a>';
		if ( (i+1) != m.length ) {
		//html += '<img align="center" src="images/subnav/divider.gif" alt="spacer" width="10" height="21" border="0" />';
		html += '<span class="submenu">|</span>';
		}	
	}
	
	}
	return html;
}

function drawSubMenu2(mnu) { 
	if ( mnu == null ) { 
		mnu = current_page;
	} 
	var html = "";
	var qs = document.location.search.substring(1); 

	// attach on mouse out to 
	if ( submenu[mnu] ) {
	var m = submenu[mnu];
	var cls;
	for ( i = 0; i < m.length; i ++ ){
		var itm = m[i];

		if (( itm.link.match(new RegExp(qs + "$")) ) && (qs != "")) { 
		 cls = ' class="submenu2" ';
		 //cls = ' class="submenu2-on" ';
		} else {
		 cls = ' class="submenu2" ';
		}
		html += '<a  ' + cls + ' href="' + itm.link + '">';
		//html += '<img src="images/subnav/sm-' + current_page + "_" + itm.id + '_u.gif" alt="' + itm.title + '" name="sm-' + itm.id + '" width="' + itm.w + '" height="' + itm.h + '" border="0" id="sm-' + itm.id + '" onmouseover="sub_roll_on(\'subnav\',this)"/>';
		html += itm.title;
		html += '</a>';
		if ( (i+1) != m.length ) {
		//html += '<img align="center" src="images/subnav/divider.gif" alt="spacer" width="10" height="21" border="0" />';
		}	
	}
	
	}
	return html;
}


/**
<img src="/images/subnav/how_now_a.gif" alt="spacer" width="7" height="24" border="0" id="now"/><a href="/howitworks/youmakeit.html"><img src="/images/subnav/how_you_u.gif" alt="You make it" width="76" height="24" border="0" id="you" onmouseover="sub_roll_on('subnav',this)" onmouseout="sub_roll_off('subnav',this)"/></a><img src="/images/subnav/divider.gif" alt="spacer" width="10" height="24" border="0" id="now"/><a href="/howitworks/wemakeit.html"><img src="/images/subnav/how_we_u.gif" alt="We make it" width="71" height="24" border="0" id="we" onmouseover="sub_roll_on('subnav',this)" onmouseout="sub_roll_off('subnav',this)"/></a><img src="/images/subnav/divider.gif" alt="spacer" width="10" height="24" border="0" id="now"/><a href="/howitworks/delivery.html"><img src="/images/subnav/how_delivery_u.gif" alt="Delivery" width="59" height="24" border="0" id="delivery" onmouseover="sub_roll_on('subnav',this)" onmouseout="sub_roll_off('subnav',this)"/></a><img src="/images/subnav/divider.gif" alt="spacer" width="10" height="24" border="0" id="now"/><a href="/howitworks/gourmettogo.html"><img src="/images/subnav/how_gourmet_u.gif" alt="Gourmet to go" width="99" height="24" border="0" id="gourmet" onmouseover="sub_roll_on('subnav',this)" onmouseout="sub_roll_off('subnav',this)"/></a>
**/
//pop
function popitup(url)
{
	newwindow=window.open(url,'name','height=200,width=360');
	if (window.focus) {newwindow.focus()}
}

// rollover

function roll_on(direct,divname){
	if(current_page!=divname.id){
	//	divname.src = IMG_DIR + "/"+direct+"/"+divname.id+"_o.gif";
		//divname.style.backgroundColor = "#62619A";
	}
	// draw sub menu
	//document.getElementById( "sub_nav" ).innerHTML = drawSubMenu(divname.id.split("-")[1]);
}
function roll_off(direct,divname){
	if(current_page!=divname.id){
	//	divname.src = IMG_DIR + "/"+direct+"/"+divname.id+"_u.gif";
		//divname.style.backgroundColor = "#ffffff";

	}
	//document.getElementById( "sub_nav" ).innerHTML = drawSubMenu(current_page);
}
function roll_on2(direct,divname){
	if(current_page!=divname.id){
		divname.src = IMG_DIR + "/"+direct+"/"+divname.id+"_o.jpg";
		
	}
}
function roll_off2(direct,divname){
	if(current_page!=divname.id){
		divname.src = IMG_DIR + "/"+direct+"/"+divname.id+"_u.jpg";
	}
}
function sub_roll_on(direct,divname){
if ( ! current_sub ) return;
	if(current_sub!=divname.id){
	//	divname.src = IMG_DIR + "/"+direct+"/"+subnav_parent+divname.id+"_o.gif";
	}
}
function sub_roll_off(direct,divname){
	document.getElementById( "sub_nav" ).innerHTML = drawSubMenu(null);
//if ( ! current_sub ) return;
//	if(current_sub!=divname.id){
	//	divname.src = IMG_DIR + "/"+direct+"/"+subnav_parent+divname.id+"_u.gif";
	//}
}

function drop_menu(direct,divname){
	//if ( document.getElementById ( "submenu2-" + divname ) ) {
	//	document.getElementById ( "submenu2-" + divname ).style.visiblity = "visible";
	//	return;
	//}
	var id = divname.id.split("-")[1];
	//var html = "<div  id='submenu2-" + id + "'>";
	var html = "";
	html += drawSubMenu2(id);
	//html += '</div>';
	var drp = document.getElementById ("drop_menu");
	drp.style.left = ( 0 + divname.offsetLeft ) + "px";
	drp.innerHTML = html;
}
function drop_menu_off(){
	
//do something on mouse out; 
	document.getElementById ("drop_menu").innerHTML = "";

}



function pagecheck(){
	if(current_page=="home"){
		return false;
	} else {
		return true;
	}
}

function doload(){
	//alert(document.getElementById(current_page).id);
	runit = pagecheck;
	if(runit){
		if(current_page!=""){
			document.getElementById(current_page).src = IMG_DIR + "/nav/"+current_page+"_a.gif";
		}
		if(current_subnav!=""){
			document.getElementById(current_subnav).src = IMG_DIR + "/subnav/"+subnav_parent+current_subnav+"_a.gif";
		}
	}
}

function clearPromo(img) {
	document.getElementById("img_promo").src = "images/promo0.jpg";
	document.getElementById("link_promo").href = "javascript:void();";

}
function showPromo(img) {
var PROMOS = new Array();
PROMOS["img_side1"] = new Array("images/side1.jpg","images/side1_on.jpg","images/promo1.jpg","index.php?page=business");
PROMOS["img_side2"] = new Array("images/side2.jpg","images/side2_on.jpg","images/promo2.jpg","index.php?page=talent");
PROMOS["img_side3"] = new Array("images/side3.jpg","images/side3_on.jpg","images/promo3.jpg","index.php?page=forum");
	for (i in PROMOS) {
		if ( i != "length" ) {
			document.getElementById(i).src = PROMOS[i][0];
		}
	}
	img.src = PROMOS[img.id][1];
	document.getElementById("img_promo").src = PROMOS[img.id][2];
	document.getElementById("link_promo").href = PROMOS[img.id][3];
}

/**
var current_sub="marketing";
**/
if ( this.pgtitle == null ) pgtitle = "xxx";
if ( this.current_sub == null ) current_sub = "xxx";
if ( this.current_page == null ) current_page = "xxx";

var qs = document.location.search.substring(1); 
if ( qs != "" ) {
	if ( qs.match(/hr/) ) {
	 current_sub = "hr";
	} else if ( qs.match(/legal/) ) {
	 current_sub = "legal";
	} else if ( qs.match(/finance/) ) {
	 current_sub = "finance";
	} else if ( qs.match(/marketing/) ) {
	 current_sub = "marketing";
	}
}

//alert( pgtitle + " : " + current_sub );
var pageColor = "#E0DFED";
if ( current_sub == "marketing" ) {
	pageColor = "#E1E0EE";
} else if ( current_sub == "legal" ) {
	pageColor = "#ACC2CF";
} else if ( current_sub == "hr" ) {
	pageColor = "#ACCFCB";
} else if ( current_sub == "finance" ) {
	pageColor = "#D9D7BE";
}else if ( current_sub == "hr" ) {
	pageColor = "#ACCFCB";
}
function fixUI () {
	var ele = document.getElementById("bus-block");
	
	if ( ele ) {
	
		ele.style.backgroundColor=pageColor;
	}	



}
