<!--
//# (c)2009 Zonums
//# Zonums Windows Design
//# March 15, 2009


//*****************************************************************************
// Do not remove this notice.
//
// Copyright 2001 by Mike Hall.
// See http://www.brainjar.com for terms of use.
//**************************************************************************

function Browser() {

  var ua, s, i;

  this.isIE    = false;
  this.isNS    = false;
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

//$
var browser = new Browser();
// Global object to hold drag information.
var dragObj = new Object();
dragObj.zIndex = 0;
//$

function dragStart(event, id) {

  var el;
  var x, y;

  // If an element id was given, find it. Otherwise use the element being
  // clicked on.

  if (id)
    dragObj.elNode = document.getElementById(id);
  else {
    if (browser.isIE)
      dragObj.elNode = window.event.srcElement;
    if (browser.isNS)
      dragObj.elNode = event.target;

    // If this is a text node, use its parent element.

    if (dragObj.elNode.nodeType == 3)
      dragObj.elNode = dragObj.elNode.parentNode;
  }

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Save starting positions of cursor and element.

  dragObj.cursorStartX = x;
  dragObj.cursorStartY = y;
  dragObj.elStartLeft  = parseInt(dragObj.elNode.style.left, 10);
  dragObj.elStartTop   = parseInt(dragObj.elNode.style.top,  10);

  if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0;
  if (isNaN(dragObj.elStartTop))  dragObj.elStartTop  = 0;

  // Update element's z-index.

  dragObj.elNode.style.zIndex = ++dragObj.zIndex;

  // Capture mousemove and mouseup events on the page.

  if (browser.isIE) {
    document.attachEvent("onmousemove", dragGo);
    document.attachEvent("onmouseup",   dragStop);
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS) {
    document.addEventListener("mousemove", dragGo,   true);
    document.addEventListener("mouseup",   dragStop, true);
    event.preventDefault();
  }
}

function dragGo(event) {

  var x, y;

  // Get cursor position with respect to the page.

  if (browser.isIE) {
    x = window.event.clientX + document.documentElement.scrollLeft
      + document.body.scrollLeft;
    y = window.event.clientY + document.documentElement.scrollTop
      + document.body.scrollTop;
  }
  if (browser.isNS) {
    x = event.clientX + window.scrollX;
    y = event.clientY + window.scrollY;
  }

  // Move drag element by the same amount the cursor has moved.

  dragObj.elNode.style.left = (dragObj.elStartLeft + x - dragObj.cursorStartX) + "px";
  dragObj.elNode.style.top  = (dragObj.elStartTop  + y - dragObj.cursorStartY) + "px";

  if (browser.isIE) {
    window.event.cancelBubble = true;
    window.event.returnValue = false;
  }
  if (browser.isNS)
    event.preventDefault();
}

function dragStop(event) {

  // Stop capturing mousemove and mouseup events.

  if (browser.isIE) {
    document.detachEvent("onmousemove", dragGo);
    document.detachEvent("onmouseup",   dragStop);
  }
  if (browser.isNS) {
    document.removeEventListener("mousemove", dragGo,   true);
    document.removeEventListener("mouseup",   dragStop, true);
  }
}

//******************************//

function MyBrowserScreenSize()
	 {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  this.clientHeight = myHeight;
  this.clientWidth = myWidth;
 }
 
 function My_CenterObj(width,height)
 {
  var info = new MyBrowserScreenSize();
  xleft = ((info.clientWidth - width)/2) + " ";
  xleft = parseInt(xleft);
  ytop =  ((info.clientHeight - height)/2) + " ";
  ytop = parseInt(ytop);
  this.left = xleft;
  this.top = ytop;
 }
 
 
	function MyWinClose(winID)
	 {
	  if (winID === undefined ) {winID="";}
	  if(winID=="") {winID="DefaultWIN";}
	  var obj = document.getElementById(winID);
	  if(obj) {document.body.removeChild(obj);}
	 }
	 
	
	function MyWinResize(winID,left,top,width,height)
	 {
	  var obj = document.getElementById(winID);
    obj.style.position = "absolute";
    obj.style.left = left +"px";
    obj.style.top = top +"px";
    obj.style.width = width +"px";
    if(height>0) {obj.style.height = height + "px";}
	 }
	
	function winresolve_style(winstyle)
	{
	 var windefstyle="-MAC";
	 var winbgColor="";
	 var capColor="";
	 var titleColor="";
   var winbutton="";
   var capimage="";
   var border="";
   var tmpbgColor="";
   
   
	 //if(winbgColor=="") {winbgColor="#EEE";}
   if(winstyle=="") {winstyle=windefstyle;}
   
   //sample "MAC:red";
 
   var windata=winstyle.split(":");
   if (windata.length==2) {
    winstyle=windata[0];
    winbgColor=windata[1];
   } else {
    if(winstyle.charAt(0)=="-") {winstyle=windefstyle;} else 
		{
		 tmpbgColor=winstyle;
		 winstyle=windefstyle;
		}
   }
   
   switch (winstyle) {
    case "-MAC": winbgColor="#F6F6F6"; capColor="#DBD8CA"; titleColor="#000"; winbutton="closewin2.png"; border="1px solid #000; border-top:0px"; capimage="wincaption.png"; break;
    case "-WIN": winbgColor="#F6F6F6"; capColor="#0078AA"; titleColor="#fff"; winbutton="closewin.png"; border="2px solid #0078AA"; capimage=""; break;
    case "-BLUE": winbgColor="#F6F6F6"; capColor="blue"; titleColor="#f0f"; winbutton="btnclose.png"; border="1px solid red"; capimage=""; break;
    case "-LINUX": winbgColor="#F6F6F6"; capColor="#DBD8CA"; titleColor="#fff"; winbutton="closewin2.png"; border="1px solid #000; border-top:0px"; capimage="wincaption.png"; break;
   }
  
	 if(tmpbgColor!="") {winbgColor=tmpbgColor;} 
	
	 this.winbgColor=winbgColor;
	 this.capColor=capColor;
	 this.titleColor=titleColor;
	 this.capimage=capimage;
	 this.winbutton=winbutton;
	 this.border=border;
	}
	
	
	function popMyWinX(winID,Titulo, left,top,width,height,winstyle,cfun)
  {var closefun=winID;
   if(winID=="") {winID="DefaultWIN";}
   var newdiv = document.createElement('div');
   newdiv.id = winID;
   document.body.appendChild(newdiv);
   MyWinResize(winID,left,top,width,height);
   var winstyle=new winresolve_style(winstyle);
   
  
   var xleft=width-20;
   var tmpWidth="";
   var tmpHeight="";
   
	 if(width>0) {tmpWidth="width:"+width+"px;";}
	 if(height>0) {tmpHeight="height:"+height+"px;"; } else {
	   height=Math.abs(height);
	   if(height==0) {height="30";}
	 }
   
   var tmpcad= '<IFRAME NAME="divframe'+winID+'I" STYLE="width:'+width+'px; height:'+height+'px; border:0px" SRC="" FRAMEBORDER="0"></IFRAME>';
   if(tmpHeight=="") {tmpHeight="padding-bottom:5px;";}
   tmpcad+='<div style="position:absolute;left:0px; top:0px;'+tmpWidth+tmpHeight+' background-color:'+winstyle.winbgColor+';border:'+winstyle.border;
	 tmpcad+=';font-family:Arial;font-size:12px;">';
   tmpcad+='<div style="position:relative; height:21px; background-color:'+winstyle.capColor+'; border-bottom:1px solid gray;';
   if(winstyle.capimage.length>0) {tmpcad+='background-image:url(http://www.zonums.com/online/lib/icons/'+winstyle.capimage+');';}
   //variable is used just as temporal variable
   tmpWidth="dragStart(event,'"+winID+"');";
	 tmpcad+='cursor:move;" onmousedown="'+tmpWidth+'">';
   //tmpcad+="cursor:move;\" onmousedown=\"dragStart(event, '"+winID+"')\">";
   
   //tmpcad+='<div class="prop" style="position:absolute; top:2px; height:8x; background-color:#DEDCCF;font-size:3px;"></div>';
   tmpcad+='<div style="position:absolute; top:2px;color:black;padding-left:3px;color:'+winstyle.titleColor+'"><b>'+Titulo+'</b></div>';
   if(cfun!="[]") {
     tmpcad+='<div style="position:absolute;left:'+xleft+'px; top:3px;">';
     if(cfun=="") {
		  closefun="MyWinClose('"+closefun+"')";
			tmpcad+='<a href="javascript:'+closefun+'">';
			}	else{
		   if(cfun.length>2) {tmpcad+='<a href="javascript:'+cfun+'">';}
		 }
	  tmpcad+='<img border="0" src="http://www.zonums.com/online/lib/icons/'+winstyle.winbutton+'" alt="Close"></a></div>';
	 }
   tmpcad+='</div><div id="'+winID+'CNT" style="position:relative;">';
   tmpcad+='</div></div></div>';

   var obj = document.getElementById(winID);
   obj.innerHTML=tmpcad;
   
   return document.getElementById(winID+"CNT");
 }

 function popMyWinCenterX(winID,Titulo,width,height,winstyle,cfun)
  {
    var lefttop=new My_CenterObj(width,height);
    return popMyWinX(winID,Titulo, lefttop.left,lefttop.top,width,height,winstyle,cfun);
  }



 function popMyWin(Titulo, left,top,width,height,winstyle)
  {
   return popMyWinX("",Titulo, left,top,width,height,winstyle,"");
  }


 function popMyWinCenter(Titulo,width,height,winstyle)
  {
    return popMyWinCenterX("",Titulo,width,height,winstyle,"");
  }


 function showMyWin(Titulo, left,top,width,height,winstyle,content)
  {
   var obj=popMyWinX("",Titulo, left,top,width,height,winstyle,"");
   obj.innerHTML=content;
  }

  function showMyWinCenter(Titulo,width,height,winstyle,content,winID)
  {
   if (winID === undefined ) {winID="";}
   var obj=popMyWinCenterX(winID,Titulo,width,height,winstyle,"");
     obj.innerHTML=content;
  }


 function win_frametxt(obj,width,height,url)
  {
    width=width-3;
    height=height-25;
    var cad='<iframe name="zwinframe" id="zwinframe" style="position:absolute; left:1px; top:1px;';
		 cad+='width:'+width+'px;height:'+height+'px;border:0px" frameborder="0" src="'+url+'"></iframe>';
	  obj.innerHTML=cad;
  }

 function showMyWinI(winID,Titulo,left,top,width,height,winstyle,url)
  {
    var obj=popMyWinX(winID,Titulo, left,top,width,height,winstyle,"");
    win_frametxt(obj,width,height,url);
  }

  function showMyWinCenterI(winID,Titulo,left,top,width,height,winstyle,url)
  {
   var obj=popMyWinCenterX(winID,Titulo,width,height,winstyle,"");
   win_frametxt(obj,width,height,url);
  }

  function OpenFileDialogWinClose()
  {
   MyWinClose("OFDLG");
  }

  function OpenFileDialogWin(Titulo,left,top,winstyle,xparams)
  {
   if(xparams.length>0) {xparams="?id="+xparams;}
   if(Titulo=="") {Titulo="Upload File";}
   showMyWinI("OFDLG",Titulo,left,top,430,120,winstyle,"http://www.zonums.com/online/lib/loadxFile.php"+xparams); 
  }
  

 //Menu functions
 
 
 function CreateMenuList(cad)
   {
    var list=cad.split("|");
    var n=list.length;
    var isSeparator=false;
    var option=0;
    cad="";
    for(var i=0; i<n; i++) {
     isSeparator=(list[i]=="--");
		 if(!isSeparator) {
		  option++;
      cad+='<div onmouseout="OptOut(this)" onmouseover="OptOver(this)" onclick="menuclick('+option+')" style="padding-left:5px;';
     if(i<(n-1)) {
      if(list[i+1]=="--") {cad+='border-bottom:1px solid gray'; }
     }
     cad+='">'+list[i]+'</div>';
     }
    }
   
    return cad;
   }
   
 
 
 function myMenuOver(ee,bg,tc)
   {
	  ee.style.background=bg;
	  ee.style.color=tc;
   }
   
   function myMenuOut(ee,bg,tc)
    {
     ee.style.background=bg;
     ee.style.color=tc;
    }  
   
 function CreateMenuListX(cad,menuclick,bg1,bg2,tc1,tc2)
   {
    if(bg1=="") {bg1="#264DF4";}
    if(bg2=="") {bg2="#F6F6F6";}
    if(tc1=="") {tc1="#fff";}
    if(tc2=="") {tc2="#000";}
    var list=cad.split("|");
    var n=list.length;
    var isSeparator=false;
    var option=0;
    cad="";
    for(var i=0; i<n; i++) {
     isSeparator=(list[i]=="--");
		 if(!isSeparator) {
		  option++;
      cad+="<div onmouseout=&quot;myMenuOut(this,'"+bg2+"','"+tc2+"')&quot; ";
			cad+="onmouseover=&quot;myMenuOver(this,'"+bg1+"','"+tc1+"')&quot; ";
			cad+='onclick="'+menuclick+'('+option+')" style="padding-left:5px;';
     if(i<(n-1)) {
      if(list[i+1]=="--") {cad+='border-bottom:1px solid gray'; }
     }
     cad+='">'+list[i]+'</div>';
     }
    }
   
    return cad;
   }  

 function CreateMenuList(cad,menuclick)
 {
  return CreateMenuListX(cad,menuclick,"","","","");
 }

//*****************************
 
 function winComments(id)
 {
  showMyWinCenter("Comments/Suggestions",380,200,"",get_commentsCODE(id));
 }
 
 function winDisclaimer()
  {
  var cadena ='<div style="position:absolute; left:5px; top:1px; width:500px; height:160px;font-family: Arial, Helvetica, sans-serif; font-size: 9pt; overflow:auto; "/>';
  cadena +=get_disclaimerTXT()+'</div>';
  showMyWinCenter("Disclaimer",512,190,"",cadena);  
  }
 
 
-->