
function msgRedirect(titre,content,url,LabelOK) {
	//win = Dialog.confirm(content, {width:460, okLabel: LabelOK, title: titre,buttonClass: "myButtonClass", id: "myDialogId", ok:function(win) {window.location=url; return true;}, showEffectOptions: {duration:0}, closable:true });		
	win = Dialog.alert(content, {width:460, okLabel: LabelOK, title: titre,buttonClass: "myButtonClass", id: "myDialogId", ok:function(win) {window.location=url; return true;}, showEffectOptions: {duration:0}, closable:true });		
	win.setZIndex(4444);
}

function msgConfirm(titre,content,url,LabelOK,LabelCancel) {
	win = Dialog.confirm(content, {width:460, okLabel: LabelOK,cancelLabel: LabelCancel, title: titre,buttonClass: "myButtonClass", id: "myDialogId", cancel:function(win) {debug("cancel confirm panel")}, ok:function(win) {window.location=url; return true;}, showEffectOptions: {duration:0}, closable:true });		
	win.setZIndex(4444);
}


// MSG de confirmation avec redirection dans le 2 cas
function msgConfirmAction(titre,content,urlOk,urlCancel,LabelOK,LabelCancel) {
	win = Dialog.confirm(content, {width:460, okLabel: LabelOK,cancelLabel: LabelCancel, title: titre,buttonClass: "myButtonClass", id: "myDialogId", cancel:function(win) {window.location=urlCancel; return true;}, ok:function(win) {window.location=urlOk; return true;}, showEffectOptions: {duration:0}, closable:false });		
	win.setZIndex(4444);
}

function msgConfirmSubmit(titre,content,formName,LabelOK,LabelCancel) {
	win = Dialog.confirm(content, {width:460, okLabel: LabelOK,cancelLabel: LabelCancel, title: titre,buttonClass: "myButtonClass", id: "myDialogId", cancel:function(win) {debug("cancel confirm panel")}, ok:function(win) {document.getElementById(formName).submit(); return true;}, showEffectOptions: {duration:0}, closable:true });	
	win.setZIndex(4444);	
}

function msgAlert(titre,content,LabelClose) {
    win = Dialog.alert(content, {width:460, height:200, okLabel: LabelClose, title: titre,ok:function(win) {debug("validate alert panel"); return true;}, closable:true });  	
	win.setZIndex(4444);	
}

function info(titre,content,LabelClose,width,height) {
    win = Dialog.alert(content, {width:width, height:height, okLabel: LabelClose, title: titre,ok:function(win) {debug("validate alert panel"); return true;}, recenterAuto:false, closable:true });  	
	win.setZIndex(4444);		
}

function imagePreview (nom,content,btn,width,height){
	info(nom,"<a href='#' onclick='win.close();' ><img src='"+content+"' border='0' /></a>",btn,width+20,height+100);
}

function popupLogin(titre,urlOk,LabelOK,LabelCancel){
//	Dialog.confirm($('login').innerHTML, {width:400, height:230, title: titre, okLabel: LabelOK,cancelLabel: LabelCancel, onOk:function(win){ alert(document.getElementById('password2').value); if(MD5(document.getElementById('password2').value)=='6af6ee7cb89ce5139daec1f060d83bd4'){  window.location=urlOk; return true; }else{ $('login_error_msg').innerHTML='Code inccorect'; $('login_error_msg').show(); Windows.focusedWindow.updateHeight(); return false;}}}); 
	var formulaire = "<div id=\"login\" style=\"width:390px; height:140px;\"><form name=\"formLogin\"><p><span id='login_error_msg' class=\"login_error\" style=\"display:none\">&nbsp;</span></p><div style=\"clear:both\"></div><p>Pre-Launch access to TFC</p><div style=\"clear:both\"></div> <span class=\"login_label\">Enter the access code:</span><span class=\"login_input\"><input id=\"password\" name=\"password\" type=\"password\" value=\"\" /></span><div style=\"clear:both\"></div><br /><br /><p>If you have any questions please contact Andy Williams at:</p><p><a href=\"mailto:a.williams@lila-ms.ch\">a.williams@lila-ms.ch</a></p><p>078.897.12.28</p></form></div>";	
	
	Dialog.confirm(formulaire, {width:400, height:230, title: titre, okLabel: LabelOK,cancelLabel: LabelCancel, onOk:function(win){ if(MD5(document.getElementById('password').value)=='6af6ee7cb89ce5139daec1f060d83bd4'){  window.location=urlOk; return true; }else{ $('login_error_msg').innerHTML='Code inccorect'; $('login_error_msg').show(); Windows.focusedWindow.updateHeight(); return false;}}}); 

}		
/*
function testPassword(pass){
	var oXmlHttp2 = zXmlHttp.createRequest();
	oXmlHttp2.open("get", "./include/ajax/testPass.php?password=" + pass , true);

	oXmlHttp2.onreadystatechange = function () {
		if (oXmlHttp2.readyState == 4) {

			if (oXmlHttp2.status == 200)
				return(oXmlHttp2.responseText);
		}
	};
	oXmlHttp2.send(null);	
}

*/
//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}


function fadeimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
	
}


FuncOL = new Array();
function StkFunc(Obj) {
    FuncOL[FuncOL.length] = Obj;
}   
// Execution des scripts au chargement de la page
window.onload = function() {
    for(i=0; i<FuncOL.length; i++)
        {FuncOL[i]();}
}



function CheckAll(FormName, FieldName)
{	
	if (document.getElementById("checkall").checked == true)	
			CheckValue = 1;
	else	CheckValue = 0 ;


	if(!document.forms[FormName])
		return;
	var objCheckBoxes = document.forms[FormName].elements[FieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = CheckValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = CheckValue;
}

// Détecte le scan du code barre et n'execute pas le return
function checkScan (field, evt) {
  var keyCode =  
	document.layers ? evt.which :
	document.all ? event.keyCode :
	document.getElementById ? evt.keyCode : 0;
  if (keyCode == 13)
	  return false;
}

// play pour les flv et swf de la galerie
function playFLV (file,width,height){
	var uid2 = new Date().getTime();
	var flashProxy = new FlashProxy(uid2, 'include/js/JavaScriptFlashGateway.swf');
	var tag = new FlashTag(file, '500', '500'); 
	tag.setFlashvars('lcId='+uid2);
	document.getElementById("idVideo").innerHTML=tag;						
}

