var debug=0;
var ihistorique=0;
var thistorique=new Array();
var p1historique=new Array();
var p2historique=new Array();

function vraifaux_choix(q,r,mode,lang)
	{
	
	var contenu="";
	//$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	//$("#box_vraifaux_contenu").html();
	$.ajax ({
	    type: "GET",
	    data: "sa=on&modevf="+mode+"&id="+q+"&r="+r+'&lang='+lang,
	    url: "/box_vraifaux.php",
	    success: function (xXML) {
    	        contenu=xXML;
		$("#box_vraifaux_contenu").html(contenu);
		//$("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		 },
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 
	

	}

function historyadd(type,p1,p2)
	{
	var contenu="";
	var mtype="";
	if (type=="document") mtype=1;
	if (type=="pagecrioc") mtype=2;
	
	$.ajax ({
	    type: "GET",
	    data: "type="+mtype+"&p1="+p1+"&p2="+p2,
	    url: "/box_manavigation.php",
	    success: function (xXML) {
    	        contenu=xXML;
		$("#historique").html(contenu);
		
			if (debug==1) alert(contenu);
		 },
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 


/*		var mh="";
	var rienfaire=0;
	for (i=0;i<ihistorique;i++)
		{
		if (thistorique[i]==type && p1historique[i]==p1 && p2historique[i]==p2) 
			{
			// deja dedans, on ne fait rien
			rienfaire=1;
			}
		}
	if (rienfaire==0)
	{
	thistorique[ihistorique]=type;
	p1historique[ihistorique]=p1;
	p2historique[ihistorique]=p2;
	
	ihistorique++;
	for (i=ihistorique;i>0;i--)
		{
		if (thistorique[i]=="document") {
			
			mh+="<a href=\"#\" onclick=\"load_document("+p1historique[i]+",'"+p2historique[i]+"'); return false;\">"+thistorique[i]+p1historique[i]+"</a><br>"; 
			
			}
		}
		
	$("#historique").html(mh);
		}
		*/
	}

function change_left_menu(id,langue)
	{

	var contenu="";
	$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	$("#menuleft").html();
	$.ajax ({
	    type: "GET",
	    data: "sa=on&idsmenuleft="+id+"&lang="+langue,
	    url: "/box_menugauche.php",
	    success: function (xXML) {
    	        contenu=xXML;
		$("#menuleft").html(contenu);
		$("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		 },
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 
	
	}

function load_document(id,langue)
	{

	$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	var contenu="";
	$.ajax ({
		
	    type: "GET",
		data: "id_doc="+id+"&sa=on&lang="+langue,
	    url: "/mod_document.php",
	    success: function (xXML) {
			
				historyadd("document",id,langue);
    	        
				contenu=xXML;
			
		$("#rightcolumn").html(contenu);
		$("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		},
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 


	}
function load_pagecrioc(id,langue)
	{

	$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	var contenu="";
	$.ajax ({
		
	    type: "GET",
		data: "id_page="+id+"&sa=on&lang="+langue,
	    url: "/mod_page.php",
	    success: function (xXML) {
    	       historyadd("pagecrioc",id,langue);
    	       contenu=xXML;
			
		$("#rightcolumn").html(contenu);
		$("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		},
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	     }
	    }); 

	
	}

function load_search(param,langue)
	{

	$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	var contenu="";
	$.ajax ({
		
	    type: "GET",
		data: "search="+param+"&sa=on&lang="+langue,
	    url: "/mod_search.php",
	    success: function (xXML) {
    	        contenu=xXML;
			
		$("#rightcolumn").html(contenu);
		$("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		},
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 

	
	}
function load_search_theme(param,langue)
	{

	$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	var contenu="";
	$.ajax ({
		
	    type: "GET",
		data: "idtheme="+param+"&sa=on&lang="+langue,
	    url: "/mod_search.php",
	    success: function (xXML) {
    	        contenu=xXML;
			
		$("#rightcolumn").html(contenu);
		$("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		},
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 

	
	}

function change_contenu(param,langue)
	{

	$("#ajaxloader").html("<img src=\"/site_images/ajax-loader.gif\">");
	var contenu="";
	$.ajax ({
	    type: "GET",
		data: "lang="+langue,
	    url: param,
	    success: function (xXML) {
    	        contenu=xXML;
		$("#rightcolumn").html(contenu);
	    $("#ajaxloader").html("");
		if (debug==1) alert(contenu);
		},
	    error: function (xXML) {
		if (debug==1) alert(xXML);
	    }
	    }); 
	
	}
	
	
$(function() {


  
  
   $("#href_home").click(function() {
		alert('x');
	}); 
});