/*
 General site functions for jwb.com.au
 Author:  Webtrix.com.au
 Modified: 22/09/2005
*/

// ********************* Preload rollover images *******************************

var numMenuItems = 5;
var menuName = new Array();

menuName[0] = "About";
menuName[1] = "Solutions";
menuName[2] = "Download";
//menuName[3] = "CompanyBrochure";
menuName[4] = "Market Research";
menuName[3] = "Contact";

var numSubMenuItems = 9;

/* Highlights particular 'arrow' according to submenu */
function highlight(menuNum) {
	//Clear
	for (var j=0; j<numSubMenuItems; j++) {
		document.getElementById('arrow'+j).style.visibility = "hidden";
	}
	if (menuNum != -1){
		document.getElementById('arrow'+menuNum).style.visibility = "visible";		
	}
}

/*
	Set's Menu item to Red whilst it is active 
   	- called by changeMenu() 
*/
function setColorActive(item_number) {

	// Unhighlight all
	document.getElementById('aboutdiv1').style.color = "#666666";		
	document.getElementById('markdiv1').style.color = "#666666";	
	document.getElementById('subscribediv1').style.color = "#666666";			
	document.getElementById('contactdiv1').style.color = "#666666";			
	document.getElementById('markresdiv1').style.color = "#666666";			
		
	switch (item_number) {
	case 1 :		
		document.getElementById('aboutdiv1').style.color = "#FF0000";
		break;
	case 2 :		
		document.getElementById('markdiv1').style.color = "#FF0000";			
		break;
	case 3 :		
		document.getElementById('subscribediv1').style.color = "#FF0000";			
		break;		
	case 4 :		
		document.getElementById('contactdiv1').style.color = "#FF0000";			
		break;			
	case 5 :		
		document.getElementById('markresdiv1').style.color = "#FF0000";			
		break;			
	}
}

/* Method that runs on mouseover for each menu item */
function changeMenu(item_num) {
	highlight(-1);
	
	if ((item_num <= numMenuItems) && (item_num > 0)){
		// Hide all divs
		for (var j=1; j<=numMenuItems; j++) {
			document.getElementById('textdiv'+j).style.visibility = "hidden";
		}

		// Highlight the currently active div
		document.getElementById('textdiv'+item_num).style.visibility = "visible";	
		document.getElementById('breadcrumbLocation').innerHTML	 = menuName[item_num-1];


		//If we're using the red > signs for menu 2.
		if (item_num == 2) { highlight(0); } 

		setColorActive(item_num);
	}

}

/************ Handles 'id' argument passing between pages ****************/
var loc = new String(window.document.location);
var id = loc.indexOf("id=");
var idNumber;
/* debug */
//	document.write(id + "<br>");
//	document.write(loc.substr(id,4) + "<br>"); 
//	document.write(loc.substring(id+3,id+4));

	switch(loc.substring(id+3,id+4)) {
		case "1" :
			idNumber = Number(loc.substring(id+3,id+4));
			break;
		case "2" :
			idNumber = Number(loc.substring(id+3,id+4));
			break;	
		case "3" :
			idNumber = Number(loc.substring(id+3,id+4));
			break;
		case "4" :
			idNumber = Number(loc.substring(id+3,id+4));
			break;		
		case "5" :
			idNumber = Number(loc.substring(id+3,id+5));
			break;		
		default:
			idNumber = 1;
			break;				
	}

