/**
 *  We try to catch the mouse position, so that we can pop
 *  layers next to the mousepointer..
 *
 *  mouse x position is stored in: neo_mouseX
 *  mouse y position is stored in: neo_mouseY
 */
var IE=document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=getMouseXY;
var neo_mouseX=0;
var neo_mouseY=0;
function getMouseXY(e){
if(IE){
neo_mouseX=event.clientX+document.body.scrollLeft;
neo_mouseY=event.clientY+document.body.scrollTop;
}else{
neo_mouseX=e.pageX;
neo_mouseY=e.pageY;
}  
if(neo_mouseX < 0){neo_mouseX=0;}
if(neo_mouseY < 0){neo_mouseY=0;}  
//document.neo_mouse_tracer.xy.value = neo_mouseX+'x'+neo_mouseY;
return true;
}

/**
 *  Get window inner height and width.
 *  Just dump this line of code into your html
 *  
 *  <script language="javascript">getWindowSize();</script>
 */
var neo_windowInnerWidth=0;
var neo_windowInnerHeight=0;
function getWindowSize() {
if(typeof(window.innerWidth)=='number'){
neo_windowInnerWidth=window.innerWidth;
neo_windowInnerHeight=window.innerHeight;
}
if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
neo_windowInnerWidth=document.documentElement.clientWidth;
neo_windowInnerHeight=document.documentElement.clientHeight;
}
if(document.body && (document.body.clientWidth || document.body.clientHeight)){
neo_windowInnerWidth=document.body.clientWidth;
neo_windowInnerHeight=document.body.clientHeight;
}}

/**
 *   Get the document height and width.
 */
var neo_documentWidth=0;
var neo_documentHeight=0;
function getDocumentSize(){
neo_documentWidth=((document.body.scrollWidth)?document.body.scrollWidth:((document.documenElement.offsetWidth)?document.documenElement.offsetWidth:((document.body.offsetWidth)?document.body.offsetWidth:0)));
neo_documentHeight=((document.body.scrollHeight)?document.body.scrollHeight:((document.documenElement.offsetHeight)?document.documenElement.offsetHeight:((document.body.offsetHeight)?document.body.offsetHeight:0)));
//alert(neo_documentHeight +' - '+neo_windowInnerHeight);
}

/**
 *  layer switch.
 */
var controle = 'none';
var state    = 'none';
var active   = false;
function showPopLayer(showLayer,controleLayer){
if(controle=='none' && state=='none' && active==false){
controle=state='block';
document.getElementById(showLayer).style.display=state;
document.getElementById(controleLayer).style.top=260;
document.getElementById(controleLayer).style.left=((neo_windowInnerWidth/2)-270);
document.getElementById(controleLayer).style.display=controle;
active=showLayer;
window.scrollTo(0,0);
return;
}
if(controle=='block' && state=='block' && active==showLayer){
document.getElementById(showLayer).style.display='none';
document.getElementById(controleLayer).style.top=260;
document.getElementById(controleLayer).style.left=((neo_windowInnerWidth/2)-270);
document.getElementById(controleLayer).style.display='none';
controle=state='none';
active=false;
return;
}
if(controle=='block' && active){
document.getElementById(active).style.display='none';
document.getElementById(showLayer).style.display=state;
active=showLayer;
window.scrollTo(0,0);
return;
}}

/**
 *  tr background color switch.
 */
var neo_bgsave;
function swapBg(elm,act,oncolor){
if(act=='on'){
neo_bgsave=elm.style.backgroundColor;
elm.style.backgroundColor=oncolor;
}else elm.style.backgroundColor=neo_bgsave;
}

/**
 *  print screen popup.
 */
var neo__print_h = 600;
var neo__print_w = 760;
function neo__print(id,sid){
if(id) window.open('/print.php?pid='+id+'&'+sid,'print','height='+neo__print_h+',width='+neo__print_w+',scrollbars=1');
}
function init(){
tmp__login_layer_offsetX = ((xbGetWindowWidth()/2)-350);
tmp__language_layer_offsetX = tmp__login_layer_offsetX;
}
getWindowSize();


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
