var popUp = null;	

function jobs_popUp(URL){
  	var lnk = '/jobs/common/frameset_jobs_popup.jhtml?frameURL=' + escape(URL);	
	remote = window.open(lnk,"jobsPopUp","resizeable,scrollbars=1,resizable=1,toolbar=0,location=0,directories=0,status=1,menubar=0,width=750,height=450,screenX=0,screenY=0,left=0,top=0");
	remote.focus();
}

function applynow_popUp(URL){
	scrollOpen(URL,'applynow_popUp',750,450,0,0,'scrollbars=1,resizable=1,location=0,toolbar=0,status=1,');
}

function flashPopUp(mediaAsset){
popUpClose();
popUp = window.open("/jobs/jobs_us/work_we_offer/flash/flash.jhtml?document="+mediaAsset,"advisorpopup","scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,width=500,height=350,screenX=100,screenY=100,left=100,top=100"); 
}

function flashPopUpIntro(){
popUpClose();
popUp = window.open('/jobs/jobs_us/work_we_offer/flash/flashIntro.html',"advisorpopup","scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,width=500,height=350,screenX=100,screenY=100,left=100,top=100"); 
}
					
//function selectcollege_popUp(cURL){
//popUpClose();
//popUp = window.open(cURL,"collegepopup","scrollbars=yes,toolbar=yes,location=yes,directories=0,status=yes,menubar=yes,width=780,height=450,screenX=100,screenY=100,left=100,top=100"); 
//}

function selectcollege_popUp(URL){
//window.open(URL,'selectcollege_popUp','scrollbars=1,resizable=1,location=0,toolbar=0,status=1,width=750,height=450,screenX=0,screenY=0,left=0,top=0');
window.open(URL,'selectcollege_popUp');
}
					
function filePopUp(sl,w,h){
popUpClose();
wWin = parseInt(w)+20;
hWin = parseInt(h)+80;
if (wWin<=99) wWin = 400;
if (hWin<=99) hWin = 500;
var pos = sl.indexOf('.');
if(pos>=0) {
popUp = window.open("/jobs/common/simplefile_popup.jhtml?w="+w+"&h="+h+"filepath="+sl,"filepopup","scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,width="+wWin+",height="+hWin+",screenX=30,screenY=30,left=30,top=30"); 
}
}

function mediaPopUp(sl,w,h){
popUpClose();
wWin = parseInt(w)+35;
hWin = parseInt(h)+100;
if (wWin<=199) w = 400;
if (hWin<=199) h = 500;

popUp = window.open("/jobs/common/media_popup.jhtml?sitelocation="+sl,"mediapopup","scrollbars=1,toolbar=0,location=0,directories=0,status=0,menubar=0,width="+wWin+",height="+hWin+",screenX=30,screenY=30,left=30,top=30"); 
}

function popUpClose() {
		if (popUp && !popUp.closed) {
			popUp.close()
		}
}

/* select region code */

var delay;
var selectStatus = null;
function regionSelect(status) {
	if (selectStatus == null){
		selectStatus = 'show';
	}
	if (status == 'active'){
		clearInterval(delay);
	}
	else if (status == 'switch') {
		if (selectStatus == 'show') {
			selectShow();
		}
		else if (selectStatus == 'hide') {
			selectHide();
		}
		clearInterval(delay);
	}
	if (status == 'hide') {
		selectHide();
	}
	if (status == 'show') {
		selectShow();
	}
	if (status == 'delayhide') {
		selectSataus = 'hide';
		delay = setInterval("regionSelect('switch')", 1000);
	}
}
function selectShow(){
	lastIndex = null;
	index = null;
	resetTable();
	drawTable();
	selectStatus = 'hide';
}
function selectHide() {
	var floorVer = Math.floor(ua.ver);	
	if ( (ua.nn) && (floorVer == 4) ) {
	hide('nsRegiondropdown');
	hide('nsRegiondropdownBuffer');
	}
	else if ( (ua.nn) && (ua.ver >= 5) ) {
	hide('ieRegiondropdown');
	hide('ns6RegiondropdownBuffer');
	}
	else if ( (ua.ie) && (ua.ver >= 4) ) {
	hide('ieRegiondropdown');
	hide('spanDropDown');
	}
	selectStatus = 'show';
}

var lastIndex = null;
var index = null;

var inabg = 'cccccc';
var abg = '000099';

var urls = new Array();
var links = new Array();
var bgcolors = new Array();
var txtstyle = new Array();

function resetTable(){
links[0] = 'North America';
links[1] = 'Latin America';
links[2] = 'Europe';
links[3] = 'Australia';
links[4] = 'MiddleEast/Africa';
links[5] = 'Asia';

urls[0] = 'href="/jobs/selectregion.jhtml?type=na"';
urls[1] = 'href="/jobs/selectregion.jhtml?type=la"';
urls[2] = 'href="/jobs/selectregion.jhtml?type=eu"';
urls[3] = 'href="/jobs/selectregion.jhtml?type=au"';
urls[4] = 'href="/jobs/selectregion.jhtml?type=mea"';
urls[5] = 'href="/jobs/selectregion.jhtml?type=asia"';

bgcolors[0] = inabg;
bgcolors[1] = inabg;
bgcolors[2] = inabg;
bgcolors[3] = inabg;
bgcolors[4] = inabg;
bgcolors[5] = inabg;

txtstyle[0] = 'inatext';
txtstyle[1] = 'inatext';
txtstyle[2] = 'inatext';
txtstyle[3] = 'inatext';
txtstyle[4] = 'inatext';
txtstyle[5] = 'inatext';
}
resetTable();

function changeTable(n) {

if (lastIndex != null){
bgcolors[lastIndex] = inabg;
txtstyle[lastIndex] = 'inatext';
}
index = n;
if (lastIndex != index){
bgcolors[index] = abg;
txtstyle[index] = 'atext';
drawTable();
}lastIndex = n;
}

function getNeTable() {
var start = '<table width="123" border="1" cellpadding="0" cellspacing="0" bgcolor="#cccccc"><tr><td width="123">';
var end = '</td></tr></table>';
var middle = ' ';
	for(i = 0; i<links.length; i++) {
		var newSection = '<table width="123" border="0" cellpadding="0" cellspacing="0" bgcolor="#cccccc"><tr><td width="123" valign="top" align="left" bgcolor="#' +bgcolors[i]+ '" class="featureText2"> <a ' +urls[i]+ ' class="' +txtstyle[i]+ '" onmouseover="changeTable(' + i +')">&nbsp;&nbsp;' +links[i]+ '</a> </td></tr></table>';
		middle = middle + newSection;
	}
var table = start + middle + end;
return table;
}

function getIETable() {
var table = ' ';
	for(i = 0; i<links.length; i++) {
		var newSection = '<span style="width:120; background-color:' +bgcolors[i]+ '" > <a ' +urls[i]+ ' class="' +txtstyle[i]+ '" onmouseover="changeTable(' + i +')">&nbsp;&nbsp;' +links[i]+ '</a> </span><br>';
		table = table + newSection;
	}
return table;
}

function getElseTable() {
var start = '</td></tr>';
var end = '<td><tr>';
var middle = ' ';
	for(i = 0; i<links.length; i++) {
		var newSection = '<table rules="none" width="123" border="0" cellpadding="0" cellspacing="0" bgcolor="#cccccc"><tr><td width="123" valign="top" align="left" bgcolor="#' +bgcolors[i]+ '" class="featureText2"> <a ' +urls[i]+ ' class="' +txtstyle[i]+ '" >&nbsp;&nbsp;' +links[i]+ '</a> </td></tr></table>';
		middle = middle + newSection;
	}
var table = start + middle + end;
return table;
}

function drawTable() {
var floorVer = Math.floor(ua.ver);	
if (ua.nn && (floorVer == 4)) {
		var theTable = getNeTable();
       	layer = "nsRegiondropdown";
		buffer = "nsRegiondropdownBuffer";
		document.layers[layer].visibility = 'hide';
        document.layers[layer].document.write(theTable);
        document.layers[layer].document.close();
		if (index == null) { 	
			 document.layers[buffer].visibility = 'hide';
	         document.layers[buffer].document.write(theTable);
	         document.layers[buffer].document.close();
	         document.layers[buffer].moveTo(579, 204);
	         document.layers[buffer].visibility = 'show';
		}
        document.layers[layer].moveTo(579, 204);
        document.layers[layer].visibility = 'show';
}
else if (ua.nn && (ua.ver >= 5)) {
		var theTable = getNeTable();
		d = "ieRegiondropdown";
		b = "ns6RegiondropdownBuffer";
		div = document.getElementById(d);
		buffer = document.getElementById(b);
        div.style.visibility = 'hidden';
        div.innerHTML = theTable;
        if (index == null) { 	
			 buffer.style.visibility = 'hidden';
        	 buffer.innerHTML = theTable;
        	 buffer.style.visibility = 'visible';
		}
        div.style.visibility = 'visible';
}
else if (ua.ie && (ua.win >0) && (ua.ver >= 4)) {
		var theTable = getIETable();
		div = "spanDropDown";
		document.all[div].innerHTML = theTable;
        document.all["ieRegiondropdown"].style.visibility = 'visible';
		document.all[div].style.visibility = 'visible';
}
else if (ua.ie && (ua.mac >0) && (ua.ver >= 5)) {
		var theTable = getIETable();
		div = "spanDropDown";
		document.all[div].innerHTML = theTable;
        document.all["ieRegiondropdown"].style.visibility = 'visible';
		document.all[div].style.visibility = 'visible';
}
else    { 
		var theTable = getElseTable();
		div = "spanDropDown";
		document.all[div].innerHTML = theTable;
        document.all["ieRegiondropdown"].style.visibility = 'visible';
		document.all[div].style.visibility = 'visible';
}
}

//flash - parent load specific functions

function loadOpener(filepath) {
	if (opener){
		if ((getPath(opener.location.toString())) != filepath)opener.location = filepath;
	}
}

function getPath(f){
 	var t = f.substring(7, f.length);
	var p = t.substring(t.indexOf('/'), t.length);
	return p;
}

function itLink(){
	loadOpener('jobs/jobs_us/cac/f_ids_home.shtml');
	setInterval("window.close()", 3000);
}

