function getWindowWidth( who) {
	return ($(who).innerWidth || document.documentElement.clientWidth || document.body.clientWidth || 0);
}
function getWindowHeight( who ){
	return ($(who).innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0);
}
function getDocumentWidth(who){
	return Math.min(document.body.scrollWidth,getWindowWidth(who));
}
function getDocumentHeight(who){
	return Math.max(document.body.scrollHeight,getWindowHeight(who));
}

function Center( who ){
	var dimensions = $(who).getDimensions();
	Position.prepare();
	var offset_left = (Position.deltaX + Math.floor((getWindowWidth(who) - dimensions.width) / 2));
	var offset_top = (Position.deltaY + ((getWindowHeight(who) > dimensions.height) ? Math.floor((getWindowHeight(who) - dimensions.height) / 2) : 0));
	$(who).setStyle({
		top: ((dimensions.height <= getDocumentHeight(who)) ? ((offset_top != null && offset_top > 0) ? offset_top : '10') + 'px' : 10),
		left: ((dimensions.width <= getDocumentWidth(who)) ? ((offset_left != null && offset_left > 0) ? offset_left : '10') + 'px' : 10)
	});
}

function NoAutomaticSubmit(){
	return false ;	
}

function HideIndicator(){
	$('indicator').hide() ;
}
function ShowIndicator(){
	Center('indicator');
	$('indicator').show() ;
}
function HideInfo(){
	$('layerblack').hide();
	$('_INFO').hide();
}
function ShowInfo(){
	$('layerblack').show();
	Center('_INFO');
	$('_INFO').show();
	HideIndicator();
}

function ChargePicture( p ){
	ShowIndicator() ;	
	new Ajax.Updater('_INFODIV',
		'includes/ajax/picture.php',
		{
				onComplete:ShowInfo,
				evalScripts : true,
				method: "get",
				parameters:{picture:p}
		}
	);			
}
function ChargeImg( p, n ){
	ShowIndicator() ;	
	new Ajax.Updater('_INFODIV',
		'includes/ajax/image.php',
		{
				onComplete:ShowInfo,
				evalScripts : true,
				method: "get",
				parameters:{product:p, img:n, all:1 }
		}
	);			
}
