 function SetUsertype(type){
    /* on click the script appends the image to the exiting elements whose id is footer.*/
    var footerdiv = document.getElementById("footer");
    var url = "http://wwwtest9.waikato.ac.nz/cgi-bin/uwaat-tracking.pl";
        url = url+"?"+type;
    var userTypeImg = document.createElement("img");
        userTypeImg.setAttribute("src", url);
        userTypeImg.setAttribute("alt", "");
        footerdiv.appendChild(userTypeImg);
    }  

function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, true);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 }
}

function searchState(state) {

	var searchBox = document.getElementById('search');

	var emptyRegEx = /^\s*$/i; // if is empty or just spaces	

	if (state == "blur") {
	

	
		if (searchBox.value.match(emptyRegEx)) {
		
			searchBox.value = "Search";
			searchBox.style.color = "#999"; 
		
		} 
	}
    else if (state == 'focus') {
	
		var searchRegExp = /^Search$/;
	
		
		if (searchBox.value.match(searchRegExp)){
		
			searchBox.style.color = "#333";
			searchBox.value = "";
		
		} 
	
	
	
	}
	else {
	}

}


  
	// Highlight function for browser icons
	function hl(id, mode) {
	
		(mode == 1) ? document.getElementById(id).style.borderBottom = '3px solid #c00' : document.getElementById(id).style.border = 'none';
	
	}

	// if user clicks 'close' on less than ie 6 msg then update cookie, so it remains closed
	// on other pages and hide div msg.
	function hideLtie7(state) {

		// if user clicked the x then set state 
		document.cookie='UOW_ltie7='+state;
	    document.getElementById('ltie7Wrapper').style.display = 'none';
	
    }
	
	// Reads less than ie 6 cookie and returns bool
	function getState() {

		  var search = 'UOW_ltie7=';
		  var returnvalue = '';	  
		  if (document.cookie.length > 0) {
			offset = document.cookie.indexOf(search)
			// if cookie exists
			if (offset != -1) { 
			  offset += search.length
			  // set index of beginning of value
			  end = document.cookie.indexOf(';', offset);
			  // set index of end of cookie value
			  if (end == -1) end = document.cookie.length;
			  returnvalue=unescape(document.cookie.substring(offset, end))
			  }
		   }	
		return returnvalue;
	}
	
	// main function for less than ie6, check cookie and shows of hides msg as needed
	function checkLtie7State2() {
	
	
	if(document.getElementById('ltie7Wrapper') != null ) {
	
		(getState() != 1) ? document.getElementById('ltie7Wrapper').style.display = 'block' : document.getElementById('ltie7Wrapper').style.display = 'none';
		
		} else { return false;}

	}	
	

  
 
    var $k = jQuery.noConflict();
    $k(document).ready(function(){ 
        $k("ul.menu").superfish({
            delay:       300,
            animation:   {height:'show'},
            speed:       'fast' 
	});
    })
    addEvent(window, 'load', function() {
	checkLtie7State2();
    })

