/*
* GENERAL PAGE FUNCTIONS
*
* requires browsersniff function (uses browser detection variables)
*
* SECTION 1: page dimension functions
* SECTION 2: preload functions
*
*/




/************************************************* PAGE DIMENSION FUNCTIONS *************************************************/

//set page variables holding minimum width and height of page
var min_width = 760;
var min_height = 400;


//vars to hold width and height of window
var win_width, win_height, screen_width, screen_height;


//function to get window and screen dimensions
//(n.b. can only be called once page has loaded)
function getDimensions() {
	//get window dimensions
	win_width = (is_ie) ? document.body.clientWidth : window.innerWidth;
	win_height = (is_ie) ? document.body.clientHeight : window.innerHeight;
	//get screen dimesnsions
	screen_width = screen.availWidth;
	screen_height = screen.availHeight;
}


//function set xy position for centered popup
//(returns string for pop up properties)
function centrePopUp(pop_width,pop_height) {
		var xpos = Math.round(((screen_width - pop_width)/2));
		var ypos = Math.round(((screen_height - pop_height)/2));
		var dim_string = 'width=' + pop_width + ',height=' + pop_height;
		//set strings depending on client browser
		if (is_nav && (is_major <= 4)) return (dim_string + ",screenX=" + xpos + ",screenY=" + ypos);
		else return (dim_string + ",left=" + xpos + ",top=" + ypos);
}

/************************************************* IMAGE ROLLOVER FUNCTIONS *************************************************/

//image preload function
function preloadImages (img_path,page_lang,image_array) {
	//create image objects and set image paths
	for (var i=0;i<image_array.length;i++) {
		eval (image_array[i] +'_off = new Image();');
		eval (image_array[i] +'_off.src = "' + img_path + page_lang + '/' + image_array[i] + '.gif"');
		eval (image_array[i] +'_on = new Image();');
		eval (image_array[i] +'_on.src = "' + img_path + img_path + page_lang + '/' + image_array[i] + '_on.gif"');
	}
	return true;	//return true
}

//rollover function for preloaded images
function rollImage (lyr_ref,img_name,img_state,preload_status) {
	if (preload_status) {
		if (document.layers) eval(lyr_ref + 'document.images.' + img_name + '.src = ' + img_name + '_' + img_state + '.src');
		else eval('document.images.' + img_name + '.src = ' + img_name + '_' + img_state + '.src');
	}
}



