function gameExit(){
	location.href="/game/index.php";
}
function GetCookie(key){
	var tmp = document.cookie + ";";
	var index1 = tmp.indexOf(key, 0);
	if(index1 != -1){
		tmp = tmp.substring(index1,tmp.length);
		var index2 = tmp.indexOf("=",0) + 1;
		var index3 = tmp.indexOf(";",index2);
		return(unescape(tmp.substring(index2,index3)));
	}
	return("");
}
function SetCookie(key,val,expire){
	document.cookie = key + "=" + escape(val) + ";expires="+expire+";";
}
Array.prototype.shuffle = function() {
	var i = this.length;
	while(i){
		var j = Math.floor(Math.random()*i);
		var t = this[--i];
		this[i] = this[j];
		this[j] = t;
	}
	return this;
}
//回転禁止(むりっぽいが取得だけなら可能なのでアラートを出してみた）
window.onorientationchange = function () {
    switch ( window.orientation ) {
        case 0:
            break;
        case 90:
					alert('画面を縦にしてください');
					window.orientation = 0;
          break;
        case -90:
					alert('画面を縦にしてください');
					window.orientation = 0;
          break;
		}
}
function createHttpRequest(){
	if(window.XMLHttpRequest){
		return new XMLHttpRequest();
	}else if(window.ActiveXObject){
		try{
			return new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				return new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e2){
				return null;
			}
		}
	}
}
function pr_pname(pname){
	if(pname == ""){
		pname = GetCookie("username");
	}
	if(pname == "" || pname == null || pname == undefined || pname == "null"){
		pname = "guest";
	}else{
		SetCookie("username", pname,"Fri, 31-Dec-2030 23:59:59");
	}
	return pname;
}