var zxcToDay=new Date();

function siteTitle(e,args){
 zxcES(document.getElementById('TitleRed'),{left:args[1]+'px'},null,args[0]);
 zxcES(document.getElementById('TitleBlack'),{left:args[1]+1+'px'},null,args[0]);
 if (args[2]) zxcES(document.getElementById('header'),{height:args[2]+'px'});
 if (args[3]) zxcES(document.getElementById('content1'),{height:args[3]+'px'});
 if (args[4]) zxcES(document.getElementById('content2'),{height:args[4]+'px'});
}

function siteTabsInit(e,args){
 var oop=new siteTabs(args);
}

function siteTabs(args){
 var oop=this;
 this.mse=[args[1],args[1]+' '+args[4]];
 this.obj=document.getElementById(args[0]);
 this.tabs=zxcByClassName(args[1],this.obj,'DIV');
 this.items=zxcByClassName(args[2],this.obj,'DIV');
 this.nu=args[3]||0;
 this.nu=0;
 for (var z0=0;z0<this.tabs.length;z0++){
  zxcES(this.tabs[z0],{zIndex:(z0!=this.nu?'0':'2')});
  zxcES(this.items[z0],{zIndex:(z0!=this.nu?'0':'1')});
  this.tabs[z0].onclick=function(){ oop.cng(this); }
  this.tabs[z0].onmouseover=function(){ this.className=oop.mse[1]; }
  this.tabs[z0].onmouseout=function(){ if (this!=oop.lst){ this.className=oop.mse[0]; } }
  var txt=zxcES('DIV',{marginLeft:'10px'},this.tabs[z0],args[5][z0]);
  txt.className=args[3];
 }
 this.lst=this.tabs[this.nu];
 this.lst.className=this.mse[1];
 this.lstitem=this.items[this.nu];
 this.obj.getElementsByTagName('INPUT')[0].onclick=function(){
  var ta=oop.lstitem.getElementsByTagName('TEXTAREA')[0];
  if (ta) ta.select();
 }
 this.but=this.obj.getElementsByTagName('INPUT')[0];
 this.cng(this.lst);
}

siteTabs.prototype.cng=function(tab){
 this.lst.className=this.mse[0];
 zxcES(this.lst,{zIndex:'0'});
 zxcES(this.lstitem,{zIndex:'0'});
 for (var z0=0;z0this.tabs.length;z0++){
  if (this.tabs[z0]==tab){
   this.lst=this.tabs[z0];
   this.lstitem=this.items[z0];
   break;
  }
 }
 zxcES(this.lst,{zIndex:'2'});
 zxcES(this.lstitem,{zIndex:'1'});
 zxcES(this.but,{visibility:(this.lstitem.getElementsByTagName('TEXTAREA')[0]?'visible':'hidden')});
 this.lst.className=this.mse[1];
}


function zxcByClassName(nme,el,tag){
 if (typeof(el)=='string') el=document.getElementById(el);
 el=el||document;
 for (var tag=tag||'*',reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName(tag),ary=[],z0=0; z0<els.length;z0++){
  if(reg.test(els[z0].className)) ary.push(els[z0]);
 }
 return ary;
}

function zxcSV(obj,par){
 if (obj.currentStyle) return obj.currentStyle[par.replace(/-/g,'')];
 return document.defaultView.getComputedStyle(obj,null).getPropertyValue(par.toLowerCase());
}

function zxcSVInt(obj,par){
 if (obj.currentStyle) return parseInt(obj.currentStyle[par.replace(/-/g,'')]);
 return parseInt(document.defaultView.getComputedStyle(obj,null).getPropertyValue(par.toLowerCase()));
}

function zxcEventAdd(o,f,e,p) {
 if ( o.addEventListener ){ o.addEventListener(e,function(ev){ return o[f](ev,p);}, false); }
 else if ( o.attachEvent ){ o.attachEvent('on'+e,function(ev){ return o[f](ev,p); }); }
 else {
  var prev=o['on'+e];
  if (prev){ o['on'+e]=function(ev){ prev(ev); o[f](ev,p); }; }
  else { o['on'+e]=o[f]; }
 }
}

function zxcAddEvt(obj,fun,ev,p){
 if (obj['zxc'+fun+ev]) return;
 obj['zxc'+fun+ev]=window[fun];
 zxcEventAdd(obj,'zxc'+fun+ev,ev,p);
}


function zxcES(ele,style,par,txt){
 if (typeof(ele)=='string') ele=document.createElement(ele);
 for (key in style) ele.style[key]=style[key];
 if (par) par.appendChild(ele);
 if (txt) ele.appendChild(document.createTextNode(txt));
 return ele;
}

function zxcPos(obj){
 var rtn=[obj.offsetLeft,obj.offsetTop];
 while(obj.offsetParent!=null){
  var objp=obj.offsetParent;
  rtn[0]+=objp.offsetLeft-objp.scrollLeft;
  rtn[1]+=objp.offsetTop-objp.scrollTop;
  obj=objp;
 }
 return rtn;
}

function zxcWWHS(){
 if (window.innerHeight) return [window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset];
 else if (document.documentElement.clientHeight) return [document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop];
 return [document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop];
}


