var RollIt = {
timeout : null,
		  showPopup : function(){
			  clearTimeout(this.timeout);
			  if($('rollit').style.display == 'none'){
				  this.timeout = setTimeout(function(){new Effect.BlindDown('rollit', {duration:.3, fps:40})},400);
			  }
		  },
hidePopup : function(){
				if($('rollit').style.display == 'none'){
					clearTimeout(this.timeout);
				}else{
					this.timeout = setTimeout(function(){new Effect.BlindUp('rollit', {duration:.3, fps:40})},300);
				}
			}    
}

function number_format( number, laenge, sep, th_sep ) {
	number = Math.round( number * Math.pow(10, laenge) ) / Math.pow(10, laenge);
	str_number = number+"";
	arr_int = str_number.split(".");
	if(!arr_int[0]) arr_int[0] = "0";
	if(!arr_int[1]) arr_int[1] = "";
	if(arr_int[1].length < laenge){
		nachkomma = arr_int[1];
		for(i=arr_int[1].length+1; i <= laenge; i++){  nachkomma += "0";  }
		arr_int[1] = nachkomma;
	}
	if(th_sep != "" && arr_int[0].length > 3){
		Begriff = arr_int[0];
		arr_int[0] = "";
		for(j = 3; j < Begriff.length ; j+=3){
			Extrakt = Begriff.slice(Begriff.length - j, Begriff.length - j + 3);
			arr_int[0] = th_sep + Extrakt +  arr_int[0] + "";
		}
		str_first = Begriff.substr(0, (Begriff.length % 3 == 0)?3:(Begriff.length % 3));
		arr_int[0] = str_first + arr_int[0];
	}
	return arr_int[0]+sep+arr_int[1];
}



	var window_handle = "";
	function openPage(page,name)
	{
		// test pour eviter des requetes simultanées au configurateur
		
		if (!checkLoading())
		{
			if (window_handle && !window_handle.closed) 
			{
    			//window_handle.close(); // focus sur popup
			}
			
			window_handle = window.open(page,name);
   			window_handle.focus(); // focus sur popup
			
			
		}	
	}
	
	function openCustomPopup(page, nom, width, height, scroll, resize)
	{	    
		window_handle = window.open(page, nom, "scrollbars=" + scroll + ",resizable=" + resize + ",menubar=no,width=" + width + ",height=" + height);
   		window_handle.focus(); // focus sur popup
	}
	
	function openCustomPopupPrintConfiguration(page, nom, width, height, scroll, text)
	{	    
		// test pour eviter des requetes simultanées au configurateur
		
		if (!checkLoading())
		{
			if (window_handle && !window_handle.closed) 
			{
    			window_handle.close(); // focus sur popup
			}
			
			if (checkPrintEnabled())
    		{
   				//alert('ouverture popup');
   				window_handle = window.open(page, nom, "scrollbars=" + scroll + ",menubar=no,width=" + width + ",height=" + height);
   				window_handle.focus(); // focus sur popup
			}
			else 
    			alert(text);
			
			
		}	
	}
	
	function AdjustPopUp(l,h) {
	w = window;
	w.resizeTo(l,h);
	w.focus();
	}
	
	function openPopupWithXMLLink(url)
	{	
		window.open('','MiniSite','scrollbars=0, resizable=0, menuBar=0, width=800, height=600');
		document.XMLForm.target = "MiniSite";
		document.XMLForm.action = url;
		document.XMLForm.submit();
	}

/***allows to print page ***/
var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 

function PrintPage(){
  if (pr && !mac){
      window.print();
    }
  else if ( browserName == "Microsoft Internet Explorer" && browserVer <= 4 && !mac ){
      vbPrintPage();
    }
  else if (mac){
      if (da){
        alert("Pour imprimer cette page,\n veuillez utiliser le menu fichier - imprimer\n de votre navigateur.");
      }else{
            window.print();
      }
    }
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}

function GetWebo(WEBO_ZONE,WEBO_PAGE,ID_SITE,WEBO_TITRE) {
    alert(WEBO_ZONE+' '+WEBO_PAGE+' '+ID_SITE+' '+WEBO_TITRE);
}
