
function txtresize(quoi,combien,moins){
	actuel=jQuery(quoi).css('font-size');
	unite=actuel.substr((actuel.length-2),2);
	valeur=actuel.substr(0,(actuel.length-2));
	if (moins) nouvel=Number(valeur)-Number(combien);
	else nouvel=Number(valeur)+Number(combien);
	jQuery(quoi).css('font-size',nouvel+unite);
}

function windowInit(id,title,content) {
		jQuery("body").append('<div id="'+id+'" class="window"><div class="windowTop"><div class="windowTopContent">'+title+'</div><img src="images/mini.gif" class="windowMin" /><img src="images/maxi.gif" class="windowMax" /><img src="images/close.gif" class="windowClose" /></div><div class="windowBottom"><div class="windowBottomContent">&nbsp;</div></div><div class="windowContent">'+content+'<img src="images/window_resize.gif" class="windowResize" /></div></div>');
		jQuery('#'+id+' .windowClose').bind(
			'click',
			function()
			{
				jQuery('#'+id).remove();
			}
		);
		jQuery('#'+id+' .windowMin').bind(
			'click',
			function()
			{
				jQuery('#'+id+' .windowContent').SlideToggleUp(300);
				jQuery('#'+id+' .windowBottom, .windowBottomContent').animate({height: 10}, 300);
				jQuery('#'+id).animate({height:40},300).get(0).isMinimized = true;
				jQuery(this).hide();
				jQuery('#'+id+' .windowResize').hide();
				jQuery('#'+id+' .windowMax').show();
			}
		);
		jQuery('#'+id+' .windowMax').bind(
			'click',
			function()
			{
				var windowSize = $.iUtil.getSize(document.getElementById('windowContent'));
				jQuery('#'+id+' .windowContent').SlideToggleUp(300);
				jQuery('#'+id+' .windowBottom, .windowBottomContent').animate({height: windowSize.hb + 13}, 300);
				jQuery('#'+id).animate({height:windowSize.hb+43}, 300).get(0).isMinimized = false;
				jQuery(this).hide();
				jQuery('#'+id+' .windowMin, #'+id+' .windowResize').show();
			}
		);
		jQuery('#'+id).Resizable(
			{
				minWidth: 200,
				minHeight: 60,
				maxWidth: 700,
				maxHeight: 400,
				dragHandle: '#'+id+' .windowTop',
				handlers: {
					se: '#'+id+' .windowResize'
				},
				onResize : function(size, position) {
					jQuery('#'+id+' .windowBottom, #'+id+' .windowBottomContent').css('height', size.height-33 + 'px');
					var windowContentEl = jQuery('#'+id+' .windowContent').css('width', size.width - 25 + 'px');
					if (!document.getElementById(id).isMinimized) {
						windowContentEl.css('height', size.height - 48 + 'px');
					}
				}
			}
		);
		return false;
}

function centerElementById(id) {
	var pagesize = getPageSize();
	var arrayPageScroll = getPageScrollTop();

	jQuery('#'+id).css({left: (pagesize[0]/2)+"px", top: arrayPageScroll[1]+"px" });

}
function getPageScrollTop(){
	var yScrolltop;
	if (self.pageYOffset) {
		yScrolltop = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScrolltop = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScrolltop = document.body.scrollTop;
	}
	arrayPageScroll = new Array('',yScrolltop)
	return arrayPageScroll;
}

function getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;

	arrayPageSize = new Array(w,h)
	return arrayPageSize;
}

