// JavaScript Document

window.onload = function() {


	if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) {

		var menuList = document.getElementById("menuSub");

		for(var node = menuList.firstChild; node; node = node.nextSibling) {

	
			node.firstChild.onmouseover = over;
				
			node.firstChild.onmouseout = out;
			
		}
		
		function over() {
			if(this.className == "menuItemRefer iePNG") {
				this.style.background = "url(fileadmin/templates/images/referBcgrSub.jpg) 3px 2px no-repeat";
			}
			
		}
		/**/
		function out() {
			if(this.className == "menuItemRefer iePNG") {
				this.style.background = "none";
			}
		}
		
		
		
		
		
		
		
		
	}

	
/*	function centerPage(id) {
		alert(window.navigator.appVersion);
		var mainWrapper = document.getElementById(id);
		
		if(document.body.clientWidth) {
			var windowWidth = document.body.clientWidth;
			alert("document.body.clientWidth");
			alert(windowWidth);
		}
		else if(document.innerWidth) {
			var windowWidth = document.innerWidth;
			alert("document.innerWidth");
			alert(windowWidth);
		}
		
		if(window.navigator.appName.indexOf("Internet Explorer") != -1) {
//			if() {
//				var isIE
//			}
			
			alert(window.navigator.appVersion);
			
			with(window.navigator) {
				alert(appVersion);
			}
		}
		
		
		
		
	}
	
	centerPage("container");
*/	
}

function swapImage(element) {
	if(window.navigator.appName.indexOf("Internet Explorer") != -1) {
		
		var image = element.firstChild;
		
		var oldSrc = image.getAttribute("src");
		var pathPattern = /(.*)?\/([\w]*)?(\.(png|jpg|jpeg|gif))/i;
		var matches = oldSrc.match(pathPattern);
		var fileName = matches[2];
		var newSrc = matches[1] + "/" + matches[2].replace(/passive/, "active") + matches[3];
		image.setAttribute("src", newSrc)
	}
	else {
		var image = element.firstChild;
		var oldSrc = image.getAttribute("src");
		var pathPattern = /((?:[\.{0,2}-]*\w*\/)*)([\w]*)(\.[\w]*)/i;
		var matches = oldSrc.match(pathPattern);
		var fileName = matches[2];
		var newSrc = matches[1] + matches[2].replace(/passive/, "active") + matches[3];
		image.setAttribute("src", newSrc);
	}
}

function swapAgain(element) {
	if(window.navigator.appName.indexOf("Internet Explorer") != -1) {
		var image = element.firstChild;
		var oldSrc = image.getAttribute("src");
		var pathPattern = /(.*)?\/([\w]*)?(\.(png|jpg|jpeg|gif))/i;
		var matches = oldSrc.match(pathPattern);
		var fileName = matches[2];
		var newSrc = matches[1] + "/" + matches[2].replace(/active/, "passive") + matches[3];
		image.setAttribute("src", newSrc);
		
	}
	else {
		var image = element.firstChild;
		var oldSrc = image.getAttribute("src");
		var pathPattern = /((?:[\.{0,2}-]*\w*\/)*)([\w]*)(\.[\w]*)/i;
		var matches = oldSrc.match(pathPattern);
		var fileName = matches[2];
		var newSrc = matches[1] + matches[2].replace(/active/, "passive") + matches[3];
		image.setAttribute("src", newSrc);
		
	}
	
	
}	

