﻿
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function change_catagory(region, location) {
	if (region.selectedIndex == 1) {
		location.selectedIndex = 1;
	} else if (region.selectedIndex == 2) {
		location.selectedIndex = 2;
	}
}

function check_location(location, region) {
	if (location.selectedIndex > 0) {
		if (location.selectedIndex==1) {
			region.selectedIndex=1;
		} else if (location.selectedIndex == 2 || location.selectedIndex == 3) {
			region.selectedIndex=2;
		}
	}
}


function change_catagory_career(region, location) {
/*	if (region.selectedIndex == 1) {
		location.selectedIndex = 1;
	} else*/
	if (region.selectedIndex == 2) {
		location.selectedIndex = 2;
	}
}

function check_location_career(location, region) {
	if (location.selectedIndex > 0) {
		if (location.selectedIndex==1) {
			region.selectedIndex=1;
		}
	}
}



var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

function popup(link) {
	w_height=screen.availheight
	w_width=screen.availwidth
	y=(w_height/2)-300
	x=(w_width/2)-300
	w_height = 600
	w_width = 600
	window.open(link,"SAE","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width="+w_width+",height="+w_height+",left="+x+",top="+y);
}




//specify how many characters of a message (for each msg) to show in expanded menu:
var charslimit=30

//Below specifies the "expand text". Do not remove onClick=".." portion.
var expandtext='<a href="#" onClick="dropdownit(event);return false"></a>'

//configure below variables to set dimensions and main color of the ticker
var tickerwidth='258px'
var tickerheight='220px' //not including "Expand" text
var tickerbgcolor='#FFFFFF'

//configure the below variable to determine the delay between ticking of messages (in miliseconds)
var tickdelay=2500

////Do not edit pass this line////////////////

var ie4=document.all || navigator.userAgent.search(/opera.7/i)!=-1 //lump Opera 7 with IE
var ns6=document.getElementById && !document.all && !window.opera
var ns4=document.layers

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

if (ns4){
expandtext=expandtext.replace(/dropdownit\(event\); *return false/gi, "return dropdownitNS4(event,this)")
tickerheightNS4=parseInt(tickerheight)+19
tickerlistheightNS4=tickerheight
}

var currentmessage=0
var tickercontentstotal=''

if (ie4||ns6) //OUTPUT DROP DOWN MENU
document.write('<div id="tickerexpand" class="expandmenu" style="visibility:hidden"></div>')

function rotatecontent(){
if (ns4){ //OUTPUT HTML for ticker area for NS4
tickerobj.document.tickernssub.document.write(tickercontents[currentmessage]+'')
tickerobj.document.tickernssub.document.close()
}
else if (ie4||ns6){
tickerobj.innerHTML=tickercontents[currentmessage]
previousmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1
tickerexpand_item=ns6? document.getElementById("expand"+currentmessage) : eval("expand"+currentmessage)
tickerexpand_previousitem=ns6? document.getElementById("expand"+previousmessage) : eval("expand"+previousmessage)
tickerexpand_previousitem.className=""
tickerexpand_item.className="expandmenu_highlight"
}
currentmessage=(currentmessage==tickercontents.length-1)? 0 : currentmessage+1
rotatemsgtimer=setTimeout("rotatecontent()",tickdelay)
}

function dropdownit(e){
if (ns6) e.stopPropagation()
else e.cancelBubble=true
tickerexpandobj.style.visibility=tickerexpandobj.style.visibility=="hidden"? "visible" : "hidden"
expandbuttonLeft=ns6? e.pageX-e.layerX : ietruebody().scrollLeft+event.clientX-event.offsetX
expandbuttonTop=ns6? e.pageY-e.layerY : ietruebody().scrollTop+event.clientY-event.offsetY
tickerexpandobj.style.left=expandbuttonLeft+"px"
tickerexpandobj.style.top=expandbuttonTop+expandbuttonobj.offsetHeight-3+"px"
}

function dropdownitNS4(e, currentobj){
tickerexpandobj.left=tickerobj.pageX
tickerexpandobj.top=tickerobj.pageY+parseInt(tickerlistheightNS4)+tickerobj.document.expandbuttonNS4.document.height
tickerexpandobj.visibility=(tickerexpandobj.visibility=="hide")? "show" : "hide"
return false
}

function jumptomsg(whichmsg){
clearTimeout(rotatemsgtimer)
if (ie4||ns6)
tickerexpand_item.className=""
currentmessage=whichmsg
rotatecontent()
}

function initialize_ticker(){
if (ns4) document.tickernsmain.visibility="show"
tickerobj=ie4? tickerlist : ns6? document.getElementById("tickerlist") : ns4? document.tickernsmain : ""
tickerexpandobj=ie4? tickerexpand : ns6? document.getElementById("tickerexpand") : ns4? document.expandlayer : ""
expandbuttonobj=ie4? expandbutton : ns6? document.getElementById("expandbutton") : ""
for (i=0;i<tickercontents.length;i++){ //get total scroller contents
tempstringcontainer=tickercontents[i].replace(/\<[^\>]+\>/g, ''); //remove HTML tags
tickercontentstotal+='<div id="expand'+i+'">- <a href="javascript:jumptomsg('+i+')">'+tempstringcontainer.substring(0, charslimit)+'...</a></div>'
}
if (ie4||ns6){
tickerexpandobj.innerHTML=tickercontentstotal
expandbuttonobj.innerHTML=expandtext
document.onclick=function(){
tickerexpandobj.style.visibility="hidden"
}
}
else if (ns4){
tickerexpandobj.document.write(tickercontentstotal)
tickerexpandobj.document.close()
tickerexpandobj.clip.width=parseInt(tickerwidth)*0.9
tickerobj.document.expandbuttonNS4.document.write(expandtext)
tickerobj.document.expandbuttonNS4.document.close()
tickerexpandobj.captureEvents(Event.CLICK)
tickerexpandobj.onclick=function(){
tickerexpandobj.visibility="hide"
}
}
rotatecontent()
}

//function alertWin() add at 2008/12/17
function alertWin(title, msg, w, h){ 
var titleheight = "22px"; // modal height
var bordercolor = "#007ECE"; // modal color
var titlecolor = "#99CCFF"; // modal title color
var titlebgcolor = "#007ECE"; // modal title background color
var bgcolor = "#FFFFFF"; // modal background color

var iWidth = document.documentElement.offsetWidth; 
var iHeight = document.documentElement.offsetHeight; 
//background layout
var bgObj = document.createElement("div"); 
bgObj.style.cssText = "position:absolute;left:0px;top:0px;width:"+Math.max(document.body.clientWidth,iWidth,window.screen.width)+"px;height:"+Math.max(document.body.clientHeight,iHeight,window.screen.height)+"px;filter:Alpha(Opacity=30);opacity:0.3;background-color:#000000;z-index:101;";
document.body.appendChild(bgObj); 
//message layout
var msgObj=document.createElement("div");
msgObj.style.cssText = "position:absolute;font:11px 'Arial';top:"+(iHeight-h)/2+"px;left:"+(iWidth-w)/2+"px;width:"+w+"px;height:"+h+"px;text-align:left;border:1px solid "+bordercolor+";background-color:"+bgcolor+";padding:1px;line-height:22px;z-index:102;";
document.body.appendChild(msgObj);
//table in message box
var table = document.createElement("table");
msgObj.appendChild(table);
table.style.cssText = "margin:0px;border:0px;padding:0px;";
table.cellSpacing = 0;
//for IE&FF insertRow()==> insertRow(-1)
var tr = table.insertRow(-1);
var titleBar = tr.insertCell(-1);
titleBar.style.cssText = "width:100%;height:"+titleheight+"px;text-align:left;padding:3px;margin:0px;font:bold 10px 'Arial';color:"+titlecolor+";border:1px solid " + bordercolor + ";cursor:move;background-color:" + titlebgcolor;
titleBar.style.paddingLeft = "10px";
titleBar.innerHTML = title;

var closeBtn = tr.insertCell(-1);
closeBtn.style.cssText = "cursor:pointer; padding:2px;background-color:" + titlebgcolor;
closeBtn.innerHTML = "<span style='font-size:10pt; color:"+titlecolor+";'>CLOSE</span>";
closeBtn.onclick = function(){ 
   document.body.removeChild(bgObj); 
   document.body.removeChild(msgObj); 
} 
var msgBox = table.insertRow(-1).insertCell(-1);
msgBox.style.cssText = "font:10pt 'Arial';";
msgBox.colSpan = 2;
msgBox.innerHTML = msg;

// Get Event ObjectIE&FireFox
function getEvent() {
     return window.event || arguments.callee.caller.arguments[0];
    }
} 


