function nop2(){}
//-----------------------------------------------------//-----------------------------------------------------
//  UL Custon DART Styles
//-----------------------------------------------------//-----------------------------------------------------

 // policy functions	
 //-----------------------------------------------------
	hasPolicy  = false
	policyPath  = 'http://www.lincoln.ac.uk/demo2/accessPolicy.htm'
	
	popPol = function (){
		if(!hasPolicy) {return}
		var scaleValue = getCookieVal('scaleVal')
		if( scaleValue.length > 5){ scaleValue = scaleValue.substr(0,5)}
		polPath = policyPath+"?colr="+getCookieVal('bgColour')+";scale="+scaleValue
		window.open(polPath)
	}

 // cookie functions	
 //-----------------------------------------------------
	expDate = new Date()
	expYear = expDate.getFullYear() +1
	expDate = new Date(expYear,0,1)
	expireIt =  new Date(expYear -1 ,0,1)

	nL = String.fromCharCode(10)
	cookiesNotSet = "Please note:   Cookies are not enabled ....." +nL+ "Any changes made to access setting will only apply to this page."
	 

	getCookieVal = function(cookieName){
		var returnVal = -1
		if( document.cookie.length > 0){
			nvPairs = document.cookie.split(';')
			for(var i=0; i <nvPairs.length;++i){
				nvPair = nvPairs[i].split('=')
				if(nvPair[0].indexOf(cookieName) != -1){returnVal = nvPair[1]}
			}
		}
		return returnVal
	}

 // set and store background colour cookie	
 //-----------------------------------------------------
	setDARTbg = function(bgColour){
		if(bgColour == ''){ document.cookie ='bgColour='+bgColour+';path=/;expires='+expireIt.toGMTString() }
		else{ document.cookie ='bgColour='+bgColour+';path=/;expires='+ expDate.toGMTString()}
		document.body.style.backgroundColor= bgColour
	}
		
 // store reload used to override reset redraw
 //-----------------------------------------------------
	setReload = function(val){
		if(val == -1){ document.cookie ='reLoad='+val+';path=/;expires='+ expireIt.toGMTString()}
		else{document.cookie ='reLoad='+val+';path=/;expires='+ expDate.toGMTString()}
	}

 // set and store scale cookie
 //-----------------------------------------------------
	setScaleCookie = function(scale){
		if(scale == -1) { currentScale = 1}
		else{currentScale= currentScale*scale}
		if(currentScale == 1){document.cookie ='scaleVal=-1;path=/; expires='+ expireIt.toGMTString()}
		else{	document.cookie ='scaleVal='+currentScale+';path=/; expires='+ expDate.toGMTString()}
		if(scale != -1){showSwatch()}
	}


	cookieAlert = function(){
		window.alert(cookiesNotSet)
	}

//-----------------------------------------------------//-----------------------------------------------------
//  DART bg Colour setting 
//-----------------------------------------------------//-----------------------------------------------------


 // Loops until body loaded then sets back ground colour
 //-----------------------------------------------------
	setBodyColour = function(colour){
		if(ul_dartBgset) {clearTimeout(ul_dartBgset)}
		if(document.body) {document.body.style.backgroundColor = colour}
		else{ul_dartBgset = setTimeout('setBodyColour("'+colour+'")',100)} 
	}

	swatchColours = new Array('EEEEFF','FFDDFF','FFEEEE','FFFFDD','EEFFEE','DDFFFF','')
	//buttonList = new Array("colourPickBtnImg","bgDART",'incSacleDART',"decSacleDART","resetDART","cSwatchToggle")
	//for( var i = 0; i < swatchColours.length; ++i){buttonList.push('colOpt'+ (i+1))} 
	
//-----------------------------------------------------//-----------------------------------------------------
//  DART Tool Pannel
//-----------------------------------------------------//-----------------------------------------------------
 // parameters 
 //-----------------------------------------------------
	var imageSrc = "/componants/axs/"
	var scaleVal = getCookieVal('scaleVal'); 
	var maxScale = 2.5 , minScale = 1
	var currentScale = 1 , 	scaleStep = 1.125

	
	var cellW = 31, cellH= 31, cellSpace = 1, axToolsOffsetLeft = 500, axToolsOffsetTop = 30  
	var axTopReset = axToolsOffsetTop 
	var swatchW = 244, swatchH = 90
	var cSwatchOffsetTop = 52,  cSwatchOffsetLeft = 10
	var zSwatchOffsetTop = 16,  zSwatchOffsetLeft = cSwatchOffsetLeft + 4*(cellW +cellSpace)
	var alertOffsetTop = 5, alertOffsetLeft = 6 , alertW = 80 , alertH = 15
	var conW = 17, conH = 21, conGap = 2
	
	var conOffsetTop = 2,  conOffsetLeft = 94

	var floatButtonsTop = false, 	floatButtonsLeft = false // float in the page or fix position
	
 // Hide and Show pannel 
 //-----------------------------------------------------
	togglePannel = function(){
		if(axToolsOffsetTop < 0 ){ showPannel() }
		else{ hidePannel()}
	}

	hideOnOpen = function(){
		if( getCookieVal("reLoad") == 1){ showSwatch(); return}
		axToolsOffsetTop = -1 * swatchH * Math.abs(scaleVal)  
		showSwatch()
	}

	hidePannel = function(){
		axToolsOffsetTop = -1 * swatchH * currentScale  
		showSwatch()
	}
	
	showPannel = function(){
		axToolsOffsetTop =  axTopReset  
		showSwatch()
	}	
	
 // Render and Scale pannel 	
 //-----------------------------------------------------
	spaceConButtons = function(){
	 var buttonArray = new Array("popPol",'closePannel')
	 if(!hasPolicy) { document.getElementById("popPol").style.height = 0}
	 for(var i =0; i < buttonArray.length;++i){
		 if(floatButtonsLeft ){document.getElementById(buttonArray[i]).style.left = (axToolsOffsetLeft+ conOffsetLeft + (conW +conGap)* i )*currentScale}
			else{document.getElementById(buttonArray[i]).style.left = axToolsOffsetLeft+(conOffsetLeft + (conW +conGap) * i) * currentScale}
		if(floatButtonsTop ){document.getElementById(buttonArray[i]).style.top = (axToolsOffsetTop + conOffsetTop) * currentScale}
		else {document.getElementById(buttonArray[i]).style.top = axToolsOffsetTop + conOffsetTop * currentScale}
		 }
	}

	spaceZoomButtons = function(){
	 var buttonArray = new Array('incSacleDART',"decSacleDART","resetDART")
	 for(var i =0; i < buttonArray.length;++i){
		 if(floatButtonsLeft ){document.getElementById(buttonArray[i]).style.left = (axToolsOffsetLeft+ zSwatchOffsetLeft + (cellW + cellSpace) * i )*currentScale}
			else{document.getElementById(buttonArray[i]).style.left = axToolsOffsetLeft+(zSwatchOffsetLeft + (cellW + cellSpace)* i) * currentScale}
		if(floatButtonsTop ){document.getElementById(buttonArray[i]).style.top = (axToolsOffsetTop + zSwatchOffsetTop) * currentScale}
		else {document.getElementById(buttonArray[i]).style.top = axToolsOffsetTop + zSwatchOffsetTop * currentScale}
		 }
	}
	
	spaceColButtons = function(){
		 for(var i =0; i < swatchColours.length;++i){
		 if(floatButtonsLeft ){document.getElementById('colOpt'+(1+i)).style.left = (axToolsOffsetLeft+ cSwatchOffsetLeft + (cellW + cellSpace) * i )*currentScale}
			else{document.getElementById('colOpt'+(1+i)).style.left = axToolsOffsetLeft+(cSwatchOffsetLeft + (cellW + cellSpace)* i) * currentScale}
		if(floatButtonsTop ){document.getElementById('colOpt'+(1+i)).style.top = (axToolsOffsetTop + cSwatchOffsetTop) * currentScale}
		else {document.getElementById('colOpt'+(1+i)).style.top = axToolsOffsetTop + cSwatchOffsetTop * currentScale}
		 }
	}
	
	showSwatchBack = function(){
		if(floatButtonsLeft ){document.getElementById('bgDART').style.left = axToolsOffsetLeft *currentScale}
		else{document.getElementById('bgDART').style.left = axToolsOffsetLeft}
		if(floatButtonsTop ){document.getElementById('bgDART').style.top = axToolsOffsetTop * currentScale}
		else {document.getElementById('bgDART').style.top = axToolsOffsetTop}
	}
	
	evalZoomOptions = function(){
		var buttonArray = new Array('incSacleDART',"decSacleDART","resetDART")
		var btnHeight = new Array(0,0,0)
		if( currentScale < maxScale){ btnHeight[0] = 1}
		if( currentScale !=  1 ){ btnHeight[2] = 1}
		if( currentScale > minScale ){ btnHeight[1] = 1}
		for (var i = 0 ; i < buttonArray.length; ++i){document.getElementById(buttonArray[i]).style.height = btnHeight[i]* currentScale * cellH}
	}
	
	setCookieAlert = function(){
		if(floatButtonsLeft ){document.getElementById("cookieAlertDART").style.left = (axToolsOffsetLeft +alertOffsetLeft) *currentScale
		}else{document.getElementById("cookieAlertDART").style.left = axToolsOffsetLeft+alertOffsetLeft*currentScale }
		if(floatButtonsTop ){document.getElementById("cookieAlertDART").style.top = (axToolsOffsetTop +alertOffsetTop) *currentScale}
		else {document.getElementById("cookieAlertDART").style.top = axToolsOffsetTop+alertOffsetTop *currentScale}
		if(navigator.cookieEnabled.toString() == 'true'){	document.getElementById("cookieAlertDART").style.height = 0 }
		else{document.getElementById("cookieAlertDART").style.height = alertH * currentScale}
	}

	showSwatch = function(){
		showSwatchBack()
		spaceColButtons()
		evalZoomOptions()
		spaceZoomButtons()
		setCookieAlert()
		spaceConButtons()
	}	
	
	drawSwatch = function(){
		document.write('</div>')
		var cellW = 31, cellH= 31 
		document.write('<img id="bgDART" src="'+imageSrc+'axs_bg.gif" border="0" style="position:absolute; width:'+swatchW+'px; height:'+swatchH+'px" alt="access tools">')		
		document.write('<a href="javascript:cookieAlert()"> <img id="cookieAlertDART" src="'+imageSrc+'axs_alert.gif" border="0" style="position:absolute; width:'+alertW+'px; height:'+0+'px" alt="cookies not enabled"></a>')		
		document.write('<a href="javascript:incScale()"> <img id="incSacleDART" src="'+imageSrc+'axs_zoom_in_on.jpg" border="0" style="position:absolute;  width:'+cellW+'px; height:'+0+'px" alt="enlarge size"></a>')		
		document.write('<a href="javascript:decScale()"><img id="decSacleDART" src="'+imageSrc+'axs_zoom_out_on.jpg" border="0" style="position:absolute; width:'+cellW+'px; height:'+0+'px" alt="reduce size"></a>')		
		document.write('<a href="javascript:resetScale()"><img id="resetDART" src="'+imageSrc+'axs_zoom0_on.jpg" border="0" style="position:absolute; width:'+cellW+'px; height:'+0+'px" alt="default size"></a>')		

		for(var i=0; i< swatchColours.length; ++i){
			if (i < swatchColours.length-1){
				altTag = "display colour option" +i 
				document.write('<a href="javascript:setDARTbg('+"'"+swatchColours[i]+"'"+')"><img id="colOpt'+(1+i)+'" style="position:absolute; cursor:hand; background-color:'+swatchColours[i]+'; width:'+cellW+'px; height:'+cellH+'px"  src="'+imageSrc+'axs_box.gif" border="0" alt="'+altTag+'" ></a>')
			}else{ 
				altTag = "default colour option"
				document.write('<a href="javascript:setDARTbg('+"'"+swatchColours[i]+"'"+')"><img id="colOpt'+(1+i)+'" style="position:absolute; cursor:hand;  width:'+cellW+'px; height:'+cellH+'px"  src="'+imageSrc+'axs_box.gif" border="0" alt="'+altTag+'" ></a>')
			}
		}
		document.write('<a href="javascript:hidePannel()"><img id="closePannel" src="'+imageSrc+'axs_close.jpg"  border="0" style="position:absolute; width:'+conW+'px; height:'+conH+'px" alt="close access tool pannel"></a>')				
		document.write('<a href="javascript:popPol()"><img id="popPol" src="'+imageSrc+'axs_info.jpg"   border="0" style="position:absolute; width:'+conW+'px; height:'+conH+'px" alt="access policy"></a>')				
		var colourVal = getCookieVal('bgColour'); 
		if(colourVal!= -1) { ul_dartBgset = setTimeout('setBodyColour("'+colourVal+'")',100)}
		reLoadVal = getCookieVal('reLoad')
		showSwatch()
		if(reLoadVal == -1){hideOnOpen()}
		setReload(-1)
		document.write('<div>')
	}

	drawSwatch()
	
//------------------------//---------------------------
//  DART Scale setting 
//------------------------//---------------------------
	var doScale = new Array("px","pt","em")
	var isDOM = document.defaultView && document.defaultView.getComputedStyle
	var isIE = document.body.currentStyle


	isBlockElement = function( eL){
		for(var i = 0; i < blockElement.length;++i){
			if(eL == blockElement[i]){return true}
		}
		return false
	}

	shouldScale = function(unit){
		unit = unit.toLowerCase()
		for(var i = 0; i < doScale.length;++i){
			if(unit == doScale[i]){return true}
		}
		return false
	}

	valUnit = function(vU, scale, floorIt){
	    vU = vU + ''
	    v = parseFloat(vU)
		if(v == 'NaN'){return vU}
		vStr = v+''
		u = vU.substr(vStr.length)
		if(u=='em'){return v*scale*12 +'pt'}
		if(shouldScale(u)){	
			if(floorIt){return Math.floor(v*scale) + u}
			else{return v*scale + u}
			}
		else{ return vU}
	}

	incScale = function(){ 
		if(scaleVal== -1) { 
			scaleBy(1)
			scaleTo( scaleStep)}	
		else{ scaleTo( scaleStep)}	
		}
	
	
	decScale = function(){ 
		if(scaleVal== -1) { scaleBy(1)}	
		setScaleCookie(1/scaleStep)
	    //scaleTo( 1/scaleStep)
		setReload(1)
		window.location.reload()
	}
	
	resetScale = function (){ 
		setScaleCookie(-1)
		setReload(1)
		window.location.reload()
		}
	
	scaleTo = function(scale){	scaleBy(scale)	}
	
	
	scaleBy = function(scale){
		if(isIE ||isDOM ){
			treeNodes(document.documentElement,scale)
			setScaleCookie(scale)
		}
	}	
	
   

    
//------------------------------------/---------------------------------------    
//  Tree spanning and object scaling    
//------------------------------------/---------------------------------------        
    var terminalNode =  new Array('HEAD','SCRIPT','BR')
    var terminalNodes = terminalNode.length
    var fontSizesToPt = new Array(8,8,10,12,14,18,24,36)

    var scaleableNode =  new Array('BODY','DIV','TABLE','SPAN','A','P','IMG','FONT','H1','H2','H3','H4')
    var scaleableNodes = scaleableNode.length
    
    var scaleElement = false
   

	params = new Array()
	getParams = function(elObj){
    
	    if(isDOM){ 		
			comStyleObj = document.defaultView.getComputedStyle(elObj, "")	
			if(!comStyleObj){return}
			params[0] = comStyleObj.getPropertyValue("font-size")
			params[1] = comStyleObj.getPropertyValue("width")
			params[2] = comStyleObj.getPropertyValue("height")
			}
	
		if(isIE) { 
		 	params[0] = elObj.currentStyle.fontSize
		 		if(elObj.nodeName == "FONT") {
		 		var fs = parseInt(elObj.currentStyle.fontSize)
		 		if(fs == elObj.currentStyle.fontSize){
		 			if(fs > 0 && fs < 8){ params[0] = fontSizesToPt[fs] +'pt' }
		 			else{params[0] = elObj.currentStyle.fontSize *5 + 'pt'}
		 			}	
		 	}
 	
		 	
			params[1] = elObj.currentStyle.width
			if(params[1].indexOf("%")!= -1){params[1]=elObj.offsetWidth} 
			params[2] = elObj.currentStyle.height
		}


/*	if(isIE) { 
		 	params[0] = elObj.currentStyle.fontSize
			params[1] = elObj.currentStyle.width
			if(params[1].indexOf("%")!= -1){params[1]=elObj.offsetWidth} 
			params[2] = elObj.currentStyle.height
		}*/
	}	


    scaleIt = function(node,scale,nodeName){
       getParams(node)
       node.style.fontSize = valUnit(params[0],scale,false)
       node.style.width = valUnit(params[1],scale,false)
	   node.style.height = valUnit(params[2],scale,false)
    }
    
    isScalable = function(nodeName){
        nodeName = nodeName.toUpperCase()  
         for( isSci = 0;isSci <scaleableNodes; ++isSci){
            if( nodeName == scaleableNode[isSci]){ return true  }
        }     
        return false
    }
    
    examineAttribs = function(node,scale){
        if(isScalable(node.nodeName)){ scaleIt(node,scale,node.nodeName) }
        return node.nodeName    
    }   
    
    isNotTerminal = function(nodeName){
         nodeName = nodeName.toUpperCase()  
         for( isNTi = 0;isNTi <terminalNodes; ++isNTi){
            if( nodeName == terminalNode[isNTi]){ return false   }
        }
        return true
    }
    
    treeNodes = function(node,scale){
        var nList = node.childNodes.length
        for(var i = 0; i < nList; ++i){   
            if(isNotTerminal(examineAttribs(node.childNodes[i],scale))){treeNodes(node.childNodes[i],scale)}
        }
    }

//------------------------------------/---------------------------------------    
// as is last section to load can do without timeouts
	if(scaleVal!= -1) {
		scaleBy(1)
		scaleBy(scaleVal)
	}	
//		ul_dartScaleSet = setTimeout('scaleBy(1)',500)
//		ul_dartScaleSet = setTimeout('scaleBy('+scaleVal+')',1000)}	



//------------------------------------/---------------------------------------    
//  Google Analytics tracking code   
//------------------------------------/---------------------------------------   

_uacct = "UA-2620145-11";
urchinTracker();
//------------------------------------/---------------------------------------  
