function favoris() {
if ( navigator.appName != 'Microsoft Internet Explorer' )
{ window.sidebar.addPanel(document.title,document.location,""); }
else { window.external.AddFavorite(document.location,document.title); } }


function ChangePhotoHome(sObject,sPath,sUrl) {
  $('photo-home').style.background = "url('" + sPath + "photo-home-" + sObject + ".jpg')";
	$("texte-entreprise").style.display="none";
	$("texte-club").style.display="none";
	$("texte-enseignement").style.display="none";
	$("texte-administration").style.display="none";
	$("texte-tourisme").style.display="none";
	$("texte-solde").style.display="none";
	
	if (sObject == "entreprise") $("texte-entreprise").style.display="block";
	if (sObject == "club") $("texte-club").style.display="block";
	if (sObject == "enseignement") $("texte-enseignement").style.display="block";
	if (sObject == "administration") $("texte-administration").style.display="block";
	if (sObject == "tourisme") $("texte-tourisme").style.display="block";
	if (sObject == "solde") $("texte-solde").style.display="block";
}


function ShowMenuCata(id) {
var d = document.getElementById('smenu-cata'+id);
var e= document.getElementById('menuCata' + id);
	
  if (d.style.display == "")
    d.style.display = "none";
  
  iBlock = "0";
  
  if (d.style.display == "block")
    var iBlock = "1";
  
  for (var i = 1; i<=20; i++) {
		if (document.getElementById('smenu-cata'+i)) {document.getElementById('smenu-cata'+i).style.display='none';document.getElementById('menuCata' + i).className='';}
	}

  if (d) {
    if (iBlock == "1") {
      d.style.display='none';
      document.getElementById('menuCata' + id).className='';

    }
    else {
      d.style.display='block';
      document.getElementById('menuCata' + id).className='menu-catalogue-selected';

    }
  }
}

function pop_up (Url, Win, Features) {
	window.open(Url, Win, Features);
}

function pop_up_Conseil(url)
        {
            open(url,"PopConseilSport","width=830,height=600,scrollbars=yes,resizable=no,statusbar=no,toolbar=no,location=no,menubar=no, left=200, top=150");
        }

function PopupImage(Url,Win,Features) {
	titre=Win;
	larg=screen.width/2;
	haut=screen.height/4;
	ttop=haut-(haut/2)
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes,top='+ttop+',left='+(larg-larg/2)+'');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+50); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+Url+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

/***************************************
name :email_check
process :checks an e-mail address
in param :e-mail
out param :truee-mail ok (!)
falsee-mail not ok (!!!)
****************************************/
function email_check(email) {
 
 address = email.toUpperCase();
  
  if(address.length < 5)
     return false;
 
  if(address.indexOf("..") != -1) 
     return false;
  
  for(i=0; i<address.length; i++)
  {
     tmpchar = address[i];
     if((tmpchar != '.') && (tmpchar != '@')
        && ( (tmpchar <  '0') || (tmpchar  > '9') )
        && ( (tmpchar <  'A') || (tmpchar  > 'Z') )
        && ( (tmpchar <  '-') || (tmpchar  > '-') ) )
        return false;
  }
  
  if(address.indexOf('@') == -1)
     return false;
 
  if(address.indexOf('.') == -1)
     return false;
 
  if( (address.substring(0, 1) == '@') || (address.substring(0, 1) == '.') )
     return false;
 
  if( (address.substring(address.length -1, address.length) == '@') || (address.substring(address.length -1, address.length) == '.'))
     return false;
  
  if(address.indexOf('@', address.indexOf('@', 0) + 1) != -1)
     return false;
 
  if(address.substring(address.indexOf('@') + 1, address.indexOf('@') +2) == '.')
     return false;
 
  if(address.substring(address.indexOf('@') - 1, address.indexOf('@')) == '.')
     return false;
  
  // address may be ok
  return true;
}

/* Got it from http://www.mattkruse.com/javascript/validations/compact_source.html
	on est sport chez DECAPRO ;-)
*/
function isDigit(num){if(num.length>1){return false;}var string="1234567890";if(string.indexOf(num)!=-1){return true;}return false;}

/*
Check if the emails entered is ok and separated with , or ;
*/
function  emails_check(email)
{
	var email_ok = true;
	var reg=new RegExp("[ ,;]+", "g");
	email = email.replace("\n","");
	var tab_email = email.split(reg);
	for (var i=0; i<tab_email.length; i++) {
		if (email_check(tab_email[i])==false)
		{
			email_ok=false;
		}
	}
	return email_ok;
}
