var displaymode="always"

var enablefade="no" //("yes" to enable fade in effect, "no" to disable)
var autohidebox=["no", 5] //Automatically hide box after x seconds? [yes/no, if_yes_hide_after_seconds]
var showonscroll="yes" //Should box remain visible even when user scrolls page? ("yes"/"no)

if (parseInt(displaymode)!=NaN)
var random_num=Math.floor(Math.random()*displaymode)

function displayloadingbox(){
var ie=document.all && !window.opera
var dom=document.getElementById
iebody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
objref=(dom)? document.getElementById("fadeinbox") : document.all.fadeinbox
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
var docwidth=(ie)? iebody.clientWidth : window.innerWidth
docheight=(ie)? iebody.clientHeight: window.innerHeight
var objwidth=objref.offsetWidth
objheight=objref.offsetHeight
objref.style.left=docwidth/2-objwidth/2+"px"
objref.style.top=((scroll_top+docheight/2-objheight/2) - 70)+"px"

if (showonscroll=="yes")
showonscrollvar=setInterval("staticfadebox()", 50)

objref.style.visibility="visible"
if (objref.style.MozOpacity){
objref.style.MozOpacity=1
controlledhidebox()
}
else
controlledhidebox()
}

function mozfadefx(){
if (parseFloat(objref.style.MozOpacity)<1)
objref.style.MozOpacity=parseFloat(objref.style.MozOpacity)+Mozfadedegree
else{
clearInterval(mozfadevar)
controlledhidebox()
}
}

function staticfadebox(){
var ie=document.all && !window.opera
var scroll_top=(ie)? iebody.scrollTop : window.pageYOffset
objref.style.top=((scroll_top+docheight/2-objheight/2) - 70)+"px"
}

function hidefadebox(){
objref.style.visibility="hidden"
if (typeof showonscrollvar!="undefined")
clearInterval(showonscrollvar)
}

function controlledhidebox(){
if (autohidebox[0]=="yes"){
var delayvar=(enablefade=="yes" && objref.filters)? (autohidebox[1]+objref.filters[0].duration)*1000 : autohidebox[1]*1000
setTimeout("hidefadebox()", delayvar)
}
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
countfield.value = maxlimit - field.value.length;
}


function f11Characters(f11taid,f11strg,f11tbid){
 var f11taobj=document.getElementById(f11taid);
 window['f11Left'+f11taid]=[document.getElementById(f11tbid),parseInt(f11strg.replace(/\D/g,'')),f11strg.replace(/\d/g,'')];
 f11AddEvt(f11taobj,'f11Left','keyup');
 f11AddEvt(f11taobj,'f11Left','keydown');
 f11AddEvt(f11taobj,'f11Left','keypress');
 f11Left(f11taobj);
}

function f11Left(f11obj){
 var f11kk;
 var f11evt=window.event||arguments.callee.caller.arguments[0];
 if (f11evt.which){ f11kk=f11evt.which; }
 else { f11kk=f11evt.keyCode; }
 if (!f11obj.id){ var f11obj=this; }
 var f11ary=window['f11Left'+f11obj.id];
 if ((f11kk==8&&f11evt=='keypress')||f11obj.value.length>f11ary[1]){
  f11obj.value=f11obj.value.substring(0,f11ary[1]);
 }
 var f11val=f11obj.value.replace(/\n|\r/g,'').length;
 if (f11ary[0]){
  if (f11ary[0].tagName.toUpperCase()=='INPUT'){ f11ary[0].value=(f11ary[1]-f11val)+f11ary[2]; }
  else { f11ary[0].innerHTML=(f11ary[1]-f11val)+f11ary[2]; }
 }
}

function f11EventAdd(f11o,f11t,f11f) {
 if ( f11o.addEventListener ){ f11o.addEventListener(f11t, function(e){ f11o[f11f](e);}, false); }
 else if ( f11o.attachEvent ){ f11o.attachEvent('on'+f11t,function(e){ f11o[f11f](e); }); }
 else {
  var f11Prev=f11o["on" + f11t];
  if (f11Prev){ f11o['on'+f11t]=function(e){ f11Prev(e); f11o[f11f](e); }; }
  else { f11o['on'+f11t]=f11o[f11f]; }
 }
}

var f11Evt=0;

function f11AddEvt(f11o,f11fun,f11evt){
 if (f11o['f11'+f11fun+f11evt]){ return; }
 f11o['f11addEvt'+f11Evt]=window[f11fun];
 f11o['f11'+f11fun+f11evt]=true;
 f11EventAdd(f11o,f11evt,'f11addEvt'+f11Evt);
 f11Evt++;
}


