// 初期設定
function firstInit () {
    imgArray = firstInit.arguments;
    overImg = new Array ();
    
    for (i=0; i<(imgArray.length); i++) {
        overImg[i] = new Image().src = imgArray[i];
    }
}

// ロールオーバー処理
function changeImages (imgId, imgSrc) {
    if (document.getElementById) {
        document.getElementById(imgId).src = imgSrc;
    }
}

// ポップアップ
function popWin (path,addPath,w,h) {
    popwin = window.open(path + "js/pop.html?addPath=" + addPath + "","pop","width=" + w + ", height=" + h + ", toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no");
    wx = w;
    wy = h;
    x  = (screen.availWidth -  wx) / 2;
    y  = (screen.availHeight - wy) / 2;
    popwin.moveTo(x,y);
}

// ポップアップ画面描画
function popWrite () {
    var add = window.location.search.split ("=");
    document.write ("<a href=\"javascript:window.close ();\"><img src=\"" + add[1] + "\" alt=\"\" /></a>\n");
}

// レイヤー表示
function showLayer (layerId) {
    if (document.getElementById) {
        document.getElementById(layerId).style.visibility = "visible";
    }
}

// レイヤー非表示
function hideLayer (layerId) {
    if (document.getElementById) {
        document.getElementById(layerId).style.visibility = "hidden";
    }
}


//クッキー
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}



//フォントサイズ

function change_size( ratio ) {
	if ( 40 < parseInt( def_size ) && parseInt( ratio ) < 0 ) {
		def_size = parseInt( def_size ) + parseInt( ratio );
	}
	if ( 0 < parseInt( ratio ) && parseInt( def_size ) < 250 ) {
		def_size = parseInt( def_size ) + parseInt( ratio );
	}
	document.body.style.fontSize = def_size + '%';
}

/* for event ------------------------------------------------------------------*/

var cookie;
var title;
var def_size;
var ratio;

window.onload = function(e) {
	cookie   = readCookie("fontSize");
	def_size = cookie ? cookie : 100;
/*	change_size ( 0 );*/
	cookie    = readCookie("style");
	title = cookie ? cookie : 'standard';

/*	setActiveStyleSheet(title);*/

}

window.onunload = function(e) {
/*
	title = getActiveStyleSheet();
	createCookie("style", title, 365);
	createCookie("fontSize", def_size, 365);
*/
}
