/*
------------------------------
*
*	Periscope.com
*	global.js
*
*
------------------------------
*/

if(navigator.appName.indexOf("MSIE") > -1 || navigator.appName.indexOf("Microsoft") > -1) {
	var isIE = true;
} else {
	var isIE = false;
}

function randomHomeImg() {
	if(document.getElementById('homeBG') != null){
		var img = document.getElementById('homeBG');
		var picCount = 12;
		var randNum = Math.floor(Math.random() * picCount);
		var imgArray = new Array();
		
		for(i = 0; i <= picCount; i++) {
			if(i < 10) {
				imgArray.push('/img/home/homeBG_0' + i + '.jpg');
			} else {
				imgArray.push('/img/home/homeBG_' + i + '.jpg');
			}
		}
		
		img.src = imgArray[randNum];
	}
}

// Nav Rollovers
function rollOver(target) {
	document.getElementById(target).src = "/img/topNav/" + target + "_on.jpg";
}
function navOver(target) {
	new Effect.Move(target, { x: 0, y: 0, mode: 'absolute', duration:0.2 });

}
function navOut(target) {
	if(element != target) {
		new Effect.Move(target, { x: 0, y: -14, mode: 'absolute', duration:0.2 });
	}

}
function rollOut(target) {
	document.getElementById(target).src = "/img/topNav/" + target + "_off.jpg";
}
function changeImage(img, path){
	img.src = path;
}
function changeImages(img, path, id, cl){
	img.src = path;
	document.getElementById(id).className = cl;
}
function showPopout() {
	document.getElementById("subArrow").style.display = "inline";
	document.getElementById("navPopout").style.display = "block";
}
function hidePopout() {
	if(document.getElementById("subArrow") != null){
		document.getElementById("subArrow").style.display = "none";
		document.getElementById("navPopout").style.display = "none";
	};
}

// site search
function searchIn(box) {
	if(box.value == "Search"){
		box.value = "";
		box.style.fontStyle = "normal";
	}
}
function searchOut(box) {
	if(box.value == "") {
		box.value = "Search";
		box.style.fontStyle = "italic";
	}
}
function sendSearchForm() {
	var frm = document.getElementById("searchForm");
	document.location.href="/search/site/"+frm.q.value;
}

// for Talent page
function swapPics() {
	document.getElementById('picContainer').style.display = "none";
	Effect.toggle('picContainer','appear', {duration:0.5, delay:0.2});
	//Effect.Grow('picContainer');
	//Effect.BlindDown('picContainer');
}