function fnOpenWindow(url,parameters)
{
	parameters=parameters.replace(/\s+/g,'');

	var aParameters=parameters.split(',');
	var data=new Array();
	for (var i=0;i<aParameters.length;i++) {
		var pr=aParameters[i];
		var key = pr.substr(0,pr.indexOf('='));
		var value=pr.substr(pr.indexOf('=')+1);
		data[key]=value;
	}

	if ( (data['hposition'])&&(data['width'])&&(data['hposition']!='system') )
	{
		var posX=null;
		if (data['hposition']=='left')
		{
			posX=0;
		}
		if ( (window.screen)&&(window.screen.availWidth) )
		{
			if (data['hposition']=='center')
				posX=(window.screen.availWidth-data['width'])/2;
			if (data['hposition']=='right')
				posX=window.screen.availWidth-data['width'];
		}

		if (posX!=null)
			parameters+=",left="+parseInt(posX);
	}

	if ( (data['vposition'])&&(data['height'])&&(data['vposition']!='system') )
	{
		var posY=null;
		if (data['vposition']=='top')
		{
			posY=0;
		}
		if ( (window.screen)&&(window.screen.availHeight) )
		{
			if (data['vposition']=='center')
				posY=(window.screen.availHeight-data['height'])/2;
			if (data['vposition']=='bottom')
				posY=window.screen.availHeight-data['height'];
		}

		if (posY!=null)
			parameters+=",top="+parseInt(posY);
	}


	var oWnd=window.open(url,'',parameters);
	oWnd.focus();
}

function lockFormOnEmpty(oForm,field)
{
	var oField=oForm[field];
	if(!oField) return true;
	if (!oField.options[oField.selectedIndex].value) return false;
	return true;
}

function addClass(obj,newClass) {
	if(!obj.className.match(new RegExp(newClass)))
		obj.className+=(obj.className.length>0? " ": "") + newClass;
}
	
function removeClass(obj,oldClass) {
	obj.className=obj.className.replace(new RegExp("( ?|^)"+oldClass+"\\b"), "");
}

function setLinks() {
	var aCollection = document.getElementsByTagName('a');
	for (var i = 0; i < aCollection.length; i++) {
		if (aCollection[i].rel) {
			switch (aCollection[i].rel) {
				case "bookmark" :
				case "external" :
				case "corporate" :
				case "sponsor" :
					aCollection[i].onclick = function(e) {
						if (!e) var e = window.event;
						if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey)
							return true;
						window.open(this.href);
						return false;
					}
				break;
			}
		}	
	}
	
	var aCollection = document.getElementsByTagName('area');
	for (var i = 0; i < aCollection.length; i++) {
		if (aCollection[i].rel) {
			switch (aCollection[i].rel) {
				case "bookmark" :
				case "external" :
				case "corporate" :
				case "sponsor" :
					aCollection[i].onclick = function(e) {
						if (!e) var e = window.event;
						if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey)
							return true;
						window.open(this.href);
						return false;
					}
				break;
			}
		}	
	}
}

function setLowIeNav(){
	var nm = document.getElementById('navigation-main');
	if(!nm) return;
	if(nm.getElementsByTagName('li')[0]){
		addClass(nm.getElementsByTagName('li')[0],'first-child');
		var nmLiCollection = nm.getElementsByTagName('li');
		
		for (var j = 0; j < nmLiCollection.length; j++) {
			if(j == (nmLiCollection.length - 1)) {
				nmLiCollection[j].onmouseover = function() {
					addClass(this,'lhover');
				}
				nmLiCollection[j].onmouseout = function() {
					removeClass(this,'lhover');
				}
			}
			else if(j==0) {
				nmLiCollection[j].onmouseover = function() {
					addClass(this,'fhover');
				}
				nmLiCollection[j].onmouseout = function() {
					removeClass(this,'fhover');
				}
			}
			else {
				nmLiCollection[j].onmouseover = function() {
					addClass(this,'hover');
				}
				nmLiCollection[j].onmouseout = function() {
					removeClass(this,'hover');
				}
			}
		}
	}
	var ln = document.getElementById('local');
	if(!ln) return;
	var d = ln.getElementsByTagName('div')[0];
	addClass(d,'off');
	ln.onmouseover = function() {
		removeClass(d,'off');
	}
	ln.onmouseout = function() {
		addClass(d,'off');
	}
}

/* Init
-------------------- */
var init = function() {
	if (arguments.callee.done) return;
	arguments.callee.done = true;
	if(!document.getElementsByTagName)
		return;
	setLinks();
	/*@cc_on @*/
	/*@if (@_win32)
	newerThanIe6 = eval('document.getElementsByTagName("body")[0].currentStyle.minWidth');
	if (!newerThanIe6) {
		setLowIeNav();
	}
	/*@end @*/
}

if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", init, null);
}
else if (/WebKit/i.test(navigator.userAgent)) {
	var _timer = setInterval(function() {
		if (/loaded|complete/.test(document.readyState)) {
			clearInterval(_timer);
			init();
		}
	}, 10);
}
else {
	/*@cc_on @*/
	/*@if (@_win32)
	document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
	var script = document.getElementById("__ie_onload");
	script.onreadystatechange = function() {
		if (this.readyState == "complete") {
			init();
		}
	};
	/*@end @*/
}
window.onload = init;



function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function prepareInputsForHints() {
	var inputs = document.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++){
		// test to see if the hint span exists first
		if (inputs[i].parentNode.getElementsByTagName("span")[0]) {
			// the span exists!  on focus, show the hint
			inputs[i].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			// when the cursor moves away from the field, hide the hint
			inputs[i].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
	// repeat the same tests as above for selects
	var selects = document.getElementsByTagName("select");
	for (var k=0; k<selects.length; k++){
		if (selects[k].parentNode.getElementsByTagName("span")[0]) {
			selects[k].onfocus = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
			}
			selects[k].onblur = function () {
				this.parentNode.getElementsByTagName("span")[0].style.display = "none";
			}
		}
	}
}
addLoadEvent(prepareInputsForHints);


function popup(theURL,h,l) {
	feature = "'toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, width="+l+", height="+h+"'";
	//alert(feature);
	fenetre = window.open(theURL,'KB',feature);
	fenetre.focus();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
