function validateSearch(champ, nbre, form, defaultTxt) {
	champ = trim(champ);
	if (champ == defaultTxt || champ=="") return false;
	if (champ.length < nbre) {
		document.getElementById("errorSearch").innerHTML = JS_saisirCaracteresMin;
		document.getElementById("errorSearch").style.display = "";
		document.getElementById("searchtxt").className = "searchInput errorField";
		return false;
	}
	else if (champ == "jeux" || champ == "jeu" || champ == "game" || champ == "games") {
		document.getElementById("errorSearch").innerHTML = JS_search_plusPrecisRecherche;
		document.getElementById("errorSearch").style.display = "";
		document.getElementById("searchtxt").className = "searchInput errorField";
		return false;  
	}
	return true;
}


function favoris() {
	if ( navigator.appName != 'Microsoft Internet Explorer' ){
		window.sidebar.addPanel(JS_accueil_favorisTitre,JS_url,JS_accueil_favorisTitre);
	}
	else {
		window.external.AddFavorite(JS_url,JS_accueil_favorisTitre);
	}
}

function GetHeightWidth(height, width) {
	var xposition=0, yposition=0, text;

	xposition = (screen.width - width) / 2;
	yposition = (screen.height - height) / 2;

	text = "height=" + height + ",width=" + width + ",screenx=" + xposition + ",screeny=" + yposition + ",left=" + xposition + ",top=" + yposition;
	return(text);
}

function OpenJeux(id, height, width) {
	window.open(JS_url+JS_url_jeux+'_pop.php?popup=oui&lang='+JS_lang+'&id=' + id ,id, GetHeightWidth(height, width) + ',location=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0,toolbar=0,hotkeys=0');
}

/**
* Ajoute ou supprime un jeu de la liste "Mes Jeux".
* Effectue un appel Ajax, affiche le texte de confirmation et met a jour le sticker "Mes Jeux".
* Action=1 => Ajout
* Action=2 => Suppression
* Le 3e parametre (nomJeu) est facultatif, il n'est utilisé que pour la suppression d'un jeu.
*/
function mesJeux(id, action, nomJeu) {
	var server = new distantServer;
	nt = server.send('mesjeux_pop.php?action='+action+'&lang='+JS_lang+'&id=' + id + '&nom=' + nomJeu);
	eval(nt);
}

function show(id_block,type) {
	if (document.getElementById(id_block)) {document.getElementById(id_block).style.display=type;}
}
function hide(id_block) {
	if (document.getElementById(id_block)) {document.getElementById(id_block).style.display='none';}
}

//Pop-under window- By JavaScript Kit
//Credit notice must stay intact for use
//Visit http://javascriptkit.com for this script

//specify page to pop-under
var popunder="http://www.extra777.com"

//specify popunder window features
//set 1 to enable a particular feature, 0 to disable
var winfeatures="width=1024,height=768,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=0"

//Pop-under only once per browser session? (0=no, 1=yes)
//Specifying 0 will cause popunder to load every time page is loaded
var once_per_session=1

///No editing beyond here required/////

function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // if cookie exists
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      // set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function loadornot(){
	if (get_cookie('popunder')==''){
	loadpopunder()
	document.cookie="popunder=yes"
	}
}

function loadpopunder(){
	win2=window.open(popunder,"",winfeatures)
	win2.blur()
	window.focus()
}

function redirectionLang(linkObj) {
	var pathName = document.location.pathname;
	var linkDomaine = linkObj.href;
	
	if (linkDomaine.charAt(linkDomaine.length-1)=="/") {
		linkDomaine = linkDomaine.substring(0, linkDomaine.length-1);
	}
	linkObj.href = linkDomaine + pathName;
}

function setCookie (name, value) {
	var argv=setCookie.arguments;
	var argc=setCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	
	var today = new Date(), expires = new Date();
    expires.setTime(today.getTime() + (365*24*60*60*1000));

	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
	return true;
}

function openHelp() {
	document.location="#aide"; 
	switchTab(2);
}