 function setActiveStyleSheet(title) {
       var i, a, main;
       for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
         if(a.getAttribute("rel").indexOf("style") != -1
            && a.getAttribute("title")) {
           a.disabled = true;
           if(a.getAttribute("title") == title) a.disabled = false;
         }
       }
    }
	
	function markActiveMainMenuItem(name){
		var ar = document.getElementsByClassName('navButtons');
		var i=-1;
		while(++i < ar.length){
				if(ar[i].name == name){
					ar[i].onmouseover = null;
					ar[i].onmouseout = null;
					ar[i].onclick = null;
					ar[i].src = "img/"+ar[i].name+"On.png";
				}
		}
	}
	
	function buildSubmenu(par, area, its, active){
		 var i=0;
		  while(i < its.length){
			var u = its[i];
					
			var state = (getURL() == u.href ||  u.href == active)?"b":"a";

			var link = document.createElement('img');
			link.setAttribute('src', 'img/submenu/'+area+''+(i+1)+state+'.gif');
			link.setAttribute('class', "submenu");
			link.className = "submenu";
			link.setAttribute("id", u.href);
			
			if(state == "a"){
				link.onmouseover = function(){
					this.src = this.src.substring(0, this.src.length - 5) + "b.gif";
				};
				
				link.onmouseout = function(){
					this.src = this.src.substring(0, this.src.length - 5) + "a.gif";
				};
				
				link.onclick = function(){
					location.href = this.id;
				};

			}
			else{
				link.setAttribute('class', "submenuAct");
				link.className = "submenuAct";
			}
			
			par.appendChild(link);
			
			i++;
		  }
	}
	
	
	/**
	*changes the className rollover
	*/
	function rollover(el){
		if(el.className.indexOf("On") <= 0){
			el.className = el.className + "On";
		}
		else{
			el.className = el.className.substring(0, el.className.indexOf("On"));
		}
		
		if(!el.onmouseout){
			el.onmouseout = function(){
				rollover(this);
			};
		}
	}
	
	function getURL(){
		var url = window.location.href;
		var ps = url.indexOf("?");
		if(ps > 0)
		url = url.substring(0, ps);
		var l = url.lastIndexOf("/")
		if(l < 8 || l+1 == url.length)
		return "index.asp";
		else
		return url.substring(l+1, url.length);
	}
	
	function checkEmail(email){
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
			if (filter.test(email))
				return true;
			else return false;
	  }
	  
	function navigate(url){
		location.href = url;
	}
	
	function numbersonly(myfield, e, dec)
		{
		var key;
		var keychar;
		
		if (window.event)
		   key = window.event.keyCode;
		else if (e)
		   key = e.which;
		else
		   return true;
		keychar = String.fromCharCode(key);
		
		// control keys
		if ((key==null) || (key==0) || (key==8) || 
			(key==9) || (key==13) || (key==27) )
		   return true;
		
		// numbers
		else if ((("0123456789").indexOf(keychar) > -1))
		   return true;
		else if(keychar == "." || keychar == ",")
			return true; 
		
		// decimal point jump
		else if (dec && (keychar == "."))
		   {
		   myfield.form.elements[dec].focus();
		   return false;
		   }
		else
		   return false;
		}
		
		


    if (window.XMLHttpRequest) {
        if(document.all){
          setActiveStyleSheet("ie7");
        //IE7
        }else{
            
        //mozilla, safari, opera 9…etc
        }
    } else {
        
    // IE6, older browsers
    } 
