// JavaScript Document
var bSubClick = false;

function GotoItem(url, opt, sopt, id) {
	if (bSubClick) {
		bSubClick = false;
		return false;
	}
	
	window.location = url + "?opt=" + opt + "&sopt=" + sopt + "&id=" + id;
	
}

function GotoGroup(url, opt, sopt) {

	window.location = url + "?opt=" + opt + "&sopt=" + sopt;
	
}

function OpenPdf(url) {
	bSubClick = true;
	
	//alert(url);
	
	var newWnd = window.open(url, "_blank");
	
	//alert(newWnd);
}

var oWndMedia;

function OpenMedia(id, mid, lng) {

	if (oWndMedia) {
		//alert(oWndMedia);
		oWndMedia.close();
	}
	
	var sFinalUrl = "show_media.php?id=" + id + "&mid=" + mid + "&lng=" + lng;
	
	nX = (screen.width - 250) / 2;
	nY = (screen.height - 150) / 2;
	
	var sFeatures = "height=150, width=250, location=0, menubar=0, resizable=1, scrollbars=1, status=0, toolbar=0, top=" + nY + ", left=" + nX;
	
	oWndMedia = window.open(sFinalUrl, "_blank", sFeatures);

}

function ResizeAndFocus(nWidth, nHeight) {
	nMaxWidth = screen.width - 50;
	nMaxHeight = screen.height - 50;
	
	if (nWidth > nMaxWidth) nWidth = nMaxWidth;
	if (nHeight > nMaxHeight) nHeight = nMaxHeight;
		
	nX = (screen.width - nWidth) / 2;
	nY = (screen.height - nHeight) / 2;
	
	self.resizeTo(nWidth, nHeight);
	self.moveTo(nX, nY);
	
	//window.focus();
}

function Preloads() {
	MM_preloadImages(
					 'img/btn/Btn_mnu_haut_on.png',
					 'img/btn/Btn_mnu_centre_on.png',
					 'img/btn/Btn_sous_mnu_on.png',
					 'img/btn/Btn_mnu_haut_sel.png',
					 'img/btn/Btn_mnu_centre_sel.png',
					 'img/btn/Btn_sous_mnu_sel.png',
					 'img/btn/Btn_mnu_haut_off.png',
					 
					 'img/btn/Btn_en_off_hover.png',
					 'img/btn/Btn_fr_off_hover.png',
					 'img/btn/Btn_fr_off.png',
					 'img/btn/Btn_en_off.png',
					 'img/btn/Btn_fr_on.png',
					 'img/btn/Btn_en_on.png'
					 
					 );
}
