//ロールオーバー
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//キャラナビFlash on Flash
function loadStaticFlash() {
	var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="602" height="180">';
	str += '<param name=movie value="top.swf">';
	str += '              <param name=quality value=high><PARAM NAME=wmode VALUE=transparent>';
	str += '              <embed src="top.swf" wmode=transparent quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="602" height="180">';
	str += '              </embed></object>';
	var staticDiv = document.getElementById("staticContentFlash");
	staticDiv.innerHTML = str;
	//alert(str);
}


//ポップアップ
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


/*photocanvas*/
function photocanvas(){
	NewWin=window.open("http://www.cdn-tera.co.jp/recruit/photocanvas/index.html","photocanvas",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=740,height=550');
}

/*nenga*/
function nengawinopen(){
    var NewWin = window.open("nenga/index.html",
                    "nenga",
                    'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=950,height=650');
    NewWin.moveTo(window.screen.availWidth/2 - (1024/2) ,window.screen.availHeight/2 - 369)
    NewWin.focus();
}


//フルスクリーン
// --- vvv --- Which your Browser --- vvv ---
var myBrowser;
if(navigator.platform){
	myBrowser=new myBrowser((document.getElementById != null),(navigator.platform.indexOf('Win32') != -1),(navigator.appName.indexOf('Microsoft') != -1));
}
function myBrowser(version,platform,type){
	this.version=version;	//trueかfalse,DOM使用可能ブラウザ(IE4以上,NN6以上)ならtrue
	this.platform=platform;	//trueかfalse,Win32ならtrue
	this.type=type;		//trueかfalse,IEならtrue
}
// --- ^^^ --- Which your Browser --- ^^^ ---
//--------------モニタ解像度に合わせてフルスクリーンでウィンドウを開きます。
function openOutputFullScr(myUrl){

	//if(MM_FlashCanPlay){//Flash Player Ver.6を持っていればウィンドウを開く

		//var myUrl = "index.html";

		if(myBrowser.type){ //IEの場合
			if(myBrowser.platform){ //WIN IEの場合
				var thisWinWidth=screen.width;
				var thisWinHeight=screen.availHeight;
				newwin=window.open(myUrl,"_blank","scrollbars=0,resizable=no,location=no,menubar=no,status=no,left=0,top=0");
				newwin.resizeTo(thisWinWidth,thisWinHeight);
			}
			else{ //Mac IEの場合
				var thisWinWidth=screen.width-12;
				var thisWinHeight=screen.availHeight;
				newwin=window.open(myUrl,"_blank","scrollbars=0,resizable=no,location=no,menubar=no,status=no,left=0,top=0");
				newwin.resizeTo(thisWinWidth,thisWinHeight);
			}
		}
		else{

			if( navigator.userAgent.indexOf("Safari") != -1){
				//Safari
				var thisWinWidth=screen.width;
				var thisWinHeight=screen.height-46;
				window_size = "width=" + thisWinWidth + ",height=" + thisWinHeight +",innerWidth=" + thisWinWidth + ",innerHeight=" + thisWinHeight;
				newwin=window.open(myUrl,"_blank","scrollbars=0,resizable=no,location=no,menubar=no,status=no," + window_size);
				newwin.moveTo(0,0);
				
			}else{
				//NS
				var thisWinWidth=screen.availWidth-12;
				var thisWinHeight=screen.availHeight-30;
				window_size = "width=" + thisWinWidth + ",height=" + thisWinHeight +",innerWidth=" + thisWinWidth + ",innerHeight=" + thisWinHeight;
			newwin=window.open(myUrl,"_blank","scrollbars=0,resizable=no,location=no,menubar=no,status=no," + window_size);
				newwin.moveTo(0,0);
			}
		}
	}
	
	function getWindowHeight(){
		if(usr.Mac && (usr.checkObj == 1 || usr.OPERA)){
			return window.innerHeight;
		}else if(usr.Win && usr.checkObj == 1){
			return window.innerHeight - 16;
		}else if(usr.checkObj == 4){
			return window.innerHeight - 15;
		}else if(usr.OPERA || usr.checkObj == 2 || usr.checkObj == 3){
			return d.body.clientHeight;
		}
	}

	function getWindowXOffset(){
		if(usr.checkObj == 2 || usr.checkObj == 3){
			return d.body.scrollLeft;
		}else if(usr.checkObj == 1 || usr.checkObj == 4){
			return window.pageXOffset;
		}
	}
	function getWindowYOffset(){
		if(usr.checkObj == 2 || usr.checkObj == 3){
			return d.body.scrollTop;
		}else if(usr.checkObj == 1 || usr.checkObj == 4){
			return window.pageYOffset;
		}
	}

	function getDocHeight(){
		if(usr.checkObj == 1){
			return getTagTop('end') + 1;
		}else if(usr.checkObj == 2 || usr.checkObj == 3 || usr.checkObj == 4){
			return getTagTop('end');
		}
	}

	function getDistanceMaxY(){
		if(usr.allObj){
			return (getDocHeight() - getWindowHeight());
		}
	}

	function setObj(idName){
		return d.all ? d.all(idName) : d.getElementById ? d.getElementById(idName) : d.layers[idName];
	}

	function getTagTop(idName) {
		var obj = setObj(idName);
		var tagCoords = new Object();

		if((usr.checkObj == 2) || (usr.checkObj == 3) || (usr.checkObj == 4)) {
			tagCoords.y = obj.offsetTop;
			while ((obj = obj.offsetParent) != null) {
				tagCoords.y += obj.offsetTop;
			}if(usr.Mac && usr.Moz){
				return tagCoords.y - 12;
			}else if((usr.Win && usr.Moz) || (usr.Mac && usr.SAFARI)){
				return tagCoords.y - 9;
			}else{
				return tagCoords.y;
			}
		} else if(usr.checkObj == 1) {
			tagCoords.y = d.anchors[idName].y;
			return tagCoords.y;
		}return idName;
	}

	/*PageScroller*/
	var pageScrollTimer;
	function pageScroll(toX,toY,frms,frX,frY) {
		if(pageScrollTimer) clearTimeout(pageScrollTimer);
		var spd = usr.Mac ? 14 :16;
		var actX = getWindowXOffset();
		var actY = getWindowYOffset();
		if(!toX || toX < 0) toX = 0;
		if(!toY || toY < 0) toY = 0;
		if(!frms) frms = usr.NN ? 10 :usr.Mac ? 4 :5;
		if(!frX) frX = 0 + actX;
		if(!frY) frY = 0 + actY;

		frX += (toX - actX) / frms;
		if (frX < 0) frX = 0;
		frY += (toY - actY) / frms;
		if (frY < 0) frY = 0;
		var posX = Math.ceil(frX);
		var posY = Math.ceil(frY);
		window.scrollTo(posX, posY);
		if((Math.floor(Math.abs(actX - toX)) < 1) && (Math.floor(Math.abs(actY - toY)) < 1)){
			clearTimeout(pageScrollTimer);
			window.scroll(toX,toY);
		}else if(posX != toX || posY != toY){
			pageScrollTimer = setTimeout("pageScroll("+toX+","+toY+","+frms+","+frX+","+frY+")",spd);
		}else{
			clearTimeout(pageScrollTimer);
		}
	}

	function jumpToAnchor(idName) {
		if(usr.allObj){
			if(!!idName){
				var anchorY = getTagTop(idName);
				var dMaxY = getDistanceMaxY();
				var setY = (anchorY<1)?0:(anchorY>dMaxY)?dMaxY:anchorY;
				if(anchorY>1){
					pageScroll(0,setY);
				}else if(anchorY<=1){
					pageScroll(0,0);
				}else{
					location.hash = idName;
				}
			}else{
				pageScroll(0,0);
			}
		}else{
			!!idName ? location.hash = idName : location.hash = "top";
		}
	}
	function jumpToPageTop() {
		if(usr.allObj){
			pageScroll(0,0);
		}else{
			!!idName ? location.hash = idName : location.hash = "top";
		}
	}

var Mac = navigator.appVersion.indexOf('Mac',0) != -1;
var Win = navigator.appVersion.indexOf('Win',0) != -1;
var IE  = navigator.appName.indexOf("Microsoft Internet Explorer",0) != -1;
var NN  = navigator.appName.indexOf("Netscape",0) != -1;
var Moz = navigator.userAgent.indexOf("Gecko") != -1;
var Vmajor = parseInt(navigator.appVersion); // ex. 3
var Vminor = parseFloat(navigator.appVersion); // ex. 3.01
var WinIE = (Win && IE);
var MacIE5 = ((Mac && navigator.appVersion.indexOf('MSIE 5',0) != -1) || (Mac && IE && VER > 4));


var MacIE4 = ((Mac && navigator.appVersion.indexOf('MSIE 4.',0) != -1));
var MacIE3 = ((Mac && navigator.appVersion.indexOf('MSIE 3.',0) != -1));

var bAgent = navigator.userAgent;
var d = document;
function sniffer(){
this.Win = bAgent.indexOf("Win",0) != -1 ? 1 :0;
this.Mac = bAgent.indexOf("Mac",0) != -1 ? 1 :0;
this.Moz = ((bAgent.indexOf("Gecko") != -1) && (bAgent.indexOf("Safari",0) == -1)) ? 1 :0;
this.OPERA = bAgent.indexOf("Opera",0) != -1 ? 1 :0;
this.SAFARI = bAgent.indexOf("Safari",0) != -1 ? 1 :0;
this.checkObj = d.all?(d.getElementById?3:2):(d.getElementById?4:(d.layers?1:0));
this.allObj = ((this.checkObj == 1) || (this.checkObj == 2) || (this.checkObj == 3) || (this.checkObj == 4));
return this;
}
var usr = new sniffer;
