
if(document.images) {

	alloff = new Image()
	alloff.src = "gifs/global/all-off.gif"
	home = new Image()
	home.src = "gifs/global/home-on.gif"
	stra = new Image()
	stra.src = "gifs/global/strat-on.gif"
	crea = new Image()
	crea.src = "gifs/global/creative-on.gif"
	dev = new Image()
	dev.src = "gifs/global/dev-on.gif"
	serv = new Image()
	serv.src = "gifs/global/services-on.gif"
	soft = new Image()
	soft.src = "gifs/global/soft-on.gif"
	corp = new Image()
	corp.src = "gifs/global/corp-on.gif"
	news = new Image()
	news.src = "gifs/global/news-on.gif"
	spacer = new Image()
	spacer.src = "gifs/global/spacer.gif"	
}

// browser detection

var isNS, isIE, isIEpc, isIEmac, isNSpc, isNSmac, isIE4

function detect() {

	var agt=navigator.userAgent.toLowerCase()
	var ver=navigator.appVersion.toLowerCase()

	isNS = (document.layers)? true:false
	isIE = (document.all)? true:false 

	if (isNS) {
	 
	 if (agt.indexOf("macintosh") > 0) {
	 	isNSmac = true
	 } else if (agt.indexOf("windows") > 0) {
	 	isNSpc = true
	 }
	 
	} else if (isIE) {
	 
	 if (agt.indexOf("mac_powerpc") > 0) {
	 	isIEmac = true
	 	if (ver.indexOf("msie 4") > 0) {
	    	isIE4 = true
	 	} else {
	 		isIE4 = false
	 	}
	 } else if (agt.indexOf("windows") > 0) {
	 	isIEpc = true
	  	if (ver.indexOf("msie 4") > 0) {
	    	isIE4 = true
	 	} else {
			isIE4 = false
		}	
	 } 
	 
	}
}


function off(imgName)
{
 if(document.images)
 {
   	imgOff = eval(imgName + ".src");
   	document["mapimg"].src=imgOff;
 }
}


function over(imgName)
{
 if(document.images)
 {
   	imgOn=eval(imgName+".src");
   	document["mapimg"].src=imgOn;
 }
}



function shiftTo(obj,x,y) {
 if (isNS) {
  obj.moveTo(x,y)
 } else {
  obj.pixelTop = y
  obj.pixelLeft = x
 }
 
}

function getInnerWindowHeight () {
 if (isNS) {
  return window.innerHeight
 } else {
  return document.body.clientHeight
 }
}

function getInnerWindowWidth () {
 if (isNS) {
  return window.innerWidth
 } else {
  return document.body.clientWidth
 }
}

function getObjWidth (obj) {
 if (isNS) {
  return obj.clip.width
 } else {
  return obj.clientWidth
 }
}

function getObjHeight (obj) {
 if (isNS) {
  return obj.clip.height
 } else {
  return obj.clientHeight
 }
}


function loadImgs () {

	document.images["flagMovie"].src = "./gifs/stories/flag-" + storyArray[0][0]

	for (i=1;i < 9;i++) {
		document.images["thumbNail"+i].src = "./gifs/stories/icon-" + storyArray[i][0]
	}	
	
}

function getURL (item) {
	
	var x
	
	if (isNaN(item))  {
		x = 0
		setTimeout("location.href = storyArray[0][1]",1)
		
	} else {
		x = item	
		setTimeout("location.href = storyArray[" + x + "][1]",1)
		
	}
	
}

function centerAll () {

 if (isNS) {

  var obj = document.layers["container"]
  var conObj = document.layers["container"]

  var obj2 = document.layers["textCon"]

  var y = document.layers["conLoc"].pageY

 } else {
  var obj = document.all["container"].style
  var conObj = document.all["container"]

  var obj2 = document.all["textCon"].style

  var y = document.all["conLoc"].offsetTop
 }


 var x = Math.round((getInnerWindowWidth()/2)-(getObjWidth(conObj)/2))
 var x2 = x + 160
 
 // adjust layer positions based on platform
 if (isNS) {
	shiftTo(obj,x-8,y-5)
	shiftTo(obj2,x2,y)
 } else if (isIEmac){

 	if (isIE4) {
     shiftTo(obj,x-1,y-5)
     shiftTo(obj2,x2+10,y)
 	} else {
     shiftTo(obj,x,y+10)
     shiftTo(obj2,x2,y+14)
    }
    
 } else if (isIEpc) {
    shiftTo(obj,x+10,y-5)
    shiftTo(obj2,x2+10,y) 
 } else {
    shiftTo(obj,x-1,y-5)
    shiftTo(obj2,x2+10,y)
 }

 hide()

}


function show(roID) {
 if (isNS) {
  writeLayer(roID)
  document.layers["container"].visibility = "show"
  document.layers["textCon"].visibility = "show"
 } else {
  writeLayer(roID)
  document.all["container"].style.visibility = "visible"
  document.all["textCon"].style.visibility = "visible"
 }
}

function hide() {
 if (isNS) {
  document.layers["container"].visibility = "hide"
  document.layers["textCon"].visibility = "hide"
 } else {
  document.all["container"].style.visibility = "hidden"
  document.all["textCon"].style.visibility = "hidden"
 }
}

function writeLayer (roID) {
  newText = "<font style='color:#ffffff;font: 10px Verdana, Helvetica'>" + storyArray[roID][2] + "</font>"
 if (isNS) {
  lyr = document.layers["textCon"].document
  lyr.open()
  lyr.write(newText)
  lyr.close()
 } else {
  document.all["textCon"].innerHTML = newText
 }

}

function handleResize() {
 location.reload()
 centerAll()
}


