/**  OS/ブラウザ/version 判定  **/
var myOS='';
var myBrowser='';
var myBrowserVersion='';

myAgent = navigator.userAgent;
if (myAgent.indexOf("Win") >=0) myOS='Win';
if (myAgent.indexOf("Mac") >=0) myOS='Mac';

if (myAgent.match(/Firefox\/(\d.\d)/)) {
    myBrowser = 'FF';myBrowserVersion=RegExp.$1;
}
else if (myAgent.match(/MSIE (\d.\d)/)) {
    myBrowser = 'IE';myBrowserVersion=RegExp.$1;
}
else if( window.opera ) myBrowser = 'OP';


/** ime mode 制御 **/
function set_ime_mode(arr) {
	if (myBrowser != 'IE') return;
    for(i=0;i<arr.length;i++) {
        list = arr[i].split(":");
        if (document.getElementById(list[0])) document.getElementById(list[0]).style.imeMode=list[1];
    }
}


/** 要素アクセス **/
function $N(name) { return document.getElementsByName(name)[0]; }


/** レイヤー **/
var Layers= {
	id:0,
	add: function(offsetX,offsetY,x,y,opa,obj) {
		this.div_obj= document.createElement('div')
		this.div_obj.id='_lay_div_id'+this.id;this.id++;
		this.div_obj.style.position="absolute";
		this.div_obj.style.left=offsetX+'px';
		this.div_obj.style.top=offsetY+'px';
		if (x==0) 
			this.div_obj.style.width=document.width+'px';
		else
			this.div_obj.style.width=x+'px';
		this.div_obj.style.height=y+'px';
		this.div_obj.appendChild(obj);
		this.div_obj.style.backgroundColor="#fff";
		switch (myBrowser) {
		case 'FF':
			this.div_obj.style.MozOpacity=opa;
			break;
		case 'IE':
			this.div_obj.style.filter='Alpha(opacity='+(opa*100)+')';
			break;
		}
		document.body.appendChild(this.div_obj);
		return this;
	}
	,appear: function() {
	}
	,disappear: function(id) {
		document.getElementById('_lay_div_id'+id).style.display='none';
	}
}


/** cookie **/
function getCookie(key) {
	tmp1 = " " + document.cookie + ";";
	xx1 = xx2 = 0;
	len = tmp1.length;
	while (xx1 < len) {
		xx2 = tmp1.indexOf(";", xx1);
		tmp2 = tmp1.substring(xx1 + 1, xx2);
		xx3 = tmp2.indexOf("=");
		if (tmp2.substring(0, xx3) == key) {
			return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
		}

		xx1 = xx2 + 1;
	}
	return("");
}


function setCookie(key, val, path) {
	tmp = key + "=" + escape(val) + "; ";
	// tmp += "path=" + location.pathname + "; ";
	tmp += "path=/;"
	tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
	document.cookie = tmp;
}

function clearCookie(key) {
	document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}




/** 最初のinput textにfocus()する **/
var oldonload = window.onload;
/*
window.onload = function() {
    if (typeof oldonload == 'function') { oldonload(); }

    tag_arr = document.getElementsByTagName('input');
    for(i=0;i<tag_arr.length;i++) {
        if (tag_arr[i].getAttribute('type')=='text') {
            tag_arr[i].focus();
            break;
        }
    }
}
*/
