/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
/*
 major menu 
 */
stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var getElm = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<getElm.length; i++) {
		
		getElm[i].onmouseover=function() {
			this.className+=" iehover";
			
		}
		getElm[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			
		}
	}//document.getElementById('areaA').style.visibility = 'visible';
	//slideMenu.build('sm',200,10,10,1);
}
altroSlide = function() {
	//slideMenu.build('sm',200,10,10,1);
			
}	
researchAnchor	= function() {
	funMenu = $("ul#nav li a[onclick*=runFunction]").get();
}	


/*
 mini slider itstart
 */
var slideMenu=function(){
	var sp,st,t,m,sa,l,w,gw,ot;
	return{
		build:function(sm,sw,mt,s,sl,h){
			
			
			
			sp=s; st=sw; t=mt;
			m=document.getElementById(sm);
			sa=m.getElementsByTagName('li');  //alert(sa.length);
			l=sa.length; w=m.offsetWidth; gw=w/l;
			ot=Math.floor((w-st)/(l-1)); var i=0;
			for(i;i<l;i++){s=sa[i]; s.style.width=gw+'px'; this.timer(s)}
			if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}
				
									
			document.getElementById('areaA').style.visibility = 'visible';
			//alert(document.getElementById('areaA').innerHTML);
		},
		timer:function(s){
			s.onmouseover=function(){clearInterval(m.htimer);clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}
			s.onmouseout=function(){clearInterval(m.timer);clearInterval(m.htimer);m.htimer=setInterval(function(){slideMenu.slide(s,true)},t)}
		},
		slide:function(s,c){
			
			var cw=parseInt(s.style.width);
			
			try {
				if((cw<st && !c) || (cw>gw && c)){
					var owt=0; var i=0;
					for(i;i<l;i++){
						if(sa[i]!=s){
							var o,ow; var oi=0; o=sa[i]; ow=parseInt(o.style.width);
							if(ow<gw && c){oi=Math.floor((gw-ow)/sp); oi=(oi>0)?oi:1; o.style.width=(ow+oi)+'px';
							}else if(ow>ot && !c){oi=Math.floor((ow-ot)/sp); oi=(oi>0)?oi:1; o.style.width=(ow-oi)+'px'}
							if(c){owt=owt+(ow+oi)}else{owt=owt+(ow-oi)}}}
					s.style.width=(w-owt)+'px';
				}else{clearInterval(m.timer);clearInterval(m.htimer)}
			} catch(er) {}	
		},
		slidend:function(){
			try {
				clearInterval(m.timer);clearInterval(m.htimer);
			} catch(er) {}	
		}	
	};
}();

/*
 mini header menu 
 */
var timeout         = 500;
var closetimer	    = 0;
var ddmenuitem      = 0;

function init_jsddm() {
	
	$('#jsddm > li').bind('mouseover', jsddm_open);
	$('#jsddm > li').bind('mouseout',  jsddm_timer);
	
}	

function jsddm_open()
{	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');}

function jsddm_close()
{	if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{	closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{	if(closetimer)
	{	window.clearTimeout(closetimer);
		closetimer = null;
	}
}



