if(!window.ND){window.ND={};window.NextDigital=window.ND;}
/* 2008/01/10 - ND.addLoadListener v0.82 - Glenn Baker */
ND.addLoadListener=function(fn){if(typeof window.addEventListener!='undefined'){window.addEventListener('load',fn,false);}else if(typeof document.addEventListener!='undefined'){document.addEventListener('load',fn,false);}else if(typeof window.attachEvent!='undefined'){ window.attachEvent('onload',fn);}else{var oldfn=window.onload;if(typeof window.onload!='function'){window.onload=fn;}else{window.onload=function(){oldfn();fn();};}}};
/* 2008/01/14 - ND.anchors v0.99 - Glenn Baker - Support for, external, popup:XXX:XXX, close, and print. Includes PopupWindow(url,n,w,h,sc) */
ND.anchors={storage:{external:function(){var ex=window.open(this.href);return !ex;},popup:function(){var dims=arguments&&arguments.length==2?arguments:window.__popupDims;popupWindow(this.href,'name',dims[0],dims[1],'yes');return false;},close:function(){window.close();return false;},print:function(){window.print();return false;}},init:function(){if(this !=ND.anchors){return ND.anchors.init();}window.popupWindow=this.popupWindow;if(!window.__popupDims)window.__popupDims=[619,380];var atype=window.__aType?window.__aType:"rel";if(document.getElementsByTagName&&document.getElementById){var anchors=document.getElementsByTagName("a");for(i=0;i<anchors.length;i++){var attr=String(atype=="class"?anchors[i].className:anchors[i].getAttribute(atype));if(attr){var matches=attr.match(/([^\s])+/g);for(var j=0;j<matches.length;j++){var match=matches[j].replace(/^([\w]*)[:|][^,\s]+([,]?[^,\s]+)*$/i,"$1");var args=(matches[j].replace(match,"")).match(/[^,|:\s]+/g);if(this.storage[match]){anchors[i].onclick=this.Bind(this.storage[match], args);}}}}}},popupWindow:function(url,n,w,h,sc){var sw=screen.availWidth;var sh=screen.availHeight;lp=(sw)?(sw-w)/2:0;tp=(sh)?(sh-h)/2:0;se='height='+h+',width='+w+',top='+tp+',left='+lp+',scrollbars='+sc+',resizable=yes';win=window.open(url,n,se);win.focus();},add:function(rel, fn){if(!this.storage[rel])this.storage[rel]=fn;else throw("Behaviour already exisits for '"+rel+"'");},setPopupDimensions:function(w,h){window.__popupDims=[w,h];},setAttrType:function(a){window.__aType=a;},Bind:function(fn){var args=[];if(arguments.length>1){args=(new String(arguments[1])).split(",");}return function(){return fn.apply(this, args);};}};
/* 2007/12/05 - ND.classFunctions v0.92 - Glenn Baker - includes addClass, removeClass, hasClass, toggleClass and replaceClass */
ND.classFunctions={addClass:function(t, c){var p=new RegExp("(^|)"+c+"(|$)");if(!p.test(t.className)){if(t.className==""){t.className=c;}else{t.className+=" "+c;}}return true;},removeClass:function(t, c){var removedClass=t.className;var p=new RegExp("(^|)"+c+"(|$)");removedClass=removedClass.replace(p, "$1");removedClass=removedClass.replace(/$/, "");t.className=removedClass;return true;},replaceClass:function(t, prec, c){removeClass(t,prec);addClass(t,c);},toggleClass:function(t, c){if(hasClass(t,c)){removeClass(t,c);}else{addClass(t,c);}},hasClass:function(t, c){var p=new RegExp("(^|)"+c+"(|$)");return p.test(t.className);},init:function(){for(n in this){window[n]=this[n]}}};ND.classFunctions.init();

var setIEHovers = function(list) {
	var listItems = list.getElementsByTagName("li");

	for(var k=0; k < listItems.length; k++) {
		var node = listItems[k];
		node.onmouseover=function() {this.className+=" hover";}
		node.onmouseout=function() {this.className=this.className.replace(" hover", "");}
	}
}

var setIEHoversNav= function(list) {
	var listItems = list.getElementsByTagName("li");

	for(var k=0; k < listItems.length; k++) {
		var node = listItems[k];
		node.onmouseover=function() {this.className+="-active";}
		node.onmouseout=function() {this.className=this.className.replace("-active", "");}
	}
}


var hoverIE = function() {
	// IE6 only
	if(window.ActiveXObject && window.XMLHttpRequest == undefined) {
		var ul_array = document.getElementsByTagName("ul");

		for (var i=0; i < ul_array.length; i++) {
			if(hasClass(ul_array[i], "hoverable")) {
				setIEHovers(ul_array[i]);
			}
			if(hasClass(ul_array[i], "navigation-primary")) {
				setIEHoversNav(ul_array[i]);
			}

		}
	}
}



/* Overlabels */
var hideLabel = function(field_id, hide){
	var field_for;
	var labels = document.getElementsByTagName('label');
	for (var i = 0; i < labels.length; i++) {
		field_for = labels[i].htmlFor || labels[i].getAttribute('for');
		if (field_for == field_id && hasClass(labels[i],"overlabel-apply")) {
			labels[i].style.textIndent = (hide) ? '-9999px' : '0px';
			return true;
		}
	}
};

var initOverLabels = function(){
	if (!document.getElementById) return;  	
	var labels, id, field;
	labels = document.getElementsByTagName('label');
	for (var i=0; i < labels.length; i++) {
	    if (labels[i].className == 'overlabel') {
			id = labels[i].htmlFor || labels[i].getAttribute('for');
			if (!id || !(field = document.getElementById(id))){continue;}
			labels[i].className = 'overlabel-apply';		
			if (field.value !== ''){hideLabel(field.getAttribute('id'), true);}
			field.onfocus = function(){hideLabel(this.getAttribute('id'), true);};
			field.onblur = function(){
				if(this.value === ''){
					hideLabel(this.getAttribute('id'), false);
				}
			};
			labels[i].onclick = function(){
				var id, field;
				id = this.getAttribute('for');
				if(id && (field = document.getElementById(id))) {
					field.focus();
				}
			};
		}
	}
};

ND.anchors.setPopupDimensions(619,320);

var myInit = function(){hoverIE();initOverLabels();ND.anchors.init();};
ND.addLoadListener(myInit);


//sIFR-----------------------------------------------------------------
/* Replacement calls. Please see documentation for more information. */

if(typeof sIFR == "function"){

// This is the preferred "named argument" syntax
	sIFR.replaceElement(named({sSelector:".article h1", sFlashSrc:"/global/swf/trajan_bold.swf", sColor:"#3F4C6B", sLinkColor:"#3F4C6B", sBgColor:"", sHoverColor:"", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0",sWmode:"transparent"}));
	sIFR.replaceElement(named({sSelector:".boxes .box h2", sFlashSrc:"/global/swf/trajan_bold.swf", sColor:"#FFFFFF", sLinkColor:"#FFFFFF", sBgColor:"#3F4C6B", sHoverColor:"", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0",sWmode:"transparent"}));

};

window.onload=function(){
	addLinkerEvents();
	with(navigator)   
	{
		if(appName == "Microsoft Internet Explorer" && parseInt(appVersion.split(" ")[3]) == 6){   
			TJK_keyBoardDropDown();
		}
	}
}

