/*
$Id: js_functions.inc.js 4404 2008-11-12 02:33:06Z fesh $
*/
function popup_image(image_url, title) {
	var winl = (screen.width - 200)/2;
	var wint = (screen.height - 300)/2;
	var settings ='top='+wint+',';
	settings +='left='+winl+',';
	settings +='width=200, ';
	settings +='height=300, ';
	settings +='scrollbars=no,';
	settings +='resizable=yes';

	title = title.replace(/\s/g, '%20');

	win=window.open('image_popup.php?image_url='+image_url+'&title='+title, 'image',settings);

	if(parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}

function popup_gallery(g, i, w, h) {
	var winl = (screen.width - 700)/2;
	var wint = (screen.height - 500)/2;
	var settings ='top='+wint+',';
		settings +='left='+winl+',';
		settings +='width=700, ';
		settings +='height=500, ';
		settings +='scrollbars=no,';
		settings +='resizable=yes';

	win=window.open('/gallery_popup.php?g='+g+'&i='+i+'&w='+w+'&h='+h, 'image',settings);

	if(parseInt(navigator.appVersion) >= 4) {
	   win.window.focus();
	}
}

function popup_window(url, width, height) {
	var winl = (screen.width - width)/2;
	var wint = (screen.height - height)/2;
	var settings ='top='+wint+',';
		settings +='left='+winl+',';
		settings +='width='+width+',';
		settings +='height='+height+',';
		settings +='scrollbars=no,';
		settings +='resizable=yes';

	win=window.open(url,'window',settings);

	if(parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings  ='height='+h+',';
		settings +='width='+w+',';
		settings +='top='+wint+',';
		settings +='left='+winl+',';
		settings +='scrollbars='+scroll+',';
		settings +='resizable=yes';

	win=window.open(mypage,myname,settings);

	if(parseInt(navigator.appVersion) >= 4){
		win.window.focus();
	}
}

/* preload images */
if (document.images) {
	var spacerOn = new Image();
	spacerOn.src = "images/spacer.gif";
}

var images = new Array();

images[0] = "/images/headerimages/headerimage1.jpg";
images[1] = "/images/headerimages/headerimage2.jpg";
images[2] = "/images/headerimages/headerimage3.jpg";
images[3] = "/images/headerimages/headerimage4.jpg";

function ShowImg() {
	var number = images.length;
	var increment = Math.floor(Math.random() * number);
	var strTemp ='<img src="' + images[increment] + '">';
	document.write(strTemp);
}

var rotate = 5000;
var count = 0;

function RotateImg(myImage) {
	myImage.src=images[count];
	count++;
	if (count==images.length) {
		count = 0;
	}
	setTimeout("RotateImg(myImage)",rotate);
}
