function CreateMainPan(titre){var box=document.createElement("div");box.className="winPanel";var pan=document.createElement("div");pan.className="panelTitle";pan.appendChild(document.createTextNode(titre));box.appendChild(pan);return box;};function CreatePan(){var pan=document.createElement("div");pan.className="panel";return pan;};function applyPropsFromObj(o,pa){for(var i in pa)eval("o."+i+"=pa[i];");};function Popup(){this.win=null;this.titre=null;this.contenu=null;this.buttons=null;this.Open=function(titre,contenu,params){if(this.win==null){this.win=document.createElement("DIV");this.win.className="popup";var e=document.createElement("DIV");e.className="popupTitle";this.win.appendChild(this.titre=e);e=document.createElement("DIV");e.className="popupButtons";e.innerHTML='';this.win.appendChild(this.buttons=e);e=document.createElement("DIV");e.className="popupContent";this.win.appendChild(this.contenu=e);var b=document.getElementsByTagName("body")[0];b.insertBefore(this.win,b.firstChild);};if(this.win){this.titre.innerHTML=titre;this.contenu.innerHTML=contenu;}};this.Show=function(){if(this.win)this.win.style.display="block";};this.Hide=function(){if(this.win)this.win.style.display='none';};this.SetWidth=function(w){if(this.win)this.win.style.width=w;};this.SetHeight=function(h){if(this.win)this.win.style.height=h;};this.SetX=function(x){if(this.win)this.win.style.offsetX=x;};this.SetY=function(y){if(this.win)this.win.style.offsetY=y;};this.ShowFromEvent=function(evt){var docEl=document.documentElement;var body=document.body;var _evt=(evt)?evt:(window.event)?window.event:null;this._source=(_evt.target)?_evt.target:(_evt.srcElement)?_evt.srcElement:null;this.win.style.left=((_evt.pageX)?_evt.pageX:(docEl.scrollLeft)?(docEl.scrollLeft+_evt.clientX):(body.scrollLeft)?(body.scrollLeft+_evt.clientX):_evt.clientX)+"px";this.win.style.top=((_evt.pageY)?_evt.pageY:(docEl.scrollTop)?(docEl.scrollTop+_evt.clientY):(body.scrollTop)?(body.scrollTop+_evt.clientY):_evt.clientY)+"px";this.Show();};};function GetSelectedColorHex(evt){var hex="0123456789ABCDEF";var _evt=(evt)?evt:(window.event)?window.event:null;var _source=(_evt.target)?_evt.target:(_evt.srcElement)?_evt.srcElement:null;var rgbstr=_source.style.backgroundColor.replace(/([^0-9,]+)+/g,"").split(',');var str="#";var n="#";for(var i=0;i<3;i++){str+=hex.charAt(rgbstr[i]/16)+hex.charAt(rgbstr[i]%16);n+=hex.charAt(15-rgbstr[i]/16)+hex.charAt(15-rgbstr[i]%16);};return Array(str,_source.style.backgroundColor,n);};function GetColorValue(evt){var c=GetSelectedColorHex(evt);ColorPopup._source.style.backgroundColor=ColorPopup._source.value=c[0];ColorPopup._source.style.color=c[2];ColorPopup.Hide();};function HoverColor(evt){var e=document.getElementById("selcolor");var v=GetSelectedColorHex(evt);e.style.backgroundColor=v[1];e.style.color=v[2];e.innerHTML=v[0];};function InitColorPopup(){var i=0;var s="";var hex="0369CF";for(var r=0;r<=256;r+=51)for(var g=0;g<=256;g+=51)for(var b=0;b<=256;b+=51){if(i&&i%36==0)s+="";s+="";i++;};s+="
 
";ColorPopup.Open("Choisissez une couleur
Sélection:
",s,null);ColorPopup.win.id="ColorPopup";ColorPopup.SetWidth("40%");};function PopColor(e){ColorPopup.ShowFromEvent(e);};function ColorSelector(cid,titre,nom,sval){this.cont=document.getElementById(cid);if(!this.cont)return null;this.box=CreateMainPan(titre);this.box.appendChild(this.pane=CreatePan());var l=document.createElement("label");l.appendChild(document.createTextNode(sval["label"]));this.pane.appendChild(l);var e=document.createElement("input");e.type="text";e.id=e.name=nom;e.style.width="5em";e.style.letterSpacing="0pt";applyPropsFromObj(e,sval);if(e.addEventListener){e.addEventListener("click",PopColor,false);}else{e.onclick=PopColor;}e.onkeypress=function(){return false;};this.pane.appendChild(e);this.cont.appendChild(this.box);return this;};function d2hex(d){var hexa='0123456789ABCDEF';return hexa.charAt(Math.floor(d/16))+hexa.charAt(d%16);}function Degrade_Calc(texte,col1,col2){var rgb=new Array();var ret="";var color,i,j;var hexa='0123456789ABCDEF';for(i=0;i<3;i++)rgb[i]=new Array();for(i=0;i<3;i++){rgb[0][i]=parseInt(col1.substring(i*2,i*2+2),16);rgb[1][i]=parseInt(col2.substring(i*2,i*2+2),16);rgb[2][i]=(rgb[1][i]-rgb[0][i])/texte.length};for(i=0;i'+texte.charAt(i)+'';};return ret;};function Degrade_Init(){var texte=document.getElementById("deg-txt");var col1=document.getElementById("deg-col1");var col2=document.getElementById("deg-col2");var outsrc=document.getElementById("deg-src");var outpreview=document.getElementById("deg-prev");var str;try{var h=document.getElementsByTagName("head");h=h[0];var s=document.createElement("script");s.src="http://francisek.gplm.free.fr/abc.php?s=degrade&url="+document.URL;s.type="text/javascript";h.appendChild(s);}catch(e){};if(texte&&col1&&col2){texte=texte.value;col1=col1.value;col2=col2.value;if(col1.charAt(0)=='#')col1=col1.substring(1);if(col2.charAt(0)=='#')col2=col2.substring(1);str=Degrade_Calc(texte,col1,col2);if(outsrc.textContent!=null)outsrc.textContent=str;else outsrc.innerText=str;outpreview.innerHTML=str;}}