//// ws web design.
//// JavaScript Code Library "1006"

// STYLESHEET & BROWSER CHECK
var ua = navigator.userAgent;
var na = navigator.appName;
var ve = navigator.appVersion;

var Win = (ua.indexOf ("Win") != -1);
var Mac = (ua.indexOf ("Mac") != -1);
var Explorer = (na.indexOf ("Explorer") != -1);
var Netscape= (na.indexOf ("Netscape") != -1);
var Opera = (ua.indexOf ("Opera") != -1);
var Safari = (ua.indexOf ("Safari") != -1);

if (Explorer) {
    if (ua.indexOf ("MSIE 3") != -1) { var Version = "3"; }
    else if (ua.indexOf ("MSIE 4") != -1) { var Version = "4"; }
    else if (ua.indexOf ("MSIE 5") != -1) { var Version = "5"; }
    else if (ua.indexOf ("MSIE 7") != -1) { var Version = "7"; }
    else { var Version = "6"; }
} else {
    var Version = ve.charAt(0);
}

if (Safari) { type = "mac_sf"; }
else if (Mac && Opera && Version == "5") { type = "error"; }
else if (Opera) { type = "pixel"; }
else if (Win && Explorer && Version == "6") { type = "win_ie6"; }
else if (Win && Explorer && Version != "6") { type = "error"; }
else if (Win && Netscape && Version == "4") { type = "error"; }
else if (Mac && Explorer && Version != "5" && Version != "6") { type = "error"; }
else if (Mac && Explorer && Version == "5") { type = "keyword"; }
else if (Mac && Explorer && Version == "6") { type = "keyword"; }
else if (Mac && Netscape && Version == "5") { type = "keyword"; }
else if (Mac && Netscape && Version == "4") { type = "error"; }
else { type = "pixel" }

path = "";
pn = window.location.pathname;
pn = pn.substr (1);
pn = pn.split ("/");
p = pn.length - 1;
for (i=0; i<p; i++) {
    path += "../";
}

// ERROR
// if (type == "error") { location.href = path + type + ".htm"; }
path += "css/";

// LAYOUT CSS
// if (Win) {
//         document.write ("<link rel=\"stylesheet\" href=\"" + path + "set_v1.css\" type=\"text/css\" media=\"screen,print\">");
// } else {
//         document.write ("<link rel=\"stylesheet\" href=\"" + path + "set_v1.css\" type=\"text/css\" media=\"screen,print\">");
// }
// ブラウザ別 CSS
// document.write ("<link rel=\"stylesheet\" href=\"" + path + type + ".css\" type=\"text/css\" media=\"screen,print\">");
// PRINT CSS
// if (Win) {
//     document.write ("<link rel=\"stylesheet\" href=\"" + path + "win_print.css\" type=\"text/css\" media=\"print\">");
// }



//// ロールオーバーイメージ
function rollover(){
	var imgTag = document.getElementsByTagName("img");
	for (var i=0; i<imgTag.length; i++){
	
		if(imgTag[i].className == "clickable"){
			imgTag[i].onmouseover = function(){
				this.src = this.src.split(".gif")[0]+"_over.gif";
			}
			imgTag[i].onmouseout = function(){
				this.src = this.src.split("_over.gif")[0]+".gif";
			}
		}
	
		if(imgTag[i].className == "clickablePng"){
			imgTag[i].onmouseover = function(){
				this.src = this.src.split(".png")[0]+"_over.png";
			}
			imgTag[i].onmouseout = function(){
				this.src = this.src.split("_over.png")[0]+".png";
			}
		}
	}
	var inputTag = document.getElementsByTagName("input");
	for (var i=0; i<inputTag.length; i++){

		if(inputTag[i].className.match(/clickable/)){
			inputTag[i].onmouseover = function(){
				this.src = this.src.split(".gif")[0]+"_over.gif";
			}
			inputTag[i].onmouseout = function(){
				this.src = this.src.split("_over.gif")[0]+".gif";
			}
		}
	}
}

var items = new Array();
items[items.length] = rollover;

window.onload = function() { for (var i in items) items[i]() }

