/*
function redirect_to_url(newLoc)
{
     // document.location.href = newLoc;
	location.href = newLoc;
}
*/
function redirect_to_url(url)
{
    var fakeLink = document.createElement ("a");
    if (typeof(fakeLink.click) == 'undefined')
        location.href = url;  // sends referrer in FF, not in IE
    else
    {
        fakeLink.href = url;
        document.body.appendChild(fakeLink);
        fakeLink.click();   // click() method defined in IE only
    }
}


var zxcTO;

function Scroll(id,dis,pos){
 var obj=document.getElementById(id)
 obj.scrollTop=obj.scrollTop+dis;
 if (pos){obj.scrollTop=pos; }
 else {zxcTO=setTimeout( function(){ Scroll(id,dis); },10); }
}

function ajax_show() {

	var obj = document.getElementById('ajax_update'); 
	obj.setAttribute("class", 'none'); 
	obj.setAttribute( 'className', 'none' );

	var bg = document.getElementById('bg_change'); 
	bg.setAttribute("class", 'blanket'); 
	bg.setAttribute( 'className', 'blanket' );
	
	return true;

}

function ajax_hide() {
	
	var obj = document.getElementById('ajax_update'); 
	obj.setAttribute("class", 'hidden'); 
	obj.setAttribute( 'className', 'hidden' );

	var bg = document.getElementById('bg_change'); 
	bg.setAttribute("class", 'none'); 
	bg.setAttribute( 'className', 'none' );

	return true;
}


/* 
*********************

 Form customization 
 
**********************
*/

var checkboxHeight = "22";
var radioHeight = "22";
var selectWidth = "235";


/* No need to change anything after this */


document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				if(!inputs[a].getAttribute("disabled")) {
					span[a].onmousedown = Custom.pushed;
					span[a].onmouseup = Custom.check;
				} else {
					span[a].className = span[a].className += " disabled";
				}
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				if(!inputs[a].getAttribute("disabled")) {
					inputs[a].onchange = Custom.choose;
				} else {
					inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
				}
			}
		}
		document.onmouseup = Custom.clear;
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;

			/************************************************************************************************************
				(C) www.dhtmlgoodies.com, October 2005
				
				This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
				
				Terms of use:
				You are free to use this script as long as the copyright message is kept intact. However, you may not
				redistribute, sell or repost it without our permission.
				
				Update log:
				
					March, 15th: Fixed problem with sliding in MSIE
				
				Thank you!
				
				www.dhtmlgoodies.com
				Alf Magne Kalleland
				
				************************************************************************************************************/	
			var expandFirstItemAutomatically = false;	// Expand first menu item automatically ?
			var initMenuIdToExpand = "lala";	// Id of menu item that should be initially expanded. the id is defined in the <li> tag.
			var expandMenuItemByUrl = false;	// Menu will automatically expand by url - i.e. if the href of the menu item is in the current location, it will expand

			var initialMenuItemAlwaysExpanded = true;	// NOT IMPLEMENTED YET

			var dhtmlgoodies_slmenuObj;
			var divToScroll = false;
			var ulToScroll = false;	
			var divCounter = 1;
			var otherDivsToScroll = new Array();
			var divToHide = false;
			var parentDivToHide = new Array();
			var ulToHide = false;
			var offsetOpera = 0;
			if(navigator.userAgent.indexOf('Opera')>=0)offsetOpera=1;	
			var slideMenuHeightOfCurrentBox = 0;
			var objectsToExpand = new Array();
			var initExpandIndex = 0;
			var alwaysExpanedItems = new Array();
				
			function popMenusToShow()
			{
				var obj = divToScroll;
				var endArray = new Array();
				while(obj && obj.tagName!='BODY'){
					if(obj.tagName=='DIV' && obj.id.indexOf('slideDiv')>=0){
						var objFound = -1;
						for(var no=0;no<otherDivsToScroll.length;no++){
							if(otherDivsToScroll[no]==obj){
								objFound = no;		
							}					
						}	
						if(objFound>=0){
							otherDivsToScroll.splice(objFound,1);	
						}		
					}	
					obj = obj.parentNode;
				}	
			}

			function showSubMenu(e,inputObj)
			{

				if(this && this.tagName)inputObj = this.parentNode;
				if(inputObj && inputObj.tagName=='LI'){
					divToScroll = inputObj.getElementsByTagName('DIV')[0];
					for(var no=0;no<otherDivsToScroll.length;no++){
						if(otherDivsToScroll[no]==divToScroll)return;
					}			
				}
				hidingInProcess = false;
				if(otherDivsToScroll.length>0){
					if(divToScroll){				
						if(otherDivsToScroll.length>0){
							popMenusToShow();
						}
						if(otherDivsToScroll.length>0){	
							autoHideMenus();
							hidingInProcess = true;
						}
					}	
				}		
				if(divToScroll && !hidingInProcess){
					divToScroll.style.display='';
					otherDivsToScroll.length = 0;
					otherDivToScroll = divToScroll.parentNode;
					otherDivsToScroll.push(divToScroll);	
					while(otherDivToScroll && otherDivToScroll.tagName!='BODY'){
						if(otherDivToScroll.tagName=='DIV' && otherDivToScroll.id.indexOf('slideDiv')>=0){
							otherDivsToScroll.push(otherDivToScroll);
												
						}
						otherDivToScroll = otherDivToScroll.parentNode;
					}			
					ulToScroll = divToScroll.getElementsByTagName('UL')[0];
					if(divToScroll.style.height.replace('px','')/1<=1)scrollDownSub();
				}	
				

			}



			function autoHideMenus()
			{
				if(otherDivsToScroll.length>0){
					divToHide = otherDivsToScroll[otherDivsToScroll.length-1];
					parentDivToHide.length=0;
					var obj = divToHide.parentNode.parentNode.parentNode;
					while(obj && obj.tagName=='DIV'){			
						if(obj.id.indexOf('slideDiv')>=0)parentDivToHide.push(obj);
						obj = obj.parentNode.parentNode.parentNode;
					}
					var tmpHeight = (divToHide.style.height.replace('px','')/1 - slideMenuHeightOfCurrentBox);
					if(tmpHeight<0)tmpHeight=0;
					if(slideMenuHeightOfCurrentBox)divToHide.style.height = tmpHeight  + 'px';
					ulToHide = divToHide.getElementsByTagName('UL')[0];
					slideMenuHeightOfCurrentBox = ulToHide.offsetHeight;
					scrollUpMenu();		
				}else{
					slideMenuHeightOfCurrentBox = 0;
					showSubMenu();			
				}
			}


			function scrollUpMenu()
			{

				var height = divToHide.offsetHeight;
				height-=15;
				if(height<0)height=0;
				divToHide.style.height = height + 'px';

				for(var no=0;no<parentDivToHide.length;no++){	
					parentDivToHide[no].style.height = parentDivToHide[no].getElementsByTagName('UL')[0].offsetHeight + 'px';
				}
				if(height>0){
					setTimeout('scrollUpMenu()',5);
				}else{
					divToHide.style.display='none';
					otherDivsToScroll.length = otherDivsToScroll.length-1;
					autoHideMenus();			
				}
			}	

			function scrollDownSub()
			{
				if(divToScroll){			
					var height = divToScroll.offsetHeight/1;
					var offsetMove =Math.min(15,(ulToScroll.offsetHeight - height));
					height = height +offsetMove ;
					divToScroll.style.height = height + 'px';
					
					for(var no=1;no<otherDivsToScroll.length;no++){
						var tmpHeight = otherDivsToScroll[no].offsetHeight/1 + offsetMove;
						otherDivsToScroll[no].style.height = tmpHeight + 'px';
					}			
					if(height<ulToScroll.offsetHeight)setTimeout('scrollDownSub()',5); else {
						divToScroll = false;
						ulToScroll = false;
						if(objectsToExpand.length>0 && initExpandIndex<(objectsToExpand.length-1)){
							initExpandIndex++;
							
							showSubMenu(false,objectsToExpand[initExpandIndex]);
						}
					}
				}
			}
				
			function initSubItems(inputObj,currentDepth)
			{		
				divCounter++;		
				var div = document.createElement('DIV');	// Creating new div		
				div.style.overflow = 'hidden';	
				div.style.position = 'relative';
				div.style.display='none';
				div.style.height = '1px';
				div.id = 'slideDiv' + divCounter;
				div.className = 'slideMenuDiv' + currentDepth;		
				inputObj.parentNode.appendChild(div);	// Appending DIV as child element of <LI> that is parent of input <UL>		
				div.appendChild(inputObj);	// Appending <UL> to the div
				var menuItem = inputObj.getElementsByTagName('LI')[0];
				while(menuItem){
					if(menuItem.tagName=='LI'){
						var aTag = menuItem.getElementsByTagName('A')[0];
						aTag.className='slMenuItem_depth'+currentDepth;	
						var subUl = menuItem.getElementsByTagName('UL');
						if(subUl.length>0){
							initSubItems(subUl[0],currentDepth+1);					
						}
						aTag.onclick = showSubMenu;				
					}			
					menuItem = menuItem.nextSibling;						
				}		
			}

			function initSlideDownMenu()
			{
				dhtmlgoodies_slmenuObj = document.getElementById('dhtmlgoodies_slidedown_menu');
				dhtmlgoodies_slmenuObj.style.visibility='visible';
				var mainUl = dhtmlgoodies_slmenuObj.getElementsByTagName('UL')[0];		
				var mainMenuItem = mainUl.getElementsByTagName('LI')[0];
				mainItemCounter = 1;
				while(mainMenuItem){			
					if(mainMenuItem.tagName=='LI'){
						var aTag = mainMenuItem.getElementsByTagName('A')[0];
						aTag.className='slMenuItem_depth1';	
						var subUl = mainMenuItem.getElementsByTagName('UL');
						if(subUl.length>0){
							mainMenuItem.id = 'mainMenuItem' + mainItemCounter;
							initSubItems(subUl[0],2);
							aTag.onclick = showSubMenu;
							mainItemCounter++;
						}				
					}			
					mainMenuItem = mainMenuItem.nextSibling;	
				}		
				
				if(location.search.indexOf('mainMenuItemToSlide')>=0){
					var items = location.search.split('&');
					for(var no=0;no<items.length;no++){
						if(items[no].indexOf('mainMenuItemToSlide')>=0){
							values = items[no].split('=');
							showSubMenu(false,document.getElementById('mainMenuItem' + values[1]));	
							initMenuIdToExpand = false;				
						}
					}			
				}else if(expandFirstItemAutomatically>0){
					if(document.getElementById('mainMenuItem' + expandFirstItemAutomatically)){
						showSubMenu(false,document.getElementById('mainMenuItem' + expandFirstItemAutomatically));
						initMenuIdToExpand = false;
					}
				}

				if(expandMenuItemByUrl)
				{
					var aTags = dhtmlgoodies_slmenuObj.getElementsByTagName('A');
					for(var no=0;no<aTags.length;no++){
						var hrefToCheckOn = aTags[no].href;				
						if(location.href.indexOf(hrefToCheckOn)>=0 && hrefToCheckOn.indexOf('#')<hrefToCheckOn.length-1){
							initMenuIdToExpand = false;
							var obj = aTags[no].parentNode;
							while(obj && obj.id!='dhtmlgoodies_slidedown_menu'){
								if(obj.tagName=='LI'){							
									var subUl = obj.getElementsByTagName('UL');
									if(initialMenuItemAlwaysExpanded)alwaysExpanedItems[obj.parentNode] = true;
									if(subUl.length>0){								
										objectsToExpand.unshift(obj);
									}
								}
								obj = obj.parentNode;	
							}
							showSubMenu(false,objectsToExpand[0]);
							break;					
						}			
					}
				}
				if(initMenuIdToExpand)
				{
					objectsToExpand = new Array();
					var obj = document.getElementById(initMenuIdToExpand)
					while(obj && obj.id!='dhtmlgoodies_slidedown_menu'){
						if(obj.tagName=='LI'){
							var subUl = obj.getElementsByTagName('UL');
							if(initialMenuItemAlwaysExpanded)alwaysExpanedItems[obj.parentNode] = true;
							if(subUl.length>0){						
								objectsToExpand.unshift(obj);
							}
						}
						obj = obj.parentNode;	
					}
					
					showSubMenu(false,objectsToExpand[0]);

				}
				

					
			}
				window.onload = initSlideDownMenu;

function changePage(newLoc) {
	nextPage = newLoc.options[newLoc.selectedIndex].value;
	if (nextPage != "") {
		document.location.href = nextPage;
	}
}

