// from old /includes/common.js var isDOM=document.getElementById?true:false var isOpera=isOpera5=window.opera && isDOM var isOpera6=isOpera && window.print var isOpera7=isOpera && document.readyState var isMSIE=isIE=document.all && document.all.item && !isOpera var isStrict=document.compatMode=='CSS1Compat' var isNN=isNC=navigator.appName=="Netscape" var isNN4=isNC4=isNN && !isDOM var isMozilla=isNN6=isNN && isDOM var statusCode = ""; var delayedLoadLayers=new Object(); var delayedLoadLayersOnLoad=new Object(); var delayedLoadXmlHttp=new Object(); var currentTabs=new Object(); if( (document.compatMode)&& (document.compatMode == 'CSS1Compat') &&(document.documentElement)) { window.readScroll = document.documentElement; } else if(document.body) { window.readScroll = document.body; } else if( document.documentElement ) { window.readScroll = document.documentElement; } function getWindowScrollLeft() { if( window.pageXOffset > 0 ) { return window.pageXOffset; } else { return window.readScroll.scrollLeft || 0; } } function getWindowScrollTop() { if( window.pageYOffset > 0 ) { return window.pageYOffset; } else { return window.readScroll.scrollTop || 0; } } function Point( x ,y ) { this.x=x; this.y=y; } Pnt=Point.prototype function getRect(elem ) { // return absolute position of elem // (Left, Top, Right, Bottom) in page var i; if (typeof(elem.myRect)!="undefined") return elem.myRect; var myRect = Array(elem.offsetLeft, elem.offsetTop, elem.offsetLeft + elem.offsetWidth-1, elem.offsetTop + elem.offsetHeight-1) if (!elem.offsetParent) { var xAdjust = (window.readScroll.clientLeft||0); var yAdjust = (window.readScroll.clientTop||0); for (i=0;i<4;i++) myRect[i] += (i%2)?yAdjust:xAdjust; return myRect; } newRect = getRect(elem.offsetParent) for (i=0;i<4;i++) myRect[i] = myRect[i] + newRect[i % 2]; return myRect; } function HTMLLayer( name,noAlert ) { if( typeof(name)=='string' ) { this.name=name; this.getObj(name,noAlert); } else { this.obj = name; this.style = this.obj.style?this.obj.style:this.obj; } } HTMLL=HTMLLayer.prototype HTMLL.focus=function() { this.obj.focus(); } HTMLL.getObj=function(name,noAlert) { this.name=name; if (document.getElementById) { this.obj = document.getElementById(name); } else if (document.all) { this.obj = document.all[name]; } else if (document.layers) { this.obj = getObjNN4(document,name); } if( this.obj==null) { if( noAlert){}else{alert(name);} } else { this.style = this.obj.style?this.obj.style:this.obj; } return; } HTMLL.getValue=function() { return this.obj.value; } HTMLL.setValue=function( val) { return this.obj.value=val; } HTMLL.getLeft=function() { return getRect(this.obj)[0]; } HTMLL.getWidth=function() { var rect=getRect(this.obj); return rect[2]-rect[0]; } HTMLL.getHeight=function() { var rect=getRect(this.obj); return rect[3]-rect[1]; } HTMLL.getTop=function() { return getRect(this.obj)[1]; } HTMLL.getObjNN4=function (obj,name) { var x = obj.layers; var foundLayer; for (var i=0;i'; this.obj.document.open(); this.obj.document.write(text2); this.obj.document.close(); } } function getMouseClickPosition( e,relTo ) { var out=new Point(0,0); if ( !e ) { var target = new HTMLLayer(event.target || event.srcElement); out.x = window.event.x + getWindowScrollLeft()+target.getLeft()- relTo.getLeft(); out.y = window.event.y + getWindowScrollTop()+target.getTop()- relTo.getTop(); } else if ( e.clientX || e.clientY ) { out.x = e.clientX + getWindowScrollLeft() - relTo.getLeft(); out.y = e.clientY + getWindowScrollTop()- relTo.getTop(); } else if ( e.pageX || e.pageY ) { out.x = e.pageX - relTo.getLeft(); out.y = e.pageY - relTo.getTop(); } return out; }; function getObj(name) { if (document.getElementById) { this.obj = document.getElementById(name); this.style = document.getElementById(name).style; } else if (document.all) { this.obj = document.all[name]; this.style = document.all[name].style; } else if (document.layers) { this.obj = getObjNN4(document,name); this.style = this.obj; } return this.obj; } function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; } function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } var hexbase="0123456789ABCDEF"; // take a decimal integer, return 2-digit hex string function DecToHex(number) { return hexbase.charAt((number>> 4)& 0xf)+ hexbase.charAt(number& 0xf); } // take a hex string, return decimal integer function HexToDec(str) { return parseInt(str.toUpperCase(), 16); } function colorFromHexCode( col ) { if( col.substr(0,1)=="#") { col=col.substr(1); } col=col.toUpperCase(); return new RAColor( HexToDec(col.substr(0,2)),HexToDec(col.substr(2,2)),HexToDec(col.substr(4,2)) ); } function RAColor( red, green, blue) { this.r=red; this.g=green; this.b=blue; } RACol=RAColor.prototype; RACol.setFromColorString=function(str) { if( str.substr(0,1)=="#") { str=str.substr(1); } this.r=HexToDec(str.substr(0,2)); this.g=HexToDec(str.substr(2,2)); this.b=HexToDec(str.substr(4,2)); } RACol.getHex=function() { return "#"+DecToHex(this.r)+DecToHex(this.g)+DecToHex(this.b); } RACol.getColor= function(changeTo,cur,end ) { r=Math.round( this.red+ ((changeTo.red-this.red)*cur/end) ); g=Math.round( this.green+ ((changeTo.green-this.green)*cur/end) ); b=Math.round( this.blue+ ((changeTo.blue-this.blue)*cur/end) ); return "#"+DecToHex(r)+DecToHex(g)+DecToHex(b) } RACol.makeDarker=function ( amount) { this.r=Math.max(0,Math.floor(this.r*(1-amount))); this.g=Math.max(0,Math.floor(this.g*(1-amount))); this.b=Math.max(0,Math.floor(this.b*(1-amount))); } var colors=new Object(); var colorsNotify=new Object(); //colors['colorselect1']=new RAColor("#000000"); function colorSelect(e,name,rgb) { var posx = 0; var posy = 0; if (!e) var e = window.event; if (e.pageX || e.pageY) { posx = e.pageX; posy = e.pageY; } else if (e.clientX || e.clientY) { posx = e.clientX + document.body.scrollLeft; posy = e.clientY + document.body.scrollTop; } getObj(name+rgb); posx-= findPosX(this.obj); if(posx<0) { posx=0; } else if( posx>255) { posx=255; } getObj(name+rgb+"a"); this.style.backgroundPosition=posx+"px 0px"; (colors[name])[rgb]=posx; getObj(name); this.obj.value=colors[name].getColorString().substr(1); getObj(name+"col"); this.style.backgroundColor=colors[name].getColorString(); if( colorsNotify[name]!='' ) { eval( colorsNotify[name]+"('"+colors[name].getColorString().substr(1)+"')"); } } RACol.getColorString=function() { return "#"+DecToHex(this.r)+DecToHex(this.g)+DecToHex(this.b); } function setColorField(name,color) { getObj(name); colors[name].setFromColorString(color); this.obj.value=colors[name].getColorString().substr(1); getObj(name+"col"); this.style.backgroundColor=colors[name].getColorString(); getObj(name+"ra"); this.style.backgroundPosition=colors[name].r+"px 0px"; getObj(name+"ga"); this.style.backgroundPosition=colors[name].g+"px 0px"; getObj(name+"ba"); this.style.backgroundPosition=colors[name].b+"px 0px"; } function updateColorField(name) { var l=new HTMLLayer(name); colors[name].setFromColorString(this.obj.value); l.obj.value=colors[name].getColorString().substr(1); getObj(name+"col"); this.style.backgroundColor=colors[name].getColorString(); l=new HTMLLayer(name+"ra"); l.style.backgroundPosition=colors[name].r+"px 0px"; l=new HTMLLayer(name+"ga"); l.style.backgroundPosition=colors[name].g+"px 0px"; l=new HTMLLayer(name+"ba"); l.style.backgroundPosition=colors[name].b+"px 0px"; } function colorField( name, value,notify ) { colors[name]=colorFromHexCode(value); colorsNotify[name]=notify; document.write(""); document.write("
"); document.write("
"); getObj(name); if( colors[name] ) { this.obj.value=colors[name].getHex().substr(1); updateColorField(name); } } function GetXmlHttpObject() { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } return http_request; } function addDelayedLoadLayer( id, src ) { delayedLoadLayers[id]=src; } function setDelayedLoadLayerOnLoad(id, act) { delayedLoadLayersOnLoad[id]=act; } function loadDelayedLoadLayer( id) { if( typeof(delayedLoadLayers[id])=='string' ) { var url=delayedLoadLayers[id]; delayedLoadXmlHttp[id]=GetXmlHttpObject(); delayedLoadXmlHttp[id].onreadystatechange=updateDelayedLayers; delayedLoadXmlHttp[id].open("GET",url,true) delayedLoadXmlHttp[id].send(null) } delayedLoadLayers[id]=null; } function showLayer( id ) { if(delayedLoadLayers[id] ) { loadDelayedLoadLayer( id); } var l=new HTMLLayer(id); l.style.display=""; } function updateDelayedLayers() { for( var id in delayedLoadXmlHttp ) { if (delayedLoadXmlHttp[id] &&(delayedLoadXmlHttp[id].readyState==4 || delayedLoadXmlHttp[id].readyState=="complete")) { var l=new HTMLLayer(id ); l.write(delayedLoadXmlHttp[id].responseText); delayedLoadXmlHttp[id]=false; if( delayedLoadLayersOnLoad[id] ) { eval(delayedLoadLayersOnLoad[id]); delayedLoadLayersOnLoad[id]=''; } } } } function showTab(name,num) { if( typeof( currentTabs[name] ) == 'undefined' ) { currentTabs[name] = tabGetFirstEnabled( name ); } if( typeof( currentTabs[name] ) != 'undefined' ) { var buttonOld=new HTMLLayer('__'+name+"tabbutton_"+currentTabs[name]); var frameOld=new HTMLLayer('__'+name+"tab_"+currentTabs[name]); buttonOld.obj.className="tabbutton"; frameOld.style.display="none"; } var buttonNew=new HTMLLayer('__'+name+"tabbutton_"+num); var frameNew=new HTMLLayer('__'+name+"tab_"+num); currentTabs[name]=num; buttonNew.obj.className="tabbuttonselected"; frameNew.style.display="block"; showLayer('__'+name+"tab_"+num); } function tabGetFirstEnabled( name ) { var st = '__'+name+'tabbutton_'; var stlen = st.length; if( document.getElementsByTagName ) { var node_list = document.getElementsByTagName('a'); for (var i = 0; i < node_list.length; i++) { var ele = node_list[i]; if( ele.id && ele.id.substr( 0,stlen) == st) { if( !( (ele.style && ele.style.display == 'none' ) || ele.display == 'none' ) ) { return ele.id.substr( stlen ); } } } } else { for( var i in document.all ) { if( i.substr( 0,stlen) == st ) { var ele = document.all[i]; if( !( (ele.style && ele.style.display == 'none' ) || ele.display == 'none' ) ) { return i.substr( stlen ); } } } } } function tabDisable( name, num ) { if( typeof( currentTabs[name] ) == 'undefined' ) { currentTabs[name]= tabGetFirstEnabled( name ); } var button=new HTMLLayer('__'+name+"tabbutton_"+num); button.style.display="none"; if(currentTabs[name]==num ) { showTab(name,tabGetFirstEnabled( name )); } } function tabEnable( name, num ) { var button=new HTMLLayer('__'+name+"tabbutton_"+num); button.style.display=""; }