//<script>alert()
    var i_line =3;
	var min_h_admin=200;
    var odiv_pere=null, odiv=null, zdiv="", hdiv="";//, obj_remove=null;
    var o_iframe= document.createElement( "IFRAME" );  
    o_iframe.id="iframe"; 					 //o_iframe.src="admin/iframe_admin.php";
	
    function on_modif_fiche_photo(obj){//create_element( tag, tag_type, idname, class_name )    	
		if( obj==odiv ) return;
		 _init_(obj,"table_up_img")
		get_div_pere(obj);
		eval_nav("hid_attr").value=get_class(obj);		 	 	
	    eval_nav("hid_cell").value="";
		if(odiv_pere)			 obj.parentNode.appendChild( eval_nav("div_form_admin") );
				
		obj.parentNode.appendChild( eval_nav("div_form_admin") );
    	eval_nav("div_form_admin").style.display="block"		
	}
	
	function on_modif_fiche_produit(obj){ 
		if( obj==odiv ) return;//{alert("on_modif_fiche_produit::"+odiv_pere+","+odiv);   }
		_init_(obj,"table_wy")		
		get_div_pere(obj);//set odiv && odiv_pere
		eval_nav("hid_attr").value=get_class(obj);		 	 	
	    eval_nav("hid_cell").value="";

		on_modif_(obj);													
    }
	
	function on_modif_div(obj){ if(odiv_pere)alert(odiv_pere.style.overflow)	//alert("on_modif_div")
		if( obj==odiv )return;//{alert("on_modif_div::"+odiv_pere+","+odiv);   }
		_init_(obj,"table_wy")		
		get_div_pere(obj);//set odiv && odiv_pere
	    eval_nav("hid_cell").value=obj.id;
	    eval_nav("hid_attr").value="";

		on_modif_(obj);
    }	
	
    function get_div_pere(o ){ 			
  		odiv_pere=null;
   		zdiv="";
   		hdiv="";
		
		odiv=o;		
		
		var val_page="";	if(eval_nav("page")) 	val_page=eval_nav("page").value;		
    	var css=null; 
		var i=0;							//alert(val_page)
		
		while( o && o!=document.body  ){
			css=get_class(o);//alert(css)//alert(i+"\n"+o.tagName+"\n"+css+"\n"+o.tagName+"\n"+o.innerHTML)	//alert(css)
			if( css==val_page || css=="cssover" ){		 	//alert(o)	//if( o.tagName=="DIV" ){//alert("____ok")	
                    odiv_pere=o; 			
                    zdiv=o.style.zIndex;
                    hdiv=o.style.height;
                    
                    o.style.overflow="visible";                    
                    o.style.zIndex="999";
					return o;
			}
			o=o.parentNode
			i=i+1;
		}	
		return null;
	}

    function _init_(obj, name){
		eval_nav("div_form_admin").style.display="none"
		eval_nav("btn_replace_code").style.display="none";	
		eval_nav("table_err_up").style.display="none";		
		eval_nav("table_code").style.display="none";		
		eval_nav("table_wy").style.display="none";	
		eval_nav("table_up_img").style.display="none";	
		eval_nav("code_html").value=""
		eval_nav("hid_cell").value="";
	    eval_nav("hid_attr").value="";
		
		if(odiv_pere){
			odiv_pere.style.height=hdiv;
			odiv_pere.style.zIndex=zdiv;
			odiv_pere.style.overflow="hidden"					
		}	
		if(odiv) 	odiv.style.display="block";		
		if(name)	if(eval_nav(name))	eval_nav(name).style.display="block";	
	}

    function on_modif_( obj ){   //    alert("on_modif_")
		var s_html=obj.innerHTML; 		
		var cls=get_class(obj);
		var h=obj.offsetHeight +30;
		var w=obj.offsetWidth; 

		if(odiv_pere){//alert(get_class(odiv))
			//var min_h_admin_offset=eval_nav("div_form_admin").offsetHeight;
			//if(!min_h_admin_offset)	min_h_admin_offset=min_h_admin
			//min_h_admin_offset+=300;
			//odiv_pere.style.height=min_h_admin_offset+"px";
       		
			 obj.parentNode.appendChild( eval_nav("div_form_admin") );
       		 obj.parentNode.appendChild( create_element("BR") );      		 
			 obj.parentNode.appendChild( o_iframe );
		}				

        oFrameWin=null;        oFrameDoc=null;            valFrame="";        clsFrame="";        essaie_ini_editor=0;        code=0;		
		o_iframe.style.width=w+"px"
        o_iframe.style.height=h+"px"
        o_iframe.setAttribute("frameborder", "1" );		

		obj.style.display="none"  		

		iframe_iniEditor( s_html , cls );

		eval_nav("div_form_admin").style.display="block"
    }


	function on_ferme(obj){	 	
		if(!odiv)	return;	
		if(oFrameDoc)	if(oFrameDoc.body){
			oFrameDoc.body.innerHTML="";				
			if(odiv && o_iframe)		if( odiv.parentNode==o_iframe.parentNode )	odiv.parentNode.removeChild( o_iframe );
		}
		_init_(odiv,"table_wy")		
		odiv_pere=null;
		odiv=null;		
		zdiv="";
		hdiv="";
	}		
	function on_voir(obj){	 	
		if(!odiv)	return;	
		if(oFrameDoc)	if(oFrameDoc.body){
			odiv.innerHTML=insert_rn(oFrameDoc.body.innerHTML);
			oFrameDoc.body.innerHTML="";				
			if(odiv && o_iframe)		if( odiv.parentNode==o_iframe.parentNode )	odiv.parentNode.removeChild( o_iframe );
		}
		_init_(odiv,"table_wy")		
		odiv_pere=null;
		odiv=null;		
		zdiv="";
		hdiv="";
		return false;	
	}	
	function on_save(obj){	 	
		//alert(oFrameDoc.body.firstChild)
		if(oFrameDoc)	
			if(oFrameDoc.body){
				if(get_class(oFrameDoc.body.firstChild)=="divtodelete")	oFrameDoc.body.removeChild(oFrameDoc.body.firstChild);
				eval_nav("code_html").value=insert_rn(oFrameDoc.body.innerHTML);//alert(eval_nav("code_html"))
			}
        eval_nav("form_admin").submit()
		return false;
	}	

	function display_code(obj){
		var code=eval_nav("code_html");			
		eval_nav("btn_replace_code").style.display="none";	
		eval_nav("table_err_up").style.display="none";		
		code.value="";
		
		if(eval_nav("table_code").style.display=="none"){
			code.value=insert_rn(oFrameDoc.body.innerHTML);
			
			code.style.height=(i_line*20)+"px";
			code.style.width=eval_nav( "div_form_admin" ).offsetWidth+"px"

			eval_nav("table_code").style.display="block";
			eval_nav("btn_replace_code").style.display="block";	
		}
		else{
			eval_nav("table_code").style.display="none";
		}
		return true;
	} 
	
    function display_err_up(obj){
		var err_up=eval_nav("div_err_up");
		
		eval_nav("btn_replace_code").style.display="none";	
		eval_nav("table_code").style.display="none";		
		code.value="";
			
		if(eval_nav("table_err_up").style.display=="none"){
			eval_nav("table_err_up").style.display="block";
		}
		else{
			eval_nav("table_err_up").style.display="none";
		}
		return true;
	} 	
	
    function set_code(obj){	
		oFrameDoc.body.innerHTML=replace_rn(eval_nav("code_html").value)
		display_code(obj)
	}
	
    function win_open(h){		
		var mywin=window.open(h, 'popuppage', 'width=650, height=650, scrollbars=yes toolbar=1 resizable=1');
	}
	
	function click_but_href(obj){
		if(!oFrameDoc) 					return true;
		if(!oFrameDoc.selection) 	return true;
        var sel = oFrameDoc.selection;
        if (!sel) return true;
		var txt_href=eval_nav("lien");	
		if( !txt_href.value ){
			alert("Entrez un lien !.") 
		 	return true;		
		}

	    var rng = sel.createRange();	
        if (rng!=null) 
       		if(rng.text){
				var s;
				  if(eval_nav( "chk_win_open" ).checked) s="<a href=\"javascript:win_open('"+eval_nav("lien").value+"')\">"+rng.text+"</a>";
				  else 															s="<a href=\""+txt_href.value+"\">"+rng.text+"</a>";
			      rng.pasteHTML(s);   
        	}
		txt_href.value="";
        return false;
	}

   // function on_page_over(obj, cls){}
   // function on_page_out(obj, cls){}

    function on_over(obj, cls){   //alert ("over:: id"+obj.id+" cls:"+cls+" \n inerHTML:"+obj.innerHTML)        //var o_pere=get_div_pere(obj, true)                if(!o_pere)	return; 
        if(cls )	set_class(obj, cls + "_over");
        else	set_class(obj, "cssover" );//cls + "_over"); 		//alert (o_pere)
    }
    function on_out(obj, cls){ //alert ("out:: id"+obj.id+" cls:"+cls+" \n inerHTML:"+obj.innerHTML)
		//var o_pere=get_div_pere(obj, true);         if(!o_pere)	return;     	
		set_class(obj, cls); //alert (o_pere)
    }

 

/*
    function on_modif_fiche_support(obj){ 
    	_init_(obj,"table_wy")
		eval_nav("hid_attr").value=get_class(obj);		 	 	
    	
		on_modif_(obj);															
    }
    function on_modif_support(obj){ 
    	_init_(obj,"table_wy")
		eval_nav("hid_attr").value=get_class(obj);		 	 	
    	
		on_modif_(obj);															
    }
    function on_modif_page(obj){ //alert("on_modif_page")
		_init_(obj,"table_wy")		
	    eval_nav("hid_attr").value= eval_nav("page").value
    	
		on_modif_(obj)
    }*/



	