// JavaScript Document


function showPDF(zeURL,name,features) {
	var ppdf=window.open(zeURL,'zePDF','width=850,height=550,scrollbars=1,resizable=1'); 
	
	try { ppdf.focus(); } catch(e) {}
	
}


function showWindow(zeURL,width,height) {
	var swin=window.open(zeURL,'zeShowWindow','width=' + width + ',height=' + height + ',scrollbars=1,resizable=1');
	
	try { swin.focus(); } catch(e) {}
}



// collapsing sections i.e. Investors FAQ
function trigger_effect(src_element,div_id, effect){
		Effect.toggle(div_id, effect, {duration: .15, afterFinish:function(){
		image = src_element.getElementsByTagName('img')[0];
		image.src = image.src.match('/_img/icon.more.gif') ? '/_img/icon.less.gif' : '/_img/icon.more.gif';
		}});
		return true;
	}



function deployElementOnLoad(zedivname) {
	trigger_effect(document.getElementById(zedivname+'Parent'),document.getElementById(zedivname),'blind');
}








// create random splash image for interior pages
function rnd_splash(){
	var myimages=new Array()
		//specify random images below. You can have as many as you wish
		myimages[1]="splash1"
		myimages[2]="splash2"
		myimages[3]="splash3"
		myimages[4]="splash4"
		myimages[5]="splash5"
		myimages[6]="splash6"
		myimages[7]="splash7"
		myimages[8]="splash8"
		myimages[9]="splash9"
		myimages[10]="splash10"
		myimages[11]="splash11"
		myimages[12]="splash12"
		myimages[13]="splash13"
		myimages[14]="splash14"
		myimages[15]="splash15"
	
	var ry=Math.floor(Math.random()*myimages.length)
	
	if (ry==0)
		ry=1
		document.write('<img src="/_img/splash/interior/' + myimages[ry] + '.jpg'+'" alt="" />')
}


// used for the show/hide content of bios in the About section

function gimmeMoreContent(whoisit) {
		Effect.BlindDown('content'+whoisit, {duration: .15});
		Effect.Fade('more'+whoisit, {duration: .15});
		Effect.Appear('less'+whoisit, {duration: .15});
	}
	
	
	function gimmeLessContent(whoisit) {
		Effect.BlindUp('content'+whoisit, {duration: .15});
		Effect.Appear('more'+whoisit, {duration: .15});
		Effect.Fade('less'+whoisit, {duration: .15});
	}




// profiles (Career home page)
function showSlide (divID) {
	document.getElementById(divID).style.display="block";
}

function hideSlide (divID) {
	document.getElementById(divID).style.display="none";
}
// end function



// cookie code. Thx ppk.

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


// On language selection page: if cookie set, redirect to that preference.
function gotoLangPref() {
	Preference=readCookie('lng');
	if (Preference!=null) 
		 {window.location=Preference+"/"}
}