var load = 0;
var on   = new Array();
var off  = new Array();
var flag = new Array();

function init(){
	load = 1;
	var imgs = document.getElementsByTagName('img');
	for(var i=0; i<imgs.length; i++){
		var id = imgs[i].getAttribute('id');
		if(id){
			on[id]   = new Image();
			off[id]  = new Image();
			off[id].src = imgs[i].getAttribute('src');
			on[id].src  = imgs[i].getAttribute('src').replace(/_off/, "_on");
		}
	}
	var inputs =  document.getElementsByTagName('input');
	for(var j=0; j<inputs.length; j++){
		if(inputs[j].getAttribute('type') == 'image'){
			var id = inputs[j].getAttribute('id');
			if(id){
				on[id]   = new Image();
				off[id]  = new Image();
				off[id].src  = inputs[j].getAttribute('src');
				on[id].src   = inputs[j].getAttribute('src').replace(/_off/, "_on");
			}
		}
	}
	if(navigator.platform == "MacPPC"){
		if(navigator.userAgent.indexOf("Netscape") != -1 || navigator.userAgent.indexOf("Firefox") != -1){
			document.body.style.fontSize = '85%';
		}
	}

}

function onImage(id){
	if(load){
		document.getElementById(id).src = on[id].src;
	}
}
function offImage(id){
	if(load){
		if(id){
			document.getElementById(id).src = off[id].src;
		}else{
			for(name in off){
				offImage(name);
			}
		}
	}
}

function windowOpen(url,target,width,height){

	if(self.innerHeight) {
		height += 2;
		if(navigator.platform == "MacPPC"){
			height += 10;
			if(navigator.userAgent.indexOf("Safari") != -1){
				height += 50;
			}
		}
	}

	/*@cc_on @*/ 
	/*@if ( @_jscript ) { 
		if(navigator.platform == "MacPPC"){
			height -= 10;
			width -= 10;
		}
	} 
	/*@end @*/ 

	target = (target) ? target : '_blank';
	size   = (width)  ? ',width=' + width : '';
	size  += (height) ? ',height=' + height : '';
	var win = window.open(url,target,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes" + size);

	/*@cc_on @*/ 
	/*@if ( @_jscript ) { 
	//	if(win.document.compatMode){
	//		var w = (win.document.compatMode == 'CSS1Compat') ? win.document.documentElement.clientWidth : win.document.body.clientWidth;
	//		var h = (win.document.compatMode == 'CSS1Compat') ? win.document.documentElement.clientHeight : win.document.body.clientHeight;
	//		if (width!=w || height!=h){
	//			win.resizeBy((width-w),(height-h));
	//		}
	//		// スクロールバー対策でもう一回
	//		w = (win.document.compatMode == 'CSS1Compat') ? win.document.documentElement.clientWidth : win.document.body.clientWidth;
	//		h = (win.document.compatMode == 'CSS1Compat') ? win.document.documentElement.clientHeight : win.document.body.clientHeight;
	//		if (width!=w || height!=h){
	//			win.resizeBy((width-w),(height-h));
	//		}
	//	}
	} 
	/*@end @*/ 

	win.focus();

}
function windowOpenFix(url,target,width,height){
	target = (target) ? target : '_blank';
	size   = (width)  ? ',width=' + width : '';
	size  += (height) ? ',height=' + height : '';
	var winfix = window.open(url,target,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no" + size);
	winfix.focus();
}
