function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
}
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}
function PopUp(strFile, nWidth, nHeight)
{
    if((typeof WindowPopUp != "undefined") && (WindowPopUp != null))
        WindowPopUp.close();

    WindowPopUp = window.open("popup.php?file="+strFile, "popup", "left="+((screen.width-nWidth)/2)+", top="+((screen.height-nHeight)/2)+", width="+nWidth+", height="+nHeight);
    if(WindowPopUp != null)
        WindowPopUp.focus();
}

function NewWindow(mypage,myname,w,h,scroll){
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
var settings ='height='+h+',';
settings +='width='+w+',';
settings +='top='+wint+',';
settings +='left='+winl+',';
settings +='scrollbars='+scroll+',';
settings +='resizable=yes';
win=window.open(mypage,myname,settings);
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
function AjaxExecutePost(strFunction, strArgs, strReturnFunction){
	$.post("ajax.php", {strFunction: strFunction, strArgs: unescape(strArgs)}, function(data){
	  eval(strReturnFunction + "(data);");
	});
}
function checkEmail(txtEmail)
{
	strMail = txtEmail.replace(/ /g,"");
	regex =
	/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
	if (regex.test(strMail)) {
	return true;
	}	else {
	return false;
	}
}

function replacebr(strString) {               
strString = strString.replace(/ /gi,"\r\n");
return strString;
}
function doLoginHeader(){
	var strParm = "'"+escape($("#h_loginEmail").val())+"'";
		strParm += ",'"+escape($("#h_loginPwd").val())+"'";
		
		AjaxExecutePost("loginUser", escape(strParm), "afterLogin");
}

function doLoginMonCompte(){
	var strParm = "'"+escape($("#m_loginEmail").val())+"'";
		strParm += ",'"+escape($("#m_loginPwd").val())+"'";
		
		AjaxExecutePost("loginUser", escape(strParm), "afterLogin");
}

function afterLogin(strRes){
	if (strRes == 'ERROR')
		alert('Utilisateur ou mot de passe invalide.');
	else{
		eval ("objRES="+strRes+";"); 
		$("#p_logedInName").html(objRES.client_firstname+" "+objRES.client_lastname);
		$("#li_logedInName").html(objRES.client_firstname+" "+objRES.client_lastname);
		$("#bottom-header").fadeOut("100", function (){
			$("#bottom-header1").fadeIn();
			});
		

		$("#mon-compte").fadeOut("100", function (){
			$("#mon-compte2").fadeIn();
			});
		
	}
}