var OnLoadDelay=100;var OnLoadTimes=300;var categories=[];var rootcats=[];var timeOuts=[];var cacheFailed=false;var currentCat=false;var span_content=[];var catrootmenu=null;var repos2left=false;var fancy_body_is_load=false;function fcShowMenu(obj,cat){if(window.fancy_body_is_load===false)
return;fcInitItem(obj,cat);fcSelect(obj);if(currentCat){var fromParent=false;if(obj.parentLayer.parentCat){fromParent=(currentCat==obj.parentLayer.parentCat.cat);}
var fromChild=false;var c=fcGetCat(currentCat);if(c&&c.parentLayer&&c.parentLayer.parentCat)
fromChild=(c.parentLayer.parentCat.cat==obj.cat);if(currentCat!=obj.cat&&!fromParent&&!fromChild){fcHideMenu(currentCat);}}
currentCat=obj.cat;if(!obj.child)
return false;fcCreateLayer(obj);if(!obj.submenu)
return false;fcCancelHideMenu(obj.submenu);if(obj.parentLayer.parentCat)
fcCancelHideMenu(obj.parentLayer.parentCat.parentLayer);if(obj.submenu.object.innerHTML.length==0)
obj.submenu.loading();obj.submenu.reposition();obj.submenu.show();obj.parentLayer.submenu=obj.submenu;if(fcConfig.preload&&fcConfig.download)
fcPreLoad(obj.submenu);}
function fcInitHideMenu(obj){if(obj)
obj.tm=setTimeout('fcHideMenu("'+obj.parentCat.cat+'")',fcConfig.delay);}
function fcHideMenu(cat){var obj=fcGetCat(cat);if(!obj||!obj.submenu)
return false;while(obj.submenu&&obj.submenu.visible){obj=obj.submenu;}
while(obj.parentCat&&!obj.selected&&!obj.parentCat.parentLayer.selected&&obj.parentCat.parentLayer.parentCat){obj=obj.parentCat.parentLayer;}
if(obj.parentCat&&!obj.parentCat.selected)
obj.hide();while(obj.submenu){obj=obj.submenu;obj.hide();}}
function fcCancelHideMenu(obj){if(obj&&obj.tm)
clearTimeout(obj.tm);}
function fcLoad(){if(fcConfig.download){fcHTTPLoad(this);}else{fcInitSubmenu(this);}}
function fcPreLoad(obj){if(!fcConfig.preload||obj.preloaded)
return false;var subcats=obj.parentCat?fcGetCat(obj.parentCat.cat).subcats:rootcats;for(var c in subcats){var subobj=fcGetCat(c);if(!subobj||!subobj.child){continue;}
fcInitItem(subobj,c);fcCreateLayer(subobj);}
obj.preloaded=true;}
function fcHTTPLoad(obj){if(cacheFailed&&window.fcDynamicBlockHref)
var href=fcDynamicBlockHref.replace(/__CAT__/,obj.parentCat.cat);else
var href=fcBlockHref.replace(/__CAT__/,obj.parentCat.cat);if(obj.parentCat.selected){obj.loading();obj.show();obj.reposition();}
var span=document.body.appendChild(document.createElement("SPAN"));span.style.display='none';span.id=catPrefix+'span'+obj.parentCat.cat;span.innerHTML='4IE<s'+'cript></'+'script>';setTimeout(new Function('',"var s = document.getElementById('"+span.id+"').getElementsByTagName('script')[0]; s.language = 'JavaScript'; if (s.setAttribute) s.setAttribute('src', '"+href+"'); else s.src = '"+href+"';"),100);setTimeout(new Function('','fcHTTPCheckLoaded('+obj.parentCat.cat+', "'+span.id+'");'),100);}
function fcHTTPLoaded(cat,span){var obj=fcGetCat(cat);if(!obj||!obj.submenu)
return false;if(span_content[cat]){if(obj.submenu.loadingTO)
clearTimeout(obj.submenu.loadingTO);obj.submenu.write(span_content[cat]);span_content[cat]=null;}
fcInitSubmenu(obj.submenu);if(isIE||isOpera){obj=document.getElementById(span);if(obj)
obj.removeNode(true);}}
function fcHTTPCheckLoaded(cat,id){if(span_content[cat]){if(timeOuts[cat])
timeOuts[cat]=null;return fcHTTPLoaded(cat,id);}
var isLoaded=(isIE||isOpera)&&document.getElementById(id)&&document.getElementById(id).getElementsByTagName('script')&&document.getElementById(id).getElementsByTagName('script')[0].readyState=='loaded';if(!timeOuts[cat]&&!isLoaded){timeOuts[cat]=[setTimeout(new Function('','fcHTTPCheckLoaded('+cat+', "'+id+'");'),OnLoadDelay),1];}else if(timeOuts[cat]&&timeOuts[cat][1]<OnLoadTimes&&!isLoaded){timeOuts[cat][0]=setTimeout(new Function('','fcHTTPCheckLoaded('+cat+', "'+id+'");'),OnLoadDelay);timeOuts[cat][1]++;}else if(window.fcDynamicBlockHref){cacheFailed=true;timeOuts[cat]=false;var href=fcDynamicBlockHref.replace(/__CAT__/,cat);if(!isIE){var s=document.getElementById(id);s.parentNode.removeChild(s);var span=document.body.appendChild(document.createElement("SPAN"));span.style.display='none';span.id=id;span.innerHTML='4IE<s'+'cript></'+'script>';}
setTimeout(new Function('',"var s = document.getElementById('"+id+"').getElementsByTagName('script')[0]; s.language = 'JavaScript'; if (s.setAttribute) s.setAttribute('src', '"+href+"'); else s.src = '"+href+"';"),100);setTimeout(new Function('','fcHTTPCheckLoaded('+cat+', "'+id+'");'),100);}}
function fcInitRootMenu(cat,subcat){var obj=fcGetCat(cat);if(!obj)
return false;obj.submenu=false;obj.parentLayer=document.getElementById(catPrefix+'rootmenu');obj.parentLayer.parentCat=false;obj.tm=false;obj.child=subcat;obj.subcats=[];obj.parentLayer.level=0;rootcats[cat]=subcat;}
function fcReposition(){var o=this.parentCat;var x=getLeft(o);var y=getTop(o);var o_width=getWidth(o);var obj_width=this.getWidth();var xo=fcConfig.x_offset;if(isMSIE&&(isMac||isMacPPC)){this.moveTo(0,0);x-=this.getAbsoluteLeft()-3;y-=this.getAbsoluteTop()-3;}else if(isIE55){y=getTop(o.parentNode);}
if(repos2left){if(x+xo-obj_width>1){x-=obj_width;}else{x+=o_width;xo=xo*-1;}}else{if(x+xo+o_width+obj_width>getDocumentWidth()-1){x-=obj_width;xo=xo*-1;}else{x+=o_width;}}
this.moveTo(x+xo,y+fcConfig.y_offset);}
function fcOnLoad(){catrootmenu=document.getElementById(catPrefix+'rootmenu');var dw=getDocumentWidth();var rootx=getLeft(catrootmenu);repos2left=(rootx>dw/2);if(repos2left){fcConfig.x_offset=fcConfig.x_offset*-1;}
if(fcConfig.preload&&fcConfig.download){fcPreLoad(catrootmenu);}}
function fcSelect(obj){obj.className="CatMenuItemOn";obj.selected=true;if(obj.parentLayer)
obj.parentLayer.selected=true;}
function fcUnSelect(obj){obj.className="CatMenuItemOff";obj.selected=false;}
function fcCreateLayer(obj){if(obj.submenu)
return obj.submenu;if(fcConfig.download||!document.getElementById(obj.id+'sub')){var d=document.body.insertBefore(document.createElement("DIV"),document.body.childNodes[0]);d.id=obj.id+'sub';d.className='CatSubMenu';d.style.position='absolute';d.style.visibility='hidden';}else{var d=document.getElementById(obj.id+'sub');}
obj.submenu=layer(d.id);d.layer=obj.submenu;obj.submenu.parentCat=obj;obj.submenu.selected=false;obj.submenu.load=fcLoad;obj.submenu.reposition=fcReposition;obj.submenu.loading=fcLoadingAnim;obj.submenu.submenu=false;obj.submenu.level=1;if(obj.parentLayer.parentCat){if(isset(obj.parentLayer.level))
obj.submenu.level=obj.parentLayer.level+1;else if(isset(obj.parentLayer.parentCat.parentLayer.level))
obj.submenu.level=obj.parentLayer.parentCat.parentLayer.level+1;}
obj.submenu.setZIndex(50+obj.submenu.level);d.style.zIndex=50+obj.submenu.level;d.onmouseover=new Function('','this.layer.selected = true; fcCancelHideMenu(this.layer); fcCancelHideMenu(this.layer.parentCat.parentLayer);');d.onmouseout=new Function('','this.layer.selected = false; fcInitHideMenu(this.layer);');obj.submenu.load();return obj.submenu;}
function fcGetCat(id){var obj=document.getElementById(catPrefix+id);if(!obj)
return false;return obj;}
function fcInitItem(obj,cat){if(obj.cat)
return false;obj.onmouseout=new Function('',"fcUnSelect(this); fcInitHideMenu(this.submenu);");obj.cat=cat;return true;}
function fcInitSubmenu(obj){if(!categories[obj.parentCat.cat])
return false;obj.parentCat.childs=true;for(var c in categories[obj.parentCat.cat]){var subobj=fcGetCat(c);if(subobj){subobj.parentLayer=obj;subobj.child=obj.parentCat.subcats[c]=categories[obj.parentCat.cat][c];subobj.subcats=new Array();}}
categories[obj.parentCat.cat]=null;}
function fcLoadingAnim(cat){if(!isset(cat)&&this)
cat=this.parentCat.cat;if(!fcConfig.download)
return;var obj=fcGetCat(cat);if(!obj)
return
obj=obj.submenu;if(!obj.ticks||obj.ticks>=5)
obj.ticks=0;obj.ticks++;var prefix='';for(var x=0;x<obj.ticks;x++)
prefix+='.';obj.write('&nbsp;&nbsp;'+lbl_loading_menu+' '+prefix);obj.loadingTO=setTimeout("fcLoadingAnim('"+cat+"')",1000);}
