// JavaScript Document

function zxcMse(zxcevt){
 if(!zxcevt) var zxcevt=window.event;
 if (document.all) return [zxcevt.clientX+zxcDocS()[0],zxcevt.clientY+zxcDocS()[1]];
 return [zxcevt.pageX,zxcevt.pageY];
}

function zxcDocS(){
 if (!document.body.scrollTop) return [document.documentElement.scrollLeft,document.documentElement.scrollTop];
 return [document.body.scrollLeft,document.body.scrollTop];
}

function zxcEventAdd(zxco,zxct,zxcf) {
 if ( zxco.addEventListener ){ zxco.addEventListener(zxct, function(e){ zxco[zxcf](e);}, false); }
 else if ( zxco.attachEvent ){ zxco.attachEvent('on'+zxct,function(e){ zxco[zxcf](e); }); }
 else {
  var zxcPrev=zxco["on" + zxct];
  if (zxcPrev){ zxco['on'+zxct]=function(e){ zxcPrev(e); zxco[zxcf](e); }; }
  else { zxco['on'+zxct]=zxco[zxcf]; }
 }
}

function zxcAddEvt(zxcobj,zxcfun,zxcevt){
 if (zxcobj['zxcadd'+zxcfun+zxcevt]) return;
 zxcobj['zxcadd'+zxcfun+zxcevt]=window[zxcfun];
 zxcEventAdd(zxcobj,zxcevt,'zxcadd'+zxcfun+zxcevt);
}

function zxcES(zxcele,zxcstyle,zxcp,zxctxt){
 if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); }
 for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; }
 if (zxcp){ zxcp.appendChild(zxcele); }
 if (zxctxt){ zxcele.appendChild(document.createTextNode(zxctxt)); }
 return zxcele;
}

function zxcIntPreview(zxcobj,zxcimg,zxcwidth,zxcheight,zxctxt){
 if (typeof(zxcobj)=='string') zxcobj=document.getElementById(zxcobj);
 if (zxcobj.preview) return;
 zxcobj.img=[zxcimg,zxcwidth,zxcheight];
 zxcobj.preview=zxcES('DIV',{position:'absolute',overflow:'hidden',visibility:'hidden',width:zxcwidth+'px',height:zxcheight+'px'},document.getElementsByTagName('BODY')[0]);
 zxcobj.preview.className='PreviewDiv';
 zxcES('DIV',{},zxcobj.preview,zxctxt||'').className='PreviewTxt';
 zxcAddEvt(zxcobj,'zxcPreview','mouseover');
 zxcAddEvt(zxcobj,'zxcPreview','mouseout');
 zxcAddEvt(zxcobj,'zxcMseMove','mousemove');
}

function zxcPreview(zxcevt){
 if (zxcevt.type=='mouseover') zxcMseMove(zxcevt,this);
 else zxcES(this.preview,{visibility:'hidden'});
 if (!this.imgobj){
  this.imgobj=zxcES('IMG',{position:'relative',left:'0px',top:'0px',width:this.img[1]+'px'},this.preview);
  this.imgobj.src=this.img[0];
  zxcES(this.preview.getElementsByTagName('DIV')[0],{},this.preview);
 }
 if (window['zxcAddIFrame']) zxcAddIFrame(this.preview);
}

function zxcMseMove(zxcevt,zxcobj){
 if (!zxcobj) zxcobj=this;
 zxcES(zxcobj.preview,{visibility:'visible',left:zxcMse(zxcevt)[0]+5+'px',top:zxcMse(zxcevt)[1]-zxcobj.img[2]+150+'px'});
 if (window['zxcAddIFrame']) zxcAddIFrame(this.preview);
}


function zxcAddIFrame(zxcobj){
 if (!document.all){ return; }
 if  (typeof(zxcobj)=='string'){ zxcobj=document.getElementById(zxcid); }
 if (!zxcobj){ return; }
 if (!zxcobj.ifr){
  zxcES(zxcobj,{zIndex:zxcGetStyle(zxcobj,'z-Index')||'2'});
  zxcobj.ifr=zxcES('IFRAME',{position:'absolute',overflow:'hidden',zIndex:(parseInt(zxcGetStyle(zxcobj,'zIndex'))-1),visibility:'visible'});
  zxcobj.parentNode.appendChild(zxcobj.ifr);
 }
 zxcES(zxcobj.ifr,{zIndex:(parseInt(zxcGetStyle(zxcobj,'zIndex'))-1),visibility:zxcGetStyle(zxcobj,'visibility')||'hidden',left:zxcobj.offsetLeft+'px',top:zxcobj.offsetTop+'px', width:zxcGetStyle(zxcobj,'width'),height:zxcGetStyle(zxcobj,'height')});
}

function zxcGetStyle(zxcel,zxcs){
 if (zxcel.style[zxcs]){ return zxcel.style[zxcs]; }
 if (zxcel.currentStyle){ return zxcel.currentStyle[zxcs]; }
 if (window.getComputedStyle){ return document.defaultView.getComputedStyle(zxcel,null).getPropertyValue(zxcs); }
 return false;
}

function zxcStyleValue(zxcobj,zxcp){ //  pass object and property, returns property value
 if (zxcobj.style[zxcp.replace('-','')]) return zxcobj.style[zxcp.replace('-','')];
 if (zxcobj.currentStyle) return zxcobj.currentStyle[zxcp.replace('-','')];
 return document.defaultView.getComputedStyle(zxcobj,null).getPropertyValue(zxcp.toLowerCase());
}

