﻿//open window
var openwin = new Array() ;
function MM_openBrWindow(theURL,winName,features) { //v2.0
  var own = winName ;
  openwin[own]=window.open(theURL,winName,features);
  openwin[own].focus();
}
//open window (Center) 
 function openWinCenter(url,id,w,h,scrollFlag) {
	
	x = (screen.width - w) / 2;
	y = (screen.height - h) / 2;
	
	if(scrollFlag){
	
		//スクロールバーがいる時
		
		if(navigator.appName== "Microsoft Internet Explorer"){ 
		
			//IEの場合のみスクロールバーの幅を足す　メイビー16px
			
			w=w+16;
			
		}
		
		window.open(url,id,"screenX="+x+",screenY="+y+",left="+x+",top="+y+",width="+w+",height="+h+",scrollbars=yes");
		
	}else{
	
		//スクロールバーがいらない時
	
		window.open(url,id,"screenX="+x+",screenY="+y+",left="+x+",top="+y+",width="+w+",height="+h+",scrollbars=no");
	
	}
	
}

//Rollover img change
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."));  
                 }  
            }  
         }  
     }  
 }  


//inputAreaColor
function inputAreaColor() {
	var inputAreaID="SS_searchQuery";
	var inputStr="入力してください";
	var OnColor="#000000";
	var OffColor="#999999";
	var OnBgColor="#FFFFFF";
	var OffBgColor="#e1e1e1";
	if(document.getElementById(inputAreaID)) {
	 
		//initialize
		document.getElementById(inputAreaID).value=inputStr;
		document.getElementById(inputAreaID).style.color=OffColor;
		document.getElementById(inputAreaID).style.backgroundColor=OffBgColor;
		
		//onfocus
		document.getElementById(inputAreaID).onfocus =function() {
			if(this.value==inputStr){
				this.value='';
			}
			this.style.color=OnColor;
			this.style.backgroundColor=OnBgColor;
		}
		
		//onblur
		document.getElementById(inputAreaID).onblur =function() {
		this.style.backgroundColor=OnBgColor;
			if(this.value==''){
				this.value=inputStr;
				this.style.color=OffColor;
				this.style.backgroundColor=OffBgColor;
			}else{
				this.style.color=OnColor;
				this.style.backgroundColor=OnBgColor;
			}
		}
	}
}



function smartSelect(){
		if(document.getElementById("selectmenu")) {
			document.getElementById("selectmenu").style.width ='180px';
	}
}


function findTable() {
var parentTagName ="table";
var parentClassName ="zebraTable";
var childsTagName ="tr";
if (!document.getElementsByTagName) return;
var elements = document.getElementsByTagName(parentTagName);
	for (var i = 0, len = elements.length; i < len; i++) {
		if(elements[i].className.match(parentClassName)){ 
		var childs = document.getElementsByTagName(childsTagName);
			for (var n = 0, childslen = childs.length; n < childslen; n++) {
						if((n % 2) == 0){
									childs[n].className += ' odd';
					}else{
									childs[n].className += ' even';
				}
			}
		}
	}
}




if (window.addEventListener) {
window.addEventListener("load", smartRollover, false);
window.addEventListener("load", inputAreaColor, false);
window.addEventListener("load", smartSelect, false);
window.addEventListener("load", findTable, false);
}
if (window.attachEvent) {
window.attachEvent("onload", smartRollover);
window.attachEvent("onload", inputAreaColor);
window.attachEvent("onload", smartSelect);
window.attachEvent("onload", findTable);
}



