// browser check

is = new Object()
is.agent = navigator.userAgent.toLowerCase()
is.op = (is.agent.indexOf("opera") != -1)
if (is.op) {
	is.op7 = (is.op && is.agent.indexOf("opera 7") != -1)
	is.op8 = (is.op && is.agent.indexOf("opera 8") != -1)
} else {
	is.ie7 = (is.agent.indexOf("msie 7") != -1)
	is.ie6 = (is.agent.indexOf("msie 6") != -1)
	is.ie55 = (is.agent.indexOf("msie 5.5") != -1)
	is.ie5 = (!is.ie55 && is.agent.indexOf("msie 5") != -1)
	is.ns7 = (is.agent.indexOf("netscape/7") != -1)
	is.ns6 = (is.agent.indexOf("netscape/6") != -1)
	is.moz = (!is.ns7 && !is.ns6 && is.agent.indexOf("gecko") != -1)
	is.ffox = (is.agent.indexOf("firefox") != -1)
}
is.ie = (is.ie5 || is.ie55 || is.ie6 || is.ie7)
is.ns = (is.ns6 || is.ns7 || is.moz || is.ffox)
is.dom = (is.ie || is.ns || is.op7 || is.op8)

//window.focus()

if (!is.dom && !is.op) {
	//alert("You are not using a standards compliant browser or are using an older browser.\rYou may not be able to view ITP.net in it's entirety and will not be able to use certain functions as intended or not at all.\r\rPlease upgrade you browser to one of the latest versions of either Internet Explorer, Netscape, Mozilla or Opera.")
}


// cell rollover functions with submenu

var menuArray = new Array("","mags","spevents","itpdirect","events","live","online","recruitment","resources","contacts")

function cellOver(eObj,wCell,sText,wClass) {
  var wLink = wCell.id
	x = eval(wLink.length - 4)
	wLink = wLink.substr(0,x)
	var wLayer = document.getElementById(wLink + "Layer")
	if (wClass == 1) {
		if (eObj != wLink) {
			wCell.className = "lnover"
		}
	}
	else if (wClass == 2) {
		if (eObj != wLink) {
			wCell.className = "sublnover"
		}
	}
	else if (wClass == 3) {
		if (eObj != wLink) {
			wCell.className = "sublnover"
		}
	}
	if (wLayer) {
		wLayer.style.visibility = "visible"
		if (is.ie) {
			allSelect = document.body.getElementsByTagName("SELECT")
			for(i = 0; i < allSelect.length; i++) {
				allSelect[i].style.visibility = "hidden"
			}
		}
	}
	for(i = 1; i <= menuArray.length; i++) {
		if (menuArray[i] != wLink) {
			wLayer = document.getElementById(menuArray[i] + "Layer")
			if (wLayer) wLayer.style.visibility = "hidden"
		}
	}
	setStatus(sText)
}	

function cellOut(eObj,wCell,sText,wClass,setToggle) {
  var wLink = wCell.id
	x = eval(wLink.length - 4)
	wLink = wLink.substr(0,x)
	var wLayer = document.getElementById(wLink + "Layer")
	if (wClass == 1) {
		if (eObj != wLink) {
			wCell.className = "lnoff"
		}
	}
	else if (wClass == 2) {
		if (eObj != wLink) {
			wCell.className = "sublnoff"
		}
	}
	else if (wClass == 3) {
		if (eObj != wLink) {
			wCell.className = "sublnoff"
		}
	}
	if (setToggle == "allow") {
		if (wLayer) wLayer.style.visibility = "hidden"
		if (is.ie) {
			allSelect = document.body.getElementsByTagName("SELECT");
			for(i = 0; i < allSelect.length; i++) {
				allSelect[i].style.visibility = "visible"
			}
		}
	}
	setStatus(sText)
}

function cellLoad(eObj,wClass,eLink) {
	if (eObj) {
		wCell = document.getElementById(eObj + "Cell")
		if (eLink == 1) {
			document.getElementById(eObj).className = "lnlinkson"
			wCell.className = "lnon"
		}
		else if (eLink == 2) {
			document.getElementById(eObj).className = "sublnlinkson"
			wCell.className = "sublnon"
		}
		else if (eLink == 3) {
			document.getElementById(eObj).className = "sublnlinkson"
			wCell.className = "sublnon"
		}
		wImg = document.getElementById(eObj + "Img")
		if (wImg) {
			if (wImg.getAttribute('wside') == "r") wImg.src = "/pictures/furniture/arrow_r_w.gif"
			if (wImg.getAttribute('wside') == "d") wImg.src = "/pictures/furniture/arrow_d_w.gif"
		}
	}
}

function tableOut(sText,wLink) {
	for(i = 1; i <= menuArray.length; i++) {
		if (menuArray[i] != wLink) {
			wLayer = document.getElementById(menuArray[i] + "Layer")
			if (wLayer) wLayer.style.visibility = "hidden"
		}
	}
	if (is.ie) {
		allSelect = document.body.getElementsByTagName("SELECT")
		for(i = 0; i < allSelect.length; i++) {
			allSelect[i].style.visibility = "visible"
		}
	}
	setStatus(sText)
}


// cell click function

function cellClick(cLink,wTarget) {
	if (cLink != '') {
		if (wTarget == '_blank') {
			window.open(cLink)
		}
		else {
			self.location.href = cLink
		}
	}
}


// set status bar text

window.defaultStatus = "ITP Corporate"

function setStatus(sText) {
  	window.status = sText
  	return true
}


// date

var d = new Date()
var dyArray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var dysArray=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
var mtArray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
dt = d.getDate()
dy = d.getDay()
mt = d.getMonth()
yr = d.getFullYear()

function writeFullDate() {
	document.write(dyArray[dy] + ", " + mtArray[mt] + " " + dt + ", " + yr)
}

function writeYear() {
	if (yr != 2001) y = document.write(yr + ". ")
}


// jump menu

function jumpTo(wSelect,wWindow) {
	wURL = wSelect.options[wSelect.selectedIndex].value
	if (wURL != '') {
		if (wWindow == 'new') {
			window.open('http://www.' + wURL)
		}
		else {
			document.location.href = wURL
		}
	}
}

// open print window

function getPrintWin(wURL){
	setAttr = 'width=660,height=450,top=50,left=50'
	setAttr += ',titlebar=1,toolbar=1,location=0,menubar=1,scrollbars=1,resizable=0,channelmode=0,directories=0,status=0,maximize=no'
	var ppWin = window.open('', 'printWindow', setAttr, true)
	ppWin.location = 'printerfriendly/' + wURL
	ppWin.focus()
}


