/*
* These are the JavaScript functions specific to the live website
*/

function imgPopup(mypage,myname,w,h,pos,infocus){
	sw = window.screen.width;
	sh = window.screen.height;

	w = w+20; //allow for image border
	h = h+20;
	maxwidth = sw - 40;
	maxheight = sh - 30;
	scroller = 'no';
	if(w > maxwidth){
		w = maxwidth;
		scroller = 'yes';
	}	
	if(h > maxheight){
		h = maxheight;
		scroller = 'yes';
	}
	
	if(pos=='random'){
	LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
	TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
	if(pos=='center'){
	LeftPosition=(screen.width)?(screen.width-w)/2:100;
	TopPosition=(screen.height)?(screen.height-h)/2:100;}
	else if((pos!='center' && pos!='random') || pos==null){LeftPosition=100;TopPosition=100;}settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=yes,scrollbars='+scroller+',resizable=no,dependent=no';
	lgflPopupWindow=window.open('',myname,settings);
	if(infocus=='front'){lgflPopupWindow.focus();lgflPopupWindow.location=mypage;}
}

function searchCheck(id){
   	if(!document.form.searchWords.value){
		alert("Please add a search word before clicking submit");
		return false;
	}
	else{
		return true;
	}	
}

function setEmailTarget(id){ //set the target to be the iframe if javascript is enabled
	if(document.getElementById){
		document.getElementById('CMSemail'+id).target='CMSiframe'+id;
	}
}


