// ---------------------- OnLoad  ----------------------

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

// ---------------------- RollOverScript ----------------------

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}



// ---------------------- sidemenu switch ----------------------

function sidemenu_switch_cms(btnId){	
	var btname = btnId;
	if(document.images[btname].src.match("_off.")){
		var herenum = document.images[btname].src.replace("_off.", "_stay.");
		document.images[btname].src = herenum;
	}else{
		return null;
	}
	
}



// ---------------------- footer switch ----------------------

function text_switch(linkId){
	var targetStr = linkId;
	var targetElem = document.getElementById(targetStr);
	if(targetElem){
		targetElem.style.color = "#7F0019";
	}else{
		return false;
	}
}


