function Placer(e)
{
//init_button();
//init_a();
    
//var menu=document.getElementById("menu_admin");
//showLightbox();
//init_divs();

//init_scroll();
//ajouteEvent(this,"scroll",showLightbox2, false);
//i=0;

page_private_revendeurs.load();

}	

function init_scroll()
{
        var node = document.getElementsByTagName("body");
                       
                     
} 
 function DestroyTitreLogo(){
	 if (document.getElementById('titre_menu')){
 		document.getElementById('titre_menu').innerHTML = "AV2P, Importation, Distribution, Maintenance de matériels audio & vidéo professionnels";
	 }

	
 } 
function ajouteEvent(objet, typeEvent, nomFunction, typePropagation)
	{
		 if (objet.addEventListener) {
				  objet.addEventListener(typeEvent, nomFunction, typePropagation);
		 }
		 else if (objet.attachEvent) {
				 objet.attachEvent('on' + typeEvent, nomFunction);
		 }
	}

 

var execute = {
	
	LoadElementFormValues:function(id){
		
		this.sendvalue="";
                var form=document.forms[id];
                var node;
                
                        for (var i = 0; i < form.length; i++)
                        {
                                node=form.elements[i];
                                switch(node.type)
                                {
                                        case "text":
                                        this.sendvalue+=this.parse(node.value)+":"+node.name+"]";
                                        break;
                                        case "textarea":
                                        this.sendvalue+=this.parse(node.value)+":"+node.name+"]";
                                        break;
                                        case "checkbox":
                                        this.sendvalue+=this.check(node.checked)+":"+node.name+"]";       
                                        break;
                                        case "select-one":
                                            //  alert( node.selectedIndex);
                                             // alert(form.getElementsByTagName("option")[node.selectedIndex].id);
                                         this.sendvalue+=form.elements[i].getElementsByTagName("option")[node.selectedIndex].id+":"+node.name+"]";
                                        
                                    // alert ();
                                        break;
                                        case "select":
                                        this.sendvalue+=this.select(node.value)+":"+node.name+"]";        
                                        break;
                                        case "hidden":
                                           
                                        this.sendvalue+=node.value+":"+node.name+"]";        
                                        break;
                                        case "file":
                                            
                                        this.sendvalue+="<>"+node.value+"<>"+node.name+"]";        
                                        break;
                                        case "password":
                                            
                                        this.sendvalue+="<>"+node.value+"<>"+node.name+"]";        
                                        break; 
                                }  

                        
                        }  
                },
                check:function(value){
                        
                        value=(value==true) ? "A" : "B";
                        return(value);
                        
                },
                selectone:function(value){
                        
                        value=value;
                        return(value);
                        
                },
                
                parse:function(value){
                        
                        var reg=new RegExp("#",'g');
                        value=value.replace(reg,"");
                        var reg=new RegExp("]",'g');
                        value=value.replace(reg,"");
                        return(value);
                        
                

		
	},
	
	SendAJAX:function(page,value,id){
		
	var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
	
					ids= id.split(",");
                                        //alert (xhr.responseText);
					res= xhr.responseText.split("<>");
					for (nb=0;nb<ids.length;nb++){
                                             
					document.getElementById(ids[nb]).innerHTML =res[nb].replace("*-space-*"," ");
					}
                 }
                else {
                this.result ="petit pepin";
                }
	}
	xhr.open("POST",page,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	},
	
	SendAJAXWithoutReturn:function(page,value){
		
	var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
	         }
                else {
                this.result ="petit pepin";
                }
	}
	xhr.open("POST",page,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	},
	
	SendAJAXForRevendeurs:function(page,value,action){
			var reg=new RegExp("&",'g');
                        value=value.replace(reg,"");
		 
	var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
			
			res= xhr.responseText;

			 confirm(res,action);
	         }
                else {
                this.result ="petit pepin";
                }
	}
	xhr.open("POST",page,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	},
	
	SendAJAXForClass:function(page,value,action,obj){
			var reg=new RegExp("&",'g');
                        value=value.replace(reg,"");
	Loading = obj.loading==true ? true : false ;
	LoadingId = obj.loadingId  ? obj.loadingId  : 'body' ; 
	loadStartAjax(Loading,LoadingId);  
	var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
			
			res= xhr.responseText;
			
			obj.confirmClass(res,action);
 
	         }
                else {
		 	 
                this.result ="petit pepin";
                }
	}
	xhr.open("POST",page,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	},
	
	SendAJAXWithReturn:function(page,value,action,funct){
	var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
			
			res= xhr.responseText;
		
			funct.loadAction(res,action);
 
	         }
                else {
		 	 
                this.result ="petit pepin";
                }
	}
	xhr.open("POST",page,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send("AJAX="+value);
	}
}




function getXhr()
{
var xhr = null;

	if(window.XMLHttpRequest) // Firefox et autres
		xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
		xhr = new ActiveXObject("Msxml2.XMLHTTP");
		
			} catch (e) {
		 xhr = new ActiveXObject("Microsoft.XMLHTTP");
		 
			 }
		 }
	else { 
				// XMLHttpRequest non supporté par le navigateur 
					A= new non();
					
					xhr = false;
					
		} 
return xhr;
}
LoadingTemporisation ={
	action:'start',
	
	init:function(){
		
	},
	start:function(){
	this.action='start';	
	},
	end:function(){
	this.action='end';	
	}
}

function CachStartAjax( LoadingId ){
	 
                 if(!LoadingTemporisation.action || LoadingTemporisation.action=='start'){
                LoadingTemporisation.end();
                to =   setTimeout("CachStartAjax('"+LoadingId+"' )",500);
                }
                else {
		LoadingTemporisation.start();	
                clearTimeout(to);
			if (document.getElementById("CacheAjax")){
			var fenetre= document.getElementById(LoadingId);	
		 	fenetre.removeChild(document.getElementById("CacheAjax"));
			}
                } 	

}



function loadStartAjax(Loading, LoadingId ){
	

if (!document.getElementById("CacheAjax") && Loading == true ){	
	var reg=new RegExp("px",'g');
   
        
	var arrayPageSize = getPageSize();
          var arrayPageScroll = getPageScroll();
 
	
var fenetre= document.getElementById(LoadingId);
var nouveauDiv = document.createElement('div');
nouveauDiv.id='CacheAjax';
nouveauDiv.style.display='block';
nouveauDiv.style.position='absolute';
nouveauDiv.style.top= 0+'px';
nouveauDiv.style.left= 0 +'px';
nouveauDiv.style.width= 500 +'px';
nouveauDiv.style.height= arrayPageSize[1] +'px';
nouveauDiv.style.background="#080808"; 
 nouveauDiv.style.filter = "alpha(opacity= 0)";
 nouveauDiv.style.MozOpacity = 0 ;
fenetre.appendChild(nouveauDiv);
 
  

}
//alert(arrayPageScroll  ) 
}

 

function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}



;

function showLightbox()
{
	// prep objects
        
var reg=new RegExp("px",'g');
	var objLoadingImage = document.getElementById('menu_admin');
	objLoadingImage.height= 200;
       objLoadingImage.width=140;
  	
        
	var arrayPageSize = getPageSize();
     
        var arrayPageScroll = getPageScroll();
      
       
	// center loadingImage if it exists
	if (objLoadingImage) {
		objLoadingImage.style.top = (arrayPageScroll[1]  + 'px');
		objLoadingImage.style.left = (((arrayPageSize[0]  - 20 - objLoadingImage.width) ) + 'px');
		objLoadingImage.style.display = 'block';
	}

 	
	
}


function  showLightbox2(){
var time=0;
var dep=0;
var arrayPageSize = getPageSize();
 var      arrayPageScroll = getPageScroll();
 
     showLightbox3(0,arrayPageSize,arrayPageScroll);
     var A=arrayPageScroll[1];
   //  var B = arrayPageScroll
}


function showLightbox3(time,A)
{
	// prep objects
     var objLoadingImage = document.getElementById('menu_admin');
	   
        if (time<80){
          time++;
    //     
      to= setTimeout("showLightbox3("+time+","+A+")",10);
     
        }
       else  {
          to.clearTimeout;
          time=0;
          
	objLoadingImage.height= 200;
       objLoadingImage.width=100;          
 	if (objLoadingImage) {
		objLoadingImage.style.top = (arrayPageScroll[1]  + 'px');
	//	objLoadingImage.style.left = (((arrayPageSize[0]  - objLoadingImage.width) ) + 'px');
		objLoadingImage.style.display = 'block';
	}
            

        
  
     }


}


function showLightbox4 ()
{
	// prep objects
        
var reg=new RegExp("px",'g');
	var objLoadingImage = document.getElementById('pop');
	objLoadingImage.height= 500;
       objLoadingImage.width=1100;
  	
      document.getElementById("plein").style.filter = "alpha(opacity=60)";
     document.getElementById("plein").style.MozOpacity = 0.6;
        
	var arrayPageSize = getPageSize();
     
        var arrayPageScroll = getPageScroll();
      
       
	// center loadingImage if it exists
	if (objLoadingImage) {
		objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3]  - objLoadingImage.height) / 2) + 'px');
		objLoadingImage.style.left = (((arrayPageSize[0] - 20 - objLoadingImage.width) / 2) + 'px');
		objLoadingImage.style.display = 'block';
	}

 	
	
}

 function delete_pop_bulle(id){
  
                      var fenetre=document.getElementById("body");
                       fenetre.removeChild(document.getElementById("pop")); }
 
 
 
function load_script(script){
                  
                   if(     document.getElementById("script")){
        document.getElementsByTagName("head")[0].removeChild(document.getElementById("script"));
                   }
        
       var script_src = document.createElement("script");
         script_src.type = "text/javascript";
          script_src.id='script';
         script_src.src="admin/"+script+"/script.js";
         document.getElementsByTagName("head")[0].appendChild(script_src);           
        
}



 function pop_revendeur(){
	
	 
 }

function affichageNewPage(lien) {
window.open(lien); 
}




function cacherNavRapideCross  ( e) {
	        if (  document.getElementById("popNavRapide")){document.getElementById("page").removeChild(document.getElementById("popNavRapide") );	 }
	    
	    
}
function cacherNavRapide  ( e) {
	    
	    
	          if (  document.getElementById("popNavRapide")){
  	    var fenetre= document.getElementById("popNavRapide").parentNode;
	    	if(e)
	    {
			if(document.all)
			{
			var curX = event.clientX;
			var curY = event.clientY;
			}
			if(document.layers)
			{
			var curX = e.pageX;
			var curY = e.pageY;
			}
			if(document.getElementById)
			{
			var curX = e.clientX;
			var curY = e.clientY;
			}
	    }
var arrayPageScroll = getPageScroll();
 	
	    var reg=new RegExp("px",'g');    
 	    var reg=new RegExp("px",'g');   // 
 
curX =    curX-  document.getElementById("page").offsetLeft  ;
POPX = Number (document.getElementById("popNavRapide").style.left.replace(reg,""));
curY =   curY + arrayPageScroll[1]  ;
POPY = Number (  document.getElementById("popNavRapide").style.top.replace(reg,"") );
//alert (curY+" "+(POPY+100)  )
		if ( 	curX  <  ( POPX+5) || curX > ( POPX +499) ||curY  <  (POPY+5) || curY > (POPY+249)   ){
			//document.getElementById("page").removeChild(document.getElementById("popNavRapide") );
		 }
 
		  
	 	}
		
}



 



var action  = new Object;
action.temp=0;
function MoveNavRapide(e) {
	    
	 

	if(e)
	    {
			if(document.all)
			{
				     
			var curX = event.clientX;
			var curY = event.clientY;
			}
			if(document.layers)
			{
			var curX = e.pageX;
			var curY = e.pageY;
			}
			if(document.getElementById)
			{
			var curX = e.clientX;
			var curY = e.clientY;
			}
	    }
 var arrayPageScroll = getPageScroll();
var reg=new RegExp("px",'g');
mouseX=curX-(document.getElementById("page").offsetLeft);
mouseY=curY + arrayPageScroll[1] ;
action.ancX = mouseX;
action.ancY = mouseY;
 action.temp  = 1;

}
function StopNavRapide(e) {
	 
 action.temp  = 0; 
 
}
  
function MoveNavRapidePlay  (e) {
   
	if(e &&  action.temp == 1)
	    {
			if(document.all)
			{
				     
			var curX = event.clientX;
			var curY = event.clientY;
			}
			if(document.layers)
			{
			var curX = e.pageX;
			var curY = e.pageY;
			}
			if(document.getElementById)
			{
			var curX = e.clientX;
			var curY = e.clientY;
			}
 	  
 var arrayPageScroll = getPageScroll();
var reg=new RegExp("px",'g');
mouseX=curX-(document.getElementById("page").offsetLeft);
mouseY=curY + arrayPageScroll[1] ;
    
POPX = Number (document.getElementById("popNavRapide").style.left.replace(reg,""));
POPY = Number (  document.getElementById("popNavRapide").style.top.replace(reg,"") );
DEPX  =  mouseX - action.ancX;
DEPY  =  mouseY-action.ancY ;
 
action.ancX = mouseX;
action.ancY = mouseY;
 document.getElementById("popNavRapide").style.left=  (POPX+DEPX)  +'px';
  document.getElementById("popNavRapide").style.top= (POPY+DEPY) +'px';

	    
}	    
}
function confirm(value,action){
    if (value){
	    
	
document.getElementById("popNavRapide").innerHTML= value;

 //ajouteEvent(document.getElementById("header_left"),"mousedown",MoveNavRapide, false);
// ajouteEvent(document.getElementById("header_left"),"mouseup",StopNavRapide, false);
//  ajouteEvent(document.getElementById("page"),"mousemove",MoveNavRapidePlay , false); 
//  ajouteEvent(document.getElementById("cross"),"click",cacherNavRapideCross , false);
  
  
   
var dac = $('#_menu_navigation').tabs({ selected: 0 });
 
 

    }}
