// JavaScript Document
var w3c=document.getElementById && !document.all;
var ie=document.all;

if (ie||w3c) {
 // déclaration des variables uniquement pour IE vive microsoft ?!!
 var overlay;
 var my_window;
}

current=0;
  function buttonswitch(button){
   current=button;
    for(p=0;p<j;p++){
    currentbutton='floor'+p;
    currentbuttonsub='floorsub'+p;
    currentbuttontext='floortext'+p;
      if(p==button){
          document.getElementById(currentbuttontext).style.color="#FFFFFF";
          document.getElementById(currentbuttonsub).style.backgroundImage='url(img/current-bg.png)';
          document.getElementById(currentbuttonsub).style.backgroundRepeat='repeat-x';
          document.getElementById(currentbuttonsub).style.opacity='0.15';
          document.getElementById(currentbuttonsub).style.filter="alpha(opacity=15)";
          document.getElementById(currentbutton).style.backgroundColor='#95d80c';
          document.getElementById(currentbutton).style.borderRight="none";

      }
      else{
        document.getElementById(currentbuttonsub).style.backgroundImage='none';
        document.getElementById(currentbutton).style.backgroundColor='transparent';
        document.getElementById(currentbuttontext).style.color="#CCCCCC";
        document.getElementById(currentbutton).style.borderRight="1px dotted #ccc";
      }
      
    }
  
  }
  
  function divout(button){
  currentbutton='floortext'+button;
    if(button!=current){  
        document.getElementById(currentbutton).style.color='#CCCCCC';
        
    }
  }  
    
  function divover(button){
  currentbutton='floortext'+button;
    if(button!=current){  
        document.getElementById(currentbutton).style.color='#9F9F9F';
        
    }
  }   
    
function setEventHandlers() {
    fp.observe('LOADED', displayProjectInfo);
    fp.observe('CHANGED_PROJECT', displayProjectInfo);
    fp.observe('FINISHED', displayDesignInfo);
    fp.observe('LOAD_ERROR', displayLoadError);
    fp.observe('ADDED_OBJECT',
    function(pElement) {
        updateFurnitureElementCount(pElement, 1);
    });
    fp.observe('REMOVED_OBJECT',
    function(pElement) {
        updateFurnitureElementCount(pElement, -1);
    });
    fp.observe('SHOW_SIDEBAR', openSidebar);
    if (Floorplanner.Sidebar) {
        fp.observe("FINISHED", function() {
            setSizes();
            Floorplanner.Sidebar.afterLoad();
        });
    }
}

function copyplan(plan){

   var xhr_object = null;   
              
    if(window.XMLHttpRequest) // Firefox   
       xhr_object = new XMLHttpRequest();   
    else if(window.ActiveXObject) // Internet Explorer   
       xhr_object = new ActiveXObject("Microsoft.XMLHTTP");   
    else { // XMLHttpRequest non supporté par le navigateur   
       alert("XMLHTTPRequest objects not supported by browser, sorry");   
       return;   
     }   
     
     //alert("ajax.php?galery=" + idproduct);
     
     xhr_object.open("GET", "ajax.php?copyplan=" + plan, true);   
    
    xhr_object.send(null);   
    xhr_object.onreadystatechange = function() { 
    	if(xhr_object.readyState == 4) {
    		//alert(xhr_object.responseText);
        document.getElementById('galery').innerHTML=xhr_object.responseText;
        loadthumb(pagenumber);
    	}}
  
}
