function efface (url, type, nom) {
    switch (type) {
    case "news":
	type = "la "+type;
	break;
    case "commentaire":
	type = "le "+type+" de";
	break;
    case "album":
	type = "l\'"+type+" ";
	break;
    case "utilisateur":
	type = "l\'"+type+" ";
	break;	
    case "opération":
	type = "l\'"+type+" ";
	break;	
    case "compte":
	type = "le "+type+" ";
	break;		
    default:
	type = "le "+type;
	break;
    }
    if (confirm("Etes-vous sûr de vouloir effacer "+type+" '"+nom+"' ?")) {
	window.location.href = url;
    }
}

function empty_trash (url) {
    if (confirm("Etes-vous sûr de vouloir vider la corbeille ?")) {
	window.location.href = url;
    }
}

function logout (url) {
    if (confirm("Etes-vous sûr de vouloir fermer votre session ?")) {
	window.location.href = url;
    }
}

function programmeTV(desc) {
    document.write(desc)
}

function addNetscapePanel() { 
    if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) 
    { 
	window.sidebar.addPanel ("CODA's Sidebar", 
				 "http://coda.noisyspoon.org/tabs.php",""); 
    } 
    else 
    { 
	var rv = window.confirm ("Cette page est optimsée pour Mozilla Firefox ou Netscape.  " 
				 + "Voulez-vous effectuer une mise à niveau ?"); 
	if (rv) 
	    document.location.href = "http://www.mozilla-europe.org/fr/products/firefox/";
    } 
} 

function onLoadiPhone() {
    if (window.navigator.standalone) {
	// OK
    } else {
   	//alert('Ajouter ce site à votre écran d\'accueil pour une meilleure expérience.')
    }
}

function writeCookie() {
    var today = new Date();
    var the_date = new Date("December 31, 2023");
    var the_cookie_date = the_date.toGMTString();
    var the_cookie = "nico_users_resolution="+ screen.width +"x"+ screen.height;
    var the_cookie = the_cookie + ";expires="; // + the_cookie_date;
    document.cookie=the_cookie;

    var the_cookie3_date = the_date.toGMTString();
    var the_cookie3 = "nico_users_resolution_frame="+ top.window.innerWidth +"x"+ top.window.innerHeight;  
    var the_cookie3 = the_cookie3 + ";expires="; // + the_cookie_date;
    document.cookie=the_cookie3;
}

function writeCookieLocation() {
    var the_cookie4 = "nico_coda_location="+ parent.coda.location.href;  
    var the_cookie4 = the_cookie4 + ";expires="; 
    document.cookie=the_cookie4;  
    //location = 'get_resolution.php';
}

function charger(nom_page1,nom_page2,nom_page3) {
		window.top.window.callback_begin();
		window.top.window.callback_tab_begin();		
    parent.titre.location=nom_page1;
    parent.tab.location=nom_page2;
    parent.coda.location=nom_page3;    
}

function recharger(phppage, url)  {
    writeCookie();
		if (phppage == "index") {
			top.location=url;
		} else {
			top.maincoda.location=url;
		}
}

function rechercher(chaine_cherche) {
		window.top.window.callback_begin();
		window.top.window.callback_tab_begin();		
    parent.tab.location="/tabs.php?case=home";
    parent.coda.location="/index.php?rub=recherche&search="+ chaine_cherche;
}
