
var Zapatec={};Zapatec.Utils={};Zapatec.Utils.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)
SL=el.scrollLeft;if(is_div&&el.scrollTop)
ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}
return r;};Zapatec.Utils.fixBoxPosition=function(box){if(box.x<0)
box.x=0;if(box.y<0)
box.y=0;var cp=Zapatec.Utils.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";window.document.body.appendChild(cp);var br=Zapatec.Utils.getAbsolutePos(cp);window.document.body.removeChild(cp);if(Zapatec.is_ie){br.y+=window.document.body.scrollTop;br.x+=window.document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}
var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};Zapatec.Utils.isRelated=function(el,evt){evt||(evt=window.event);var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}
try{while(related){if(related==el){return true;}
related=related.parentNode;}}catch(e){};return false;};Zapatec.Utils.removeClass=function(el,className){if(!(el&&el.className)){return;}
var cls=el.className.split(" ");var ar=[];for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}
el.className=ar.join(" ");};Zapatec.Utils.addClass=function(el,className){Zapatec.Utils.removeClass(el,className);el.className+=" "+className;};Zapatec.Utils.getElement=function(ev){if(Zapatec.is_ie){return window.event.srcElement;}else{return ev.currentTarget;}};Zapatec.Utils.getTargetElement=function(ev){if(Zapatec.is_ie){return window.event.srcElement;}else{return ev.target;}};Zapatec.Utils.stopEvent=function(ev){ev||(ev=window.event);if(Zapatec.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}
return false;};Zapatec.Utils.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Zapatec.Utils.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Zapatec.Utils.createElement=function(type,parent){var el=null;if(window.self.document.createElementNS)
el=window.self.document.createElementNS("http://www.w3.org/1999/xhtml",type);else
el=window.self.document.createElement(type);if(typeof parent!="undefined")
parent.appendChild(el);if(Zapatec.is_ie)
el.setAttribute("unselectable",true);if(Zapatec.is_gecko)
el.style.setProperty("-moz-user-select","none","");return el;};Zapatec.Utils.writeCookie=function(name,value,domain,path,exp_days){value=escape(value);var ck=name+"="+value,exp;if(domain)
ck+=";domain="+domain;if(path)
ck+=";path="+path;if(exp_days){exp=new Date();exp.setTime(exp_days*86400000+exp.getTime());ck+=";expires="+exp.toGMTString();}
document.cookie=ck;};Zapatec.Utils.getCookie=function(name){var re=new RegExp("(^|;\\s*)"+name+"\\s*=(.*?)(;|$)");if(re.test(document.cookie)){var value=RegExp.$2;value=unescape(value);return(value);}
return null;};Zapatec.Utils.makePref=function(obj){function stringify(val){if(typeof val=="object"&&!val)
return"null";else if(typeof val=="number"||typeof val=="boolean")
return val;else if(typeof val=="string")
return'"'+val.replace(/\22/,"\\22")+'"';else return null;};var txt="",i;for(i in obj)
txt+=(txt?",'":"'")+i+"':"+stringify(obj[i]);return txt;};Zapatec.Utils.loadPref=function(txt){var obj=null;try{eval("obj={"+txt+"}");}catch(e){}
return obj;};Zapatec.Utils.mergeObjects=function(dest,src){for(var i in src)
dest[i]=src[i];};Zapatec.Utils.__wch_id=0;Zapatec.Utils.createWCH=function(element){var f=null;element=element||window.self.document.body;if(Zapatec.is_ie&&!Zapatec.is_ie5){var filter='filter:progid:DXImageTransform.Microsoft.alpha(style=0,opacity=0);';var id="WCH"+(++Zapatec.Utils.__wch_id);element.insertAdjacentHTML
('beforeEnd','<iframe id="'+id+'" scroll="no" frameborder="0" '+'style="z-index:0;position:absolute;visibility:hidden;'+filter+'border:0;top:0;left:0;width:0;height:0;" '+'src="javascript:false;"></iframe>');f=window.self.document.getElementById(id);}
return f;};Zapatec.Utils.setupWCH_el=function(f,el,el2){if(f){var pos=Zapatec.Utils.getAbsolutePos(el),X1=pos.x,Y1=pos.y,X2=X1+el.offsetWidth,Y2=Y1+el.offsetHeight;if(el2){var p2=Zapatec.Utils.getAbsolutePos(el2),XX1=p2.x,YY1=p2.y,XX2=XX1+el2.offsetWidth,YY2=YY1+el2.offsetHeight;if(X1>XX1)
X1=XX1;if(Y1>YY1)
Y1=YY1;if(X2<XX2)
X2=XX2;if(Y2<YY2)
Y2=YY2;}
Zapatec.Utils.setupWCH(f,X1,Y1,X2-X1,Y2-Y1);}};Zapatec.Utils.setupWCH=function(f,x,y,w,h){if(f){var s=f.style;(typeof x!="undefined")&&(s.left=x+"px");(typeof y!="undefined")&&(s.top=y+"px");(typeof w!="undefined")&&(s.width=w+"px");(typeof h!="undefined")&&(s.height=h+"px");s.visibility="inherit";}};Zapatec.Utils.hideWCH=function(f){if(f)
f.style.visibility="hidden";};Zapatec.Utils.getPageScrollY=function(){return window.pageYOffset||document.documentElement.scrollTop||(document.body?document.body.scrollTop:0)||0;};Zapatec.ScrollWithWindow={};Zapatec.ScrollWithWindow.list=[];Zapatec.ScrollWithWindow.stickiness=0.25;Zapatec.ScrollWithWindow.register=function(node){Zapatec.ScrollWithWindow.list[Zapatec.ScrollWithWindow.list.length]={node:node,origTop:parseInt(node.style.top)||0};};Zapatec.ScrollWithWindow.handler=function(newScrollY){oldScrollY+=((newScrollY-oldScrollY)*this.stickiness);if(Math.abs(oldScrollY-newScrollY)<=1)oldScrollY=newScrollY;for(var count=0;count<Zapatec.ScrollWithWindow.list.length;count++){var elm=Zapatec.ScrollWithWindow.list[count];var node=elm.node;if(!(/(absolute|fixed)/).test(node.style.position)){elm.origTop=Zapatec.Utils.getAbsolutePos(node).y;node.style.position='absolute';}
node.style.top=elm.origTop+parseInt(oldScrollY)+'px';}};var oldScrollY=Zapatec.Utils.getPageScrollY();setInterval('var newScrollY = Zapatec.Utils.getPageScrollY(); '+'if (newScrollY != oldScrollY) { '+'Zapatec.ScrollWithWindow.handler(newScrollY); '+'}',50);Zapatec.Utils.destroy=function(el){if(el&&el.parentNode)
el.parentNode.removeChild(el);};Zapatec.Utils.newCenteredWindow=function(url,windowName,width,height,scrollbars){var leftPosition=0;var topPosition=0;if(screen.width)
leftPosition=(screen.width-width)/2;if(screen.height)
topPosition=(screen.height-height)/2;var winArgs='height='+height+',width='+width+',top='+topPosition+',left='+leftPosition+',scrollbars='+scrollbars+',resizable';var win=window.open(url,windowName,winArgs);return win;};Zapatec.Utils.selectOption=function(sel,val,call_default){var a=sel.options,i,o;for(i=a.length;--i>=0;){o=a[i];o.selected=(o.val==val);}
sel.value=val;if(call_default){if(typeof sel.onchange=="function")
sel.onchange();else if(typeof sel.onchange=="string")
eval(sel.onchange);}};Zapatec.Utils.getNextSibling=function(el,tag){el=el.nextSibling;if(!tag)
return el;tag=tag.toLowerCase();while(el&&(el.nodeType!=1||el.tagName.toLowerCase()!=tag))
el=el.nextSibling;return el;};Zapatec.Utils.getFirstChild=function(el,tag){el=el.firstChild;if(!tag)
return el;tag=tag.toLowerCase();if(el.nodeType==1&&el.tagName.toLowerCase()==tag)
return el;return Zapatec.Utils.getNextSibling(el,tag);};Zapatec.Utils._ids={};Zapatec.Utils.generateID=function(code,id){if(typeof id=="undefined"){if(typeof this._ids[code]=="undefined")
this._ids[code]=0;id=++this._ids[code];}
return"zapatec-"+code+"-"+id;};Zapatec.Utils.addTooltip=function(target,tooltip){return new Zapatec.Tooltip(target,tooltip);};Zapatec.Utils.checkActivation=function(){if(!Zapatec.isLite)return true;var bWizard=false;var arrProducts=[];var ii;var scripts=document.getElementsByTagName('script');for(ii=0;ii<scripts.length;ii++)
{if(/src\/calendar.js/i.test(scripts[ii].src))
arrProducts["calendar"]=true
else
if(/src\/menu.js/i.test(scripts[ii].src))
arrProducts["menu"]=true
else
if(/src\/tree.js/i.test(scripts[ii].src))
arrProducts["tree"]=true
if(/wizard.js/i.test(scripts[ii].src))
bWizard=true}
var bProduct=false;for(ii in arrProducts)
if(arrProducts[ii])
{bProduct=true
break}
if(!bProduct)return true;if(bWizard)return true;var anchors=document.getElementsByTagName('A');for(ii=0;ii<anchors.length;ii++)
if(/(dev|www)\.zapatec\.com/i.test(anchors[ii].href))
return true;var strMsg="";strMsg='You are using the Free version of the Zapatec Software.\n'+'While using the Free version, a link to www.zapatec.com in this page is required.'
if(arrProducts["calendar"])
strMsg+='\nTo purchase the Zapatec Calendar visit www.zapatec.com/website/main/products/prod1/.'
if(arrProducts["menu"])
strMsg+='\nTo purchase the Zapatec Menu visit www.zapatec.com/website/main/products/prod2/.'
if(arrProducts["tree"])
strMsg+='\nTo purchase the Zapatec Tree visit www.zapatec.com/website/main/products/prod3/.'
alert(strMsg)
return false;}
Zapatec.is_opera=/opera/i.test(navigator.userAgent);Zapatec.is_ie=(/msie/i.test(navigator.userAgent)&&!Zapatec.is_opera);Zapatec.is_ie5=(Zapatec.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Zapatec.is_mac_ie=(/msie.*mac/i.test(navigator.userAgent)&&!Zapatec.is_opera);Zapatec.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Zapatec.is_konqueror=/Konqueror/i.test(navigator.userAgent);Zapatec.is_gecko=/Gecko/i.test(navigator.userAgent);Zapatec.isLite=true;





function setStyle(objName, property, val) {
   isNS4 = (document.layers) ? 1 : 0; 
   isIE = (document.all) ? 1 : 0;
   isW3C = (document.getElementById && !document.all) ? 1 : 0;

   if (isIE) {
         var layer = document.all[objName];
       layer.style[property] = val;
         return;
   }
   if (isW3C) {
         var obj = document.getElementById( objName );
       if (obj != null) {
           var s = obj.style;
           s[ property ] = val;
              return;
         }
          return;
   }
   if (isNav4) {
         document[objName][property] = val;
         return;
   }
}

function getSpecifiedProperty(objName, property) {
    isNS4 = (document.layers) ? 1 : 0; 
    isIE = (document.all) ? 1 : 0;
    isW3C = (document.getElementById && !document.all) ? 1 : 0;

    
		if (isIE) {
         str = eval("document.all."+objName+".currentStyle."+property);
         return str;
    }
}

function getCalculatedProperty(objName, property) {
    // thanks to Ian Grant, http://www.faqts.com/knowledge_base/view.phtml/aid/7157
    isNS4 = (document.layers) ? 1 : 0; 
		isIE = (document.all) ? 1 : 0;
		isW3C = (document.getElementById && !document.all) ? 1 : 0;

    
		if (isW3C) {
       docObj = document.getElementById(objName);
         
       if (property == "visibility") { 
              cssp = docObj.style.visibility;
              return (cssp == "") ? "inherit" : cssp;
         }

         if (property == "clip") {
             cssp = docObj.style.clip;

                if (cssp == "") {
                   cssStr = "rect(0px "; 
                    cssStr += getCalculatedProperty(objName, "width") + " ";
                   cssStr += getCalculatedProperty(objName, "height") + " ";
                   cssStr += "0px)";
                   return cssStr;
             }
             return cssp;
         }

         if (property == "zIndex") {
             cssp = docObj.style.zIndex;
             return (cssp == "") ? "inherit" : cssp;
         }

         cssp = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(property);

         return (cssp == "") ? "unknown" : cssp;
   }

   // ***** Netscape Navigator 4+ DOM *****

   if (isNS4) {
         docObj = document.layers[objName];

         if (property == "visibility") {
             cssp = docObj.visibility;
             return (cssp == "hide") ? "hidden" : (cssp == "show") ? "visible" : "inherit";
         }
         if (property == "clip") {
                 cssStr = "rect(" + docObj.clip.top + "px ";
             cssStr += docObj.clip.right + "px ";
             cssStr += docObj.clip.bottom + "px ";
             cssStr += docObj.clip.left + "px)";
             return cssStr;
         }
         if ((property == "width") || (property == "height")) {
                  return eval("docObj.clip." + property) + "px";
         }
         if (property == "top") property = "pageY";
         if (property == "left") property = "pageX";
         
         cssp = eval("docObj." + property);
         if (property != "zIndex") cssp += "px";
         return cssp;
   }

   // ***** Internet Explorer 4+ DOM *****

   if (isIE) {
         if (property == "width") return eval(objName + ".offsetWidth") + "px";
         if (property == "height") return eval(objName + ".offsetHeight") + "px";
         if (property == "top") return eval(objName + ".offsetTop") + 'px';
         if (property == "left") return eval(objName + ".offsetLeft") + 'px';
         if (property == "clip") {
               cssp = eval(objName + ".style.clip");
             if (cssp == "") {
                   cssStr = "rect(0px ";
                   cssStr += getCalculatedProperty(objName, "width") + " ";
                   cssStr += getCalculatedProperty(objName, "height") + " ";
                   cssStr += "0px)";
                   return cssStr;
             }
             return cssp;
         }
         return eval(objName + ".currentStyle." + property);
   }
}


function pxval(valAsStr) {
    if (valAsStr && (i = valAsStr.indexOf("px")) != -1) { 
          val = parseInt(valAsStr.substring(0,i)); 
     }
    else { 
          val = 0; 
          //alert("problem parsing valAsStr:"+valAsStr);
    }
    return val;
}

function InitBrowser() {
  if (screen.height <= 600) {window.resizeTo(787,550); }
else
  	window.resizeTo(900,740);  
}		
function writit(text,id) {
    if (document.getElementById)
  {
      x = document.getElementById(id);
    x.innerHTML = '';
    x.innerHTML = text;
  }
  else if (document.all)
  {
    x = document.all[id];
    x.innerHTML = text;
  }
  else if (document.layers)
  {
    x = document.layers[id];
    text2 = '<P CLASS="testclass">' + text + '</P>';
    x.document.open();
  	x.document.write(text2);
  	x.document.close();
  }
}	

function adapt() 
{ 
    th = $("#top").innerHeight();    

    ah = $("#admin").innerHeight();
    menuh = $("#menu").innerHeight();
    ch = $("#content").innerHeight();
	cmsh = $("#cms").innerHeight();
    ph = $("#pagination").innerHeight();
    pthh = $("#pathID").innerHeight();
    
    cfh = $("#content_fixed").innerHeight();
    gh = $("#gallery").innerHeight();
    ch = ch == 0 ? cfh : ch;
    lh = $("#left").innerHeight();
    mh = $("#middle").innerHeight();
    /*lh=0;
    mh=0;
    if (ch == 0 && gh == 0)
    {
      lh = $("#left").innerHeight();
      mh = $("#middle").innerHeight();

    }
    */
    gh = gh + 60;
    
    ch = ch+ph+pthh+cmsh+60;
    //newHeight = Math.max(pxval(ah)+pxval(menuh), pxval(mh),pxval(ch));
    newHeight = Math.max(ah+menuh, mh,ch, gh,lh);
    
    str = "gh : " + gh  +"th: " + th + "\n lh: " + lh + "\n mh: " +mh +"\n ch: " +ch + "\n newHeight: " + newHeight + "\n";
   // alert(str); 

    if (newHeight < 800)  {
      newHeight = 800;  
    }            
    
    isIE = (document.all) ? 1 : 0;
    
    if  (isIE) {
      newHeight -=10;  // IE do not handle padding correctly
    }
    
    if (lh < newHeight)
       $("#left").height(newHeight);
    if (mh < newHeight)
      $("#middle").height(newHeight);
      
      
     $("#allsite").height(newHeight+95);
     $("#middle").height(newHeight); 
      $("#footer").css({'top' : (newHeight+80)+"px"});

    //setStyle("allsite", "height", (newHeight+95)+"px");
    //setStyle("middle", "height", newHeight+"px");
    //setStyle("left", "height", newHeight+"px");
    //setStyle("footer", "top", (newHeight+80)+"px");
  
}

function adapt1() 
{
  if(!document.getElementById || !document.createTextNode){return;}
  { 
    th = getCalculatedProperty("top", "height");
    // IE seems reluctant to provide specifically
    // specified style values this way so we will ask in
    // another way...
    if (th.indexOf("undefined")!=-1)
    {
    th = getSpecifiedProperty("top", "height");
    }
    
    lh = getCalculatedProperty("left", "height");
    if (lh.indexOf("undefined")!=-1)
    {
    lh = getSpecifiedProperty("left", "height");
    }
    mh = getCalculatedProperty("middle", "height");
    if (mh.indexOf("undefined")!=-1)
    {
    mh = getSpecifiedProperty("middle", "height");
    }
    ah = getCalculatedProperty("admin", "height");
    if (lh.indexOf("undefined")!=-1)
    {
    ah = getSpecifiedProperty("admin", "height");
    }
    menuh = getCalculatedProperty("menu", "height");
    if (lh.indexOf("undefined")!=-1)
    {
    menuh = getSpecifiedProperty("menu", "height");
    }

    newHeight = Math.max(pxval(ah)+pxval(menuh), pxval(mh));
    
    str = "th: " + th + "\n lh: " + lh + "\n mh: " +mh + "\n newHeight: " + newHeight + "\n";
    //str = str + "ch: " + ch + "\n menuh: " + menuh + "\n ah: " +ah + "\n";
    //alert(str); 

    if (newHeight < 600)  {
      newHeight = 600;  
    }            
    
    isIE = (document.all) ? 1 : 0;
    
    if  (isIE) {
      newHeight -=10;  // IE do not handle padding correctly
    }
    
    if (pxval(lh) < newHeight)
      setStyle("left", "height", newHeight+"px");
    if (pxval(mh) < newHeight)
      setStyle("middle", "height", newHeight+"px");
      
    setStyle("allsite", "height", (newHeight+95)+"px");
    setStyle("footer", "top", (newHeight+80)+"px");
  }
}

function pageWidth() 
   {
     isNS4 = (document.layers) ? 1 : 0; 
     isIE = (document.all) ? 1 : 0;
     isW3C = (document.getElementById && !document.all) ? 1 : 0;
  
     if (isIE) 
     {
        return document.documentElement.clientWidth;
     }
     else
     {
       return window.innerWidth != null? window.innerWidth: document.body != null? document.body.clientWidth:null;
     }     
   }
   function pageHeight() 
   {
     isNS4 = (document.layers) ? 1 : 0; 
     isIE = (document.all) ? 1 : 0;
     isW3C = (document.getElementById && !document.all) ? 1 : 0;
  
     if (isIE) 
     {
        return document.documentElement.clientHeight;
     }
     else
     {
       return window.innerHeight != null? window.innerHeight: document.body != null? document.body.clientHeight:null;
     }  
   }  
   
   function writeCookie() 
   {
      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;
      }
   
    var exp_seconds = 1500;
		var exp = new Date();
		exp.setTime(exp_seconds * 1000 + exp.getTime());
    document.cookie = "screenresolution="+ myWidth +"x"+ myHeight + ";expires=" + exp.toGMTString();	
    
    //window.location.replace("");
   }    



Zapatec.MenuTree=function(el,config,noInit){if(typeof config=="undefined")
config={};this._el=el;this._config=config;if(!noInit)this.initTree();}
Zapatec.MenuTree.prototype.initTree=function(){var el=this._el;var config=this._config;function param_default(name,value){if(typeof config[name]=="undefined")config[name]=value;};param_default('d_profile',false);param_default('hiliteSelectedNode',true);param_default('compact',false);param_default('dynamic',false);param_default('initLevel',false);if(config.dynamic)
config.initLevel=0;this.config=config;if(this.config.d_profile){var T1=new Date().getTime();profile={items:0,trees:0,icons:0};}
if(typeof el=="string")
el=document.getElementById(el);this.list=el;this.items={};this.trees={};this.selectedItem=null;this.id=null;if(el)
this.id=el.id||Zapatec.Utils.generateID("tree");else
alert("Can not find Menu id=\""+this._el+"\"")
var top=this.top_parent=Zapatec.Utils.createElement("div");top.__zp_menu=Zapatec.Utils.createElement("div",top);top.__zp_menu.className='zpMenu';top.className="zpMenuContainer zpMenu-top";if(this.config.vertical)
Zapatec.Utils.addClass(top,"zpMenu-vertical-mode");else
Zapatec.Utils.addClass(top,"zpMenu-horizontal-mode");this.createTree(el,top,0);if(el){el.parentNode.insertBefore(top,el);el.parentNode.removeChild(el);}
Zapatec.MenuTree.all[this.id]=this;if(this.selectedItem)
this.sync(this.selectedItem.__zp_item);if(this.config.d_profile){alert("Generated in "+(new Date().getTime()-T1)+" milliseconds\n"+
profile.items+" total tree items\n"+
profile.trees+" total (sub)trees\n"+
profile.icons+" total icons");}
if(window.opera&&!top.__zp_menu.style.width){var menu=top.__zp_menu;var width=0;if(menu.childNodes){for(var i=0;i<menu.childNodes.length;i++){var child=menu.childNodes[i];if(this.config.vertical){if(child.offsetWidth>width){width=child.offsetWidth;}}else{width+=child.offsetWidth;}}}
if(width>0){menu.style.height=menu.childNodes[0].offsetHeight+'px'
width+=menu.offsetWidth-menu.clientWidth;if(menu.offsetWidth>width){menu.style.width=menu.offsetWidth+'px';}else{menu.style.width=width+'px';}}}};Zapatec.MenuTree.all={};Zapatec.MenuTree.prototype.createTree=function(list,parent,level){if(this.config.d_profile)
++profile.trees;var id;var intItem=1,bFirst=true;if(list)id=list.id;if(!id)id=Zapatec.Utils.generateID("tree.sub");var
self=this;function _makeIt(){self.creating_now=true;var
last_li=null,next_li,i=(list?list.firstChild:null),items=parent.__zp_items=[];self.trees[id]=parent;parent.__zp_level=level;parent.__zp_treeid=id;while(i){if(last_li)
last_li.className+=" zpMenu-lines-c";if(i.nodeType!=1)
i=i.nextSibling;else{next_li=Zapatec.Utils.getNextSibling(i,'li');if(i.tagName.toLowerCase()=='li'){last_li=self.createItem(i,parent,next_li,level,intItem++);if(last_li){if(bFirst)
{bFirst=false;Zapatec.Utils.addClass(last_li,"zpMenu-item-first");}
items[items.length]=last_li.__zp_item;}}
i=next_li;}}
if(last_li)Zapatec.Utils.addClass(last_li,"zpMenu-item-last");i=parent.firstChild;if(i&&!level){i.className=i.className.replace(/ zpMenu-lines-./g,"");i.className+=(i===last_li)?" zpMenu-lines-s":" zpMenu-lines-t";}
if(last_li&&(level||last_li!=i)){last_li.className=last_li.className.replace(/ zpMenu-lines-./g,"");last_li.className+=" zpMenu-lines-b";}
self.creating_now=false;};if(this.config.dynamic&&level>0)
this.trees[id]=_makeIt;else
_makeIt();return id;};Zapatec.MenuTree.prototype.createItem=function(li,parent,next_li,level,intItem){if(this.config.d_profile)
++profile.items;if(!li.firstChild)
return;var
id=li.id||Zapatec.Utils.generateID("tree.item"),item=this.items[id]=Zapatec.Utils.createElement("div",parent.__zp_menu),t=Zapatec.Utils.createElement("table",item),tb=Zapatec.Utils.createElement("tbody",t),tr=Zapatec.Utils.createElement("tr",tb),td=Zapatec.Utils.createElement("td",tr),is_list,tmp,i=li.firstChild,has_icon=false;t.className="zpMenu-table";t.cellSpacing=0;t.cellPadding=0;td.className="zpMenu-label"
if(li.getAttribute('title')){td.setAttribute('title',li.getAttribute('title'));}
item.className="zpMenu-item"+(li.className?' '+li.className:'');Zapatec.Utils.addClass(item,"zpMenu-level-"+(level+1));item.__zp_item=id;item.__zp_tree=this.id;item.__zp_parent=parent.__zp_treeid;item.onmouseover=Zapatec.Menu.onItemMouseOver;item.onmouseout=Zapatec.Menu.onItemMouseOut;item.onclick=Zapatec.Menu.onItemClick;Zapatec.Utils.addClass(item,"zpMenu-item-"+(intItem%2==1?"odd":"even"));while(i){is_list=i.nodeType==1&&/^[ou]l$/i.test(i.tagName);if(i.nodeType!=1||!is_list){if(i.nodeType==3){tmp=i.data.replace(/^\s+/,'');tmp=tmp.replace(/\s+$/,'');li.removeChild(i);if(tmp){i=Zapatec.Utils.createElement("span");i.innerHTML=tmp;td.appendChild(i);}}else if(i.tagName.toLowerCase()=='img'){this.item_addIcon(item,i);has_icon=true;}else{if((this._menuMode)&&(i.tagName.toLowerCase()=='hr')){Zapatec.Utils.addClass(item,"zpMenu-item-hr");}
td.appendChild(i);}
i=li.firstChild;continue;}
if(window.opera){td.style.whiteSpace='nowrap';}
if(is_list){this.item_addIcon(item,null);var np=Zapatec.Utils.createElement("div",parent);np.__zp_item=id;np.__zp_menu=Zapatec.Utils.createElement("div",np);np.__zp_menu.className='zpMenu'+(i.className?' '+i.className:'');np.className='zpMenuContainer';np.__zp_menu.onmouseover=Zapatec.Menu.onItemMouseOver;np.__zp_menu.onmouseout=Zapatec.Menu.onItemMouseOut;if(next_li)
np.__zp_menu.className+=" zpMenu-lined";item.__zp_subtree=this.createTree(i,np,level+1);if((this.config.initLevel!=false&&this.config.initLevel<=level)||(this.config.compact&&!/(^|\s)expanded(\s|$)/i.test(li.className))||/(^|\s)collapsed(\s|$)/i.test(li.className)){item.className+=" zpMenu-item-collapsed";this.toggleItem(id);}else
item.className+=" zpMenu-item-expanded";if(/(^|\s)selected(\s|$)/i.test(li.className))
this.selectedItem=item;break;}}
if(!has_icon&&!/zpMenu-item-hr/i.test(item.className))
if(this.config.defaultIcons)
this.item_addDefaultIcon(item,this.config.defaultIcons);else
this.item_addDefaultIcon(item,"zpMenu-noicon");return item;};Zapatec.MenuTree.prototype.item_addDefaultIcon=function(item,className){if(!className)
return;var last_td=item.firstChild.firstChild.firstChild.lastChild,td;var td=Zapatec.Utils.createElement("td");td.className="tgb icon "+className;last_td.parentNode.insertBefore(td,last_td);};Zapatec.MenuTree.prototype.item_addIcon=function(item,img){if(this.config.d_profile)
++profile.icons;var last_td=item.firstChild.firstChild.firstChild,td;last_td=img?last_td.lastChild:last_td.firstChild;if(!img||!item.__zp_icon){td=Zapatec.Utils.createElement("td");td.className="tgb "+(img?"icon":"minus");last_td.parentNode.insertBefore(td,last_td);}else{td=item.__zp_icon;img.style.display="none";}
if(!img){td.innerHTML="&nbsp;";item.className+=" zpMenu-item-more";item.__zp_state=true;item.__zp_expand=td;}else{td.appendChild(img);item.__zp_icon=td;}};Zapatec.MenuTree.prototype.itemClicked=function(item_id){this.selectedItem=this.toggleItem(item_id);if(this.config.hiliteSelectedNode&&this.selectedItem)
Zapatec.Utils.addClass(this.selectedItem,"zpMenu-item-selected");this.onItemSelect(item_id);};Zapatec.MenuTree.prototype.toggleItem=function(item_id,state){if(item_id){if(this.config.hiliteSelectedNode&&this.selectedItem)
Zapatec.Utils.removeClass(this.selectedItem,"zpMenu-item-selected");var item=this.items[item_id];if(typeof state=="undefined")
state=!item.__zp_state;if(state!=item.__zp_state){var subtree=this._getTree(item.__zp_subtree,this.creating_now);if(subtree){this.treeSetDisplay(subtree,state);Zapatec.Utils.removeClass(item,"zpMenu-item-expanded");Zapatec.Utils.removeClass(item,"zpMenu-item-collapsed");Zapatec.Utils.addClass(item,state?"zpMenu-item-expanded":"zpMenu-item-collapsed");}
var img=item.__zp_expand;if(img)
img.className="tgb "+(state?"minus":"plus");item.__zp_state=state;img=item.__zp_icon;if(img){img.firstChild.style.display="none";img.appendChild(img.firstChild);img.firstChild.style.display="block";}
if(this.config.compact&&state){var hideItems=this._getTree(item.__zp_parent).__zp_items;for(var i=hideItems.length;--i>=0;){if(hideItems[i]!=item_id&&hideItems[i].__zp_state){this.toggleItem(hideItems[i],false);if(hideItems[i].__zp_subtree){var subtree=this._getTree(hideItems[i].__zp_subtree);this.toggleItem(subtree.firstChild,false);}}}}}
return item;}
return null;};Zapatec.MenuTree.prototype.collapseAll=function(){for(var i in this.trees)
this.toggleItem(this._getTree(i).__zp_item,false);};Zapatec.MenuTree.prototype.expandAll=function(){for(var i in this.trees)
this.toggleItem(this._getTree(i).__zp_item,true);};Zapatec.MenuTree.prototype.toggleAll=function(){for(var i in this.trees)
this.toggleItem(this._getTree(i).__zp_item);};Zapatec.MenuTree.prototype.sync=function(item_id){var item=this.items[item_id];if(item){this.collapseAll();this.selectedItem=item;var a=[];while(item.__zp_parent){a[a.length]=item;var pt=this._getTree(item.__zp_parent);if(pt.__zp_item)
item=this.items[pt.__zp_item];else
break;}
for(var i=a.length;--i>=0;)
this.toggleItem(a[i].__zp_item,true);Zapatec.Utils.addClass(this.selectedItem,"zpMenu-item-selected");}};Zapatec.MenuTree.prototype.destroy=function(){var p=this.top_parent;p.parentNode.removeChild(p);};Zapatec.MenuTree.prototype._getTree=function(tree_id,dont_call){var tree=this.trees[tree_id];if(typeof tree=="function"){if(dont_call)
tree=null;else{tree();tree=this.trees[tree_id];}}
return tree;};Zapatec.MenuTree.prototype.onItemSelect=function(){};Zapatec.MenuTree.onItemToggle=function(){var item=this;var body=document.body;while(item&&item!=body&&!/zpMenu-item/.test(item.className))
item=item.parentNode;Zapatec.MenuTree.all[item.__zp_tree].itemClicked(item.__zp_item);};Zapatec.Menu=function(el,config_user){if(arguments.length>0){this.init(el,config_user);}};Zapatec.Menu.prototype=new Zapatec.MenuTree('',null,true);Zapatec.Menu.prototype.init=function(el,config_user){this._el=el;this._config={};this.setOption(this._config,'showDelay',0);this.setOption(this._config,'hideDelay',500);this.setOption(this._config,'onClick',false);this.setOption(this._config,'vertical',false);this.setOption(this._config,'scrollWithWindow',false);this.setOption(this._config,'dropShadow',0);this.setOption(this._config,'drag',false);this.setOption(this._config,'slide',false);this.setOption(this._config,'glide',false);this.setOption(this._config,'fade',false);this.setOption(this._config,'wipe',false);this.setOption(this._config,'unfurl',false);this.setOption(this._config,'animSpeed',10);this.setOption(this._config,'compact',true);this.setOption(this._config,'initLevel',0);this.setOption(this._config,'defaultIcons',null);if(typeof config_user!="undefined")
for(var i in config_user){if(typeof this._config[i]=="undefined"){alert("Error:Menu "+this._el+" has invalid parameter --"+i+":"+config_user[i]);}else{this.setOption(this._config,i,config_user[i]);}}
this.animations=[];this._menuMode=true;this.initTree();this.openMenus=[];this.clickDone=false;if(this.config.scrollWithWindow){Zapatec.ScrollWithWindow.register(this.trees[this._el]);}
if(this.config.drag){var self=this;self.dragging=false;Zapatec.Utils.addEvent(window.document,"mousedown",function(ev){return Zapatec.Menu.dragStart(ev,self)});Zapatec.Utils.addEvent(window.document,"mousemove",function(ev){return Zapatec.Menu.dragMove(ev,self)});Zapatec.Utils.addEvent(window.document,"mouseup",function(ev){return Zapatec.Menu.dragEnd(ev,self)});}
if(this._config.fade)
this.addAnimation('fade');if(this._config.slide)
this.addAnimation('slide');else if(this._config.glide)
this.addAnimation('glide');else if(this._config.wipe)
this.addAnimation('wipe');else if(this._config.unfurl)
this.addAnimation('unfurl');};Zapatec.Menu.MOUSEOUT=0;Zapatec.Menu.MOUSEOVER=1;Zapatec.Menu.CLICK=2;Zapatec.Menu.prototype.setOption=function(config,name,val){config[name]=val;};Zapatec.Menu.animations={};Zapatec.Menu.animations.fade=function(ref,counter){var f=ref.filters,done=(counter==100);if(f){if(!done&&ref.style.filter.indexOf("alpha")==-1){ref.style.filter+=' alpha(opacity='+counter+')';}
else if(f.length&&f.alpha)with(f.alpha){if(done)enabled=false;else{opacity=counter;enabled=true}}}
else{ref.style.opacity=ref.style.MozOpacity=counter/100.1;}};Zapatec.Menu.animations.slide=function(ref,counter){var cP=Math.pow(Math.sin(Math.PI*counter/200),0.75);var noClip=((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto, auto, auto, auto)');if(typeof ref.__zp_origmargintop=='undefined'){ref.__zp_origmargintop=ref.style.marginTop;}
ref.style.marginTop=(counter==100)?ref.__zp_origmargintop:'-'+(ref.offsetHeight*(1-cP))+'px';ref.style.clip=(counter==100)?noClip:'rect('+(ref.offsetHeight*(1-cP))+', '+ref.offsetWidth+'px, '+ref.offsetHeight+'px, 0)';};Zapatec.Menu.animations.glide=function(ref,counter){var cP=Math.pow(Math.sin(Math.PI*counter/200),0.75);var noClip=((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto, auto, auto, auto)');ref.style.clip=(counter==100)?noClip:'rect(0, '+ref.offsetWidth+'px, '+(ref.offsetHeight*cP)+'px, 0)';};Zapatec.Menu.animations.wipe=function(ref,counter){var noClip=((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto, auto, auto, auto)');ref.style.clip=(counter==100)?noClip:'rect(0, '+(ref.offsetWidth*(counter/100))+'px, '+
(ref.offsetHeight*(counter/100))+'px, 0)';};Zapatec.Menu.animations.unfurl=function(ref,counter){var noClip=((window.opera||navigator.userAgent.indexOf('KHTML')>-1)?'':'rect(auto, auto, auto, auto)');if(counter<=50){ref.style.clip='rect(0, '+(ref.offsetWidth*(counter/50))+'px, 10px, 0)';}
else if(counter<100){ref.style.clip='rect(0, '+ref.offsetWidth+'px, '+
(ref.offsetHeight*((counter-50)/50))+'px, 0)';}
else{ref.style.clip=noClip;}};Zapatec.Menu.prototype.addAnimation=function(animation){this.animations[this.animations.length]=Zapatec.Menu.animations[animation];};Zapatec.Menu.prototype.treeSetDisplay=function(menu,show){if(!menu.__zp_initialised){menu.style.visibility='hidden';menu.__zp_initialised=true;return;}
menu.__zp_anim_timer|=0;menu.__zp_anim_counter|=0;var tree,t_id=menu.__zp_tree||menu.__zp_menu.firstChild.__zp_tree;if(t_id)tree=Zapatec.MenuTree.all[t_id];if(!tree)return;clearTimeout(menu.__zp_anim_timer);if(show&&!menu.__zp_anim_counter)menu.style.visibility='inherit';var speed=!tree.animations.length?100:tree.config.animSpeed;if(speed<100){for(var a=0;a<tree.animations.length;a++){tree.animations[a](menu,menu.__zp_anim_counter);}}
menu.__zp_anim_counter+=speed*(show?1:-1);if(menu.__zp_anim_counter>100){menu.__zp_anim_counter=100;}
else if(menu.__zp_anim_counter<=0){menu.__zp_anim_counter=0;menu.style.visibility='hidden';}
else{menu.__zp_anim_timer=setTimeout(function(){tree.treeSetDisplay(menu,show);},50);}};Zapatec.Menu.onItemMouseOver=function(){var item=this,tree=null,body=document.body;while(item&&item!=body){var t_id=item.__zp_tree||item.firstChild.__zp_tree;if(t_id)tree=Zapatec.MenuTree.all[t_id];if(/zpMenu-item/.test(item.className)&&!/zpMenu-item-hr/.test(item.className)){tree.itemMouseHandler(item.__zp_item,Zapatec.Menu.MOUSEOVER);}
item=tree&&item.__zp_treeid?tree.items[item.__zp_item]:item.parentNode;}};Zapatec.Menu.onItemMouseOut=function(){var item=this,tree=null,body=document.body;while(item&&item!=body){var t_id=item.__zp_tree||item.firstChild.__zp_tree;if(t_id)tree=Zapatec.MenuTree.all[t_id];if(/zpMenu-item/.test(item.className)&&!/zpMenu-item-hr/.test(item.className)){tree.itemMouseHandler(item.__zp_item,Zapatec.Menu.MOUSEOUT);}
item=tree&&item.__zp_treeid?tree.items[item.__zp_item]:item.parentNode;}};Zapatec.Menu.onItemClick=function(e){var item=this,tree=null;body=document.body;while(item&&item!=body){if(item.nodeName&&item.nodeName.toLowerCase()=='a'){return true;}
if(/zpMenu-item/.test(item.className)){tree=Zapatec.MenuTree.all[item.__zp_tree];if(tree.config.onClick&&item.__zp_subtree&&(/zpMenu-top/.test(tree.trees[item.__zp_parent].className))){tree.itemMouseHandler(item.__zp_item,Zapatec.Menu.CLICK);e=e||window.event||{};if(e.preventDefault)e.preventDefault();e.returnValue=false;return false;}
var itemLink=item.getElementsByTagName('a');if(!itemLink||!itemLink.item(0))return;var href=itemLink.item(0).getAttribute('href');if(!(/javascript:/).test(href)){window.location.href=href;return;}}
item=item.parentNode;}};Zapatec.Menu.prototype.itemMouseHandler=function(item_id,type){var item=this.items[item_id];if(!item)return;var menu=this._getTree(item.__zp_parent);if(menu&&menu.__zp_activeitem!=item_id){if(menu.__zp_activeitem){var lastItem=this.items[menu.__zp_activeitem];Zapatec.Utils.removeClass(lastItem,"zpMenu-item-selected");if(lastItem.__zp_state)this.toggleItem(lastItem.__zp_item,false);}
menu.__zp_activeitem=item_id;Zapatec.Utils.addClass(item,"zpMenu-item-selected");}
clearTimeout(item.__zp_dimtimer);if(type==Zapatec.Menu.MOUSEOUT){item.__zp_dimtimer=setTimeout(function(){Zapatec.Utils.removeClass(item,"zpMenu-item-selected");if(menu.__zp_activeitem==item_id)menu.__zp_activeitem='';},this.config.hideDelay);}
clearTimeout(item.__zp_mousetimer);if(this.config.onClick&&!this.clickDone){if(/zpMenu-top/.test(this.trees[item.__zp_parent].className)&&(type==Zapatec.Menu.MOUSEOVER))return;if(type==Zapatec.Menu.CLICK)this.clickDone=true;}
if(!item.__zp_state&&type)
{item.__zp_mousetimer=setTimeout('Zapatec.MenuTree.all["'+
item.__zp_tree+'"].itemShow("'+item.__zp_item+'")',(this.config.showDelay||1));}
else if(item.__zp_state&&!type)
{item.__zp_mousetimer=setTimeout('Zapatec.MenuTree.all["'+
item.__zp_tree+'"].itemHide("'+item.__zp_item+'")',(this.config.hideDelay||1));}};Zapatec.Menu.prototype.itemShow=function(item_id){var item=this.items[item_id];var subMenu=this._getTree(item.__zp_subtree);var parMenu=this._getTree(item.__zp_parent);if(subMenu){if(!subMenu.offsetHeight){subMenu.style.left='-9999px';subMenu.style.visibility='visible';}
var newLeft=0,newTop=0;if((/zpMenu-top/.test(this.trees[item.__zp_parent].className))&&(!(this.config.vertical))){newLeft=item.offsetLeft;newTop=item.offsetHeight;}
else{newLeft=item.offsetWidth;newTop=item.offsetTop;var scrollX=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft||0;var scrollY=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0;var winW=window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth||0;var winH=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight||0;var menuPos=Zapatec.Utils.getAbsolutePos(parMenu);if(menuPos.x+newLeft+subMenu.offsetWidth>scrollX+winW){newLeft=(0-subMenu.offsetWidth);}
if(menuPos.y+newTop+subMenu.offsetHeight>scrollY+winH){newTop-=subMenu.offsetHeight;}
if(menuPos.x+newLeft<0){newLeft=0-menuPos.x;}
if(menuPos.y+newTop<0){newTop=0-menuPos.y;}}
if(!this._config.dropShadow||(this._config.dropShadow&&!subMenu.__zp_dropshadow)){var fc=subMenu.firstChild;subMenu.style.width=(fc.offsetWidth+subMenu.offsetWidth-subMenu.clientWidth)+'px';if(fc.offsetWidth!=subMenu.clientWidth){subMenu.style.width=fc.offsetWidth+'px';}
subMenu.style.height=(fc.offsetHeight+subMenu.offsetHeight-subMenu.clientHeight)+'px';if(fc.offsetHeight!=subMenu.clientHeight){subMenu.style.height=fc.offsetHeight+'px';}
fc.style.position='absolute';fc.style.left=0;fc.style.top=0;fc.style.visibility='inherit';}
if(this._config.dropShadow&&!subMenu.__zp_dropshadow){var ds=subMenu.__zp_dropshadow=Zapatec.Utils.createElement('div');subMenu.insertBefore(ds,subMenu.firstChild);ds.style.position='absolute';ds.style.left='5px';ds.style.top='5px';ds.style.width=subMenu.offsetWidth+'px';ds.style.height=subMenu.offsetHeight+'px';ds.style.visibility='inherit';ds.style.backgroundColor='#000';if(window.opera){ds.style.backgroundColor='#666';}else{ds.style.filter='alpha(opacity='+this._config.dropShadow+')';}
ds.style.opacity=this._config.dropShadow/100;}
if(Zapatec.is_ie&&!Zapatec.is_ie5){if(!subMenu.__zp_wch){subMenu.__zp_wch=Zapatec.Utils.createWCH(subMenu);}
subMenu.__zp_wch.style.zIndex=-1;Zapatec.Utils.setupWCH(subMenu.__zp_wch,-1,0,subMenu.offsetWidth+6,subMenu.offsetHeight+5);}
subMenu.style.left=newLeft+'px';subMenu.style.top=newTop+'px';this.toggleItem(item_id,true);}};Zapatec.Menu.prototype.itemHide=function(item_id){var item=this.items[item_id];var subMenu=this._getTree(item.__zp_subtree);var parMenu=this._getTree(item.__zp_parent);if(subMenu){this.toggleItem(item_id,false);parMenu.__zp_activeitem='';subMenu.__zp_activeitem='';for(var i in this.items){if(this.items[i].__zp_state)return;}
this.clickDone=false;}};Zapatec.Menu.dragStart=function(ev,menu){ev||(ev=window.event);if(menu.dragging){return true;}
var rootMenu=menu.trees[menu._el];if(!(/(absolute|fixed)/).test(rootMenu.style.position)){rootMenu.style.position='absolute';rootMenu.style.left=Zapatec.Utils.getAbsolutePos(rootMenu).x+'px';rootMenu.style.top=Zapatec.Utils.getAbsolutePos(rootMenu).y+'px';}
var testElm=ev.srcElement||ev.target;while(1){if(testElm==rootMenu)break;else testElm=testElm.parentNode;if(!testElm)return true;}
menu.dragging=true;var posX=ev.pageX||ev.clientX+window.document.body.scrollLeft||0;var posY=ev.pageY||ev.clientY+window.document.body.scrollTop||0;var L=parseInt(rootMenu.style.left)||0;var T=parseInt(rootMenu.style.top)||0;menu.xOffs=(posX-L);menu.yOffs=(posY-T);};Zapatec.Menu.dragMove=function(ev,menu){ev||(ev=window.event);var rootMenu=menu.trees[menu._el];if(!(menu&&menu.dragging)){return false;}
var posX=ev.pageX||ev.clientX+window.document.body.scrollLeft||0;var posY=ev.pageY||ev.clientY+window.document.body.scrollTop||0;var st=rootMenu.style,L=posX-menu.xOffs,T=posY-menu.yOffs;st.left=L+"px";st.top=T+"px";return Zapatec.Utils.stopEvent(ev);};Zapatec.Menu.dragEnd=function(ev,menu){if(!menu){return false;}
menu.dragging=false;};if(Zapatec.isLite)
Zapatec.Utils.addEvent(window,"load",Zapatec.Utils.checkActivation);


