/* MCW Framework
 * Copyright (c) 2009 By Mohammad eSmaeilpur
 * released under the terms of the GNU Public License.
 * see the GPL for details.
 *
 * @author:  Mohammad eSmaeilpur (support[at]esmaeilpour[dot]com)
 * @package: javascript
 * @version: 1.0.1
 */
function MCWTopMenu_Batch(method,scope,args){return function(e){var param=(typeof args!='undefined')?!(args instanceof Array)?[args]:args:[];return method.apply(scope||window,param);};};function MCWTopMenu_Transition(element,from,end,callback){this.element=element;this.from=from;this.end=end;this.point=from;this.size={'w':element.offsetWidth};this.callback=(callback||function(){element.style.clip='';});this.start=function(){this.set(this.from);this.timer=window.setInterval(MCWTopMenu_Batch(this.transition,this),20);};this.transition=function(){if(this.point==this.end){this.callback();return window.clearInterval(this.timer);}
var d=(this.end-this.point)/4;this.point+=d>0?Math.ceil(d):Math.floor(d);this.set(this.point);};this.set=function(p){with(this.element.style){clip="rect(0px, "+this.size.w+"px, "+p+"px, 0px)";}};this.start();};function MCWTopMenu_Build(){var timers={},fx={},root=document.getElementById('MCWTopMenuUL');var prev;$A(root.getElementsByTagName("ul")).each(function(item,i){if(item.parentNode.parentNode==root){item.style.left='-'+(item.offsetWidth-item.parentNode.offsetWidth)+"px";item.style.top=item.parentNode.offsetHeight+"px";with(item.parentNode.getElementsByTagName("a")[0])className=className+" mainfoldericon";}else{item.style.left='-'+(prev.getElementsByTagName("a")[0].offsetWidth)+"px";with(item.parentNode.getElementsByTagName("a")[0])className=className+" subfoldericon";}
item.parentNode.setAttribute('id','m_'+i);item.parentNode.onmouseover=function(ev){ev=ev||window.event;var e=(ev.target||ev.srcElement);do{if(e&&e.nodeName&&e.nodeName.toUpperCase()=='LI'){window.clearInterval(timers[e.id]);}
e=e.parentNode;if(e==root)break;}while(e);var ul=this.getElementsByTagName("ul")[0];with(ul.style){visibility="visible";if(this.id in fx||document.all)return;clip="rect(0px, 0px, 0px, 0px)";}
fx[this.id]=true;new MCWTopMenu_Transition(ul,0,ul.offsetHeight);}
item.parentNode.onmouseout=function(){var e=this,t;t=setTimeout(function(){e.getElementsByTagName("ul")[0].style.visibility="hidden";delete fx[e.id];},500);timers[e.id]=t;}
prev=item;});}
if(window.addEventListener)
window.addEventListener("load",MCWTopMenu_Build,false)
else if(window.attachEvent)
window.attachEvent("onload",MCWTopMenu_Build)