function creer( langue ) { 
	var form = window.document.forms[0];

	form.langue.value = langue;
	form.action.value = "creer";
	form.submit();
}

function editer( id, langue ) { 
	var form = window.document.forms[0];

	form.langue.value = langue;
	form.id.value = id;
	form.action.value = "editer";
	form.submit();
}

function supprimer( id, langue ) { 
	var form = window.document.forms[0];
	
	if (!confirm("Confirmez-vous la suppression ?")) { return; }
	
	form.langue.value = langue;
	form.id.value = id;
	form.action.value = "delete";
}

function update( id, langue ) {
	var form = window.document.forms[0];
	
	if (window.location.href.indexOf("table=rubrique") > 0) {
		if (controle_rubrique() == false) { return; } }
	if (window.location.href.indexOf("table=sousrubrique") > 0) {
		if (controle_sousrubrique() == false) { return; } }
	if (window.location.href.indexOf("table=cipher") > 0) {
		if (controle_cipher() == false) { return; } }
	if (window.location.href.indexOf("table=discaire") > 0) {
		if (controle_discaire() == false) { return; } }
	if (window.location.href.indexOf("table=media") > 0) {
		if (controle_media() == false) { return; } }
	if (window.location.href.indexOf("table=piste") > 0) {
		if (controle_piste() == false) { return; } }
	if (window.location.href.indexOf("table=chronique") > 0) {
		if (controle_chronique() == false) { return; } }
	if (window.location.href.indexOf("table=concert") > 0) {
		if (controle_concert() == false) { return; } }
	if (window.location.href.indexOf("table=news") > 0) {
		if (controle_news() == false) { return; } }
	if (window.location.href.indexOf("table=radio") > 0) {
		if (controle_radio() == false) { return; } }
	if (window.location.href.indexOf("table=lien") > 0) {
		if (controle_lien() == false) { return; } }
	if (window.location.href.indexOf("table=categorie") > 0) {
		if (controle_categorie() == false) { return; } }
	if (window.location.href.indexOf("table=friends") > 0) {
		if (controle_friends() == false) { return; } }

	form.langue.value = langue;
	form.id.value = id;
	form.action.value = "update";
	form.submit();
}

function insert( langue ) {
	var form = window.document.forms[0];
	
	if (window.location.href.indexOf("table=rubrique") > 0) {
		if (controle_rubrique() == false) { return; } }
	if (window.location.href.indexOf("table=sousrubrique") > 0) {
		if (controle_sousrubrique() == false) { return; } }
	if (window.location.href.indexOf("table=discaire") > 0) {
		if (controle_discaire() == false) { return; } }
	if (window.location.href.indexOf("table=media") > 0) {
		if (controle_media() == false) { return; } }
	if (window.location.href.indexOf("table=piste") > 0) {
		if (controle_piste() == false) { return; } }
	if (window.location.href.indexOf("table=chronique") > 0) {
		if (controle_chronique() == false) { return; } }
	if (window.location.href.indexOf("table=concert") > 0) {
		if (controle_concert() == false) { return; } }
	if (window.location.href.indexOf("table=news") > 0) {
		if (controle_news() == false) { return; } }
	if (window.location.href.indexOf("table=radio") > 0) {
		if (controle_radio() == false) { return; } }
	if (window.location.href.indexOf("table=lien") > 0) {
		if (controle_lien() == false) { return; } }
	if (window.location.href.indexOf("table=categorie") > 0) {
		if (controle_categorie() == false) { return; } }
	if (window.location.href.indexOf("table=friends") > 0) {
		if (controle_friends() == false) { return; } }
		
	form.langue.value = langue;
	form.action.value = "insert";
}

function valider_livredor( id ) {
	var form = window.document.forms[0];
	
	form.id.value = id;
	form.action.value = "update";
}

function afficher_formulaire( valeur ) { 
	document.index.formulaire.value = valeur;
	document.index.submit();; 
}

function ok( page ) {
	var form = window.document.forms[0];
	var erreur = 0;
		
	if (page == "livredor") {
	
		if ( form.pseudo.value == "" ) { alert("Le pseudo est obligatoire"); erreur = 1; }
		if ( form.message.value == "" ) { alert("Le message est obligatoire"); erreur = 1; }
		if (erreur == 0) {
			form.formulaire.value = "Non";
			form.action.value = "insert";
		}
	}
	if (page == "news") {
		if ( form.mail.value == "" ) { alert("Le mail est obligatoire"); erreur = 1; }
		if (erreur == 0) {
			form.formulaire.value = "Non";
			form.action.value = "insert";
		}
		form.submit();
	}
}

function regler( id, tre ) { 
	var form = window.document.forms[0];
	
	form.id.value = id;
	form.tre.value = tre;
	form.submit();
}

function compteur_chanson( id, mp3 ) { 
	var form = window.document.forms[0];
	
	form.formulaire.value = id;
	var width = screen.width/2 - 125;
	var height = screen.height/2 - 125;
	window.open(mp3, "Cipher", "width=250,height=150,left=" + width + ",top=" + height + ",resizable,scrollbars=yes,status=1");
	form.submit();
}

function afficher_chanson(chanson) {
	var form = window.document.forms[0];
	
	form.chanson.value = chanson;
	form.submit();
}

function afficher_tablature(type) {
	var form = window.document.forms[0];
	
	form.type.value = type;
	form.submit();
}

function compteur_tablature( id, type, tab ) { 
	var form = window.document.forms[0];
	
	form.formulaire.value = id;
	form.type.value = type;
	var width = screen.width/2 - 125;
	var height = screen.height/2 - 125;
	
	if (type == "gtxt" || type == "btxt" || type == "bttxt") {
		window.open("doc/tabtxt/" + tab, "Cipher", "width=800,height=500,left=0,top=0,resizable,scrollbars=yes,status=1");
	}
	if (type == "gtp") {
		window.open("doc/tabgtp/" + tab, "Cipher", "width=250,height=150,left=" + width + ",top=" + height + ",resizable,scrollbars=yes,status=1");
	}
	form.submit();
}