//+++++++++++++++ロード時の設定（インデックスページ）
function load_check(){
//クッキー取得
	var name = "select";
	var info = get_cookie(name);
	if  (info != null){//クッキー存在
		var info_buf = info.split("#");
		if(info_buf[0] == "yes"){//関係者
			location.replace("index1.html");
		}
		else if(info_buf[0]=="no"){//関係者以外
			location.replace("index2.html");
		}
		else{//チェックページ
			location.replace("check.html");
		}
	}
	else{//クッキーなしチェックページへ
		location.replace("check.html");
	}
}
function load_check2(){
//クッキー取得
	var name = "select";
	var info = get_cookie(name);
	if  (info != null){//クッキー存在
		var addr = document.URL;
		var info_buf = info.split("#");
		if(info_buf[0] == "yes"){//関係者
			//location.replace(addr);
			return;		
		}
		else if(info_buf[0]=="no"){//関係者以外
			location.replace("../index2.html");
		}
		else{//チェックページ
			document.cookie = name  +  "=" +"yet" + "#"+ addr+";"+ "path=/;";			
			location.replace("../check2.html");
		}
	}
	else{//クッキーなしチェックページへ
		var addr = document.URL;
		document.cookie = name  +  "=" +"yet" + "#"+ addr+";"+ "path=/;";			
		location.replace("../check2.html");
	}
}


//+++++++++++++++cookieを保存
function setcookie(answer) {
//	var expires_date=date_check();
	var name = "select";
	var yesno = answer;
	document.cookie = name  +  "=" + yesno + "#not"+";"+ "path=/;";			
//	document.cookie = name  +  "=" + yesno + ";"+ "path=/;";
//	document.cookie = name  +  "=" + yesno + ";"+ "expires="+ expires_date +";" +  "path=/;";
//	document.cookie = name  +  "=" + yesno + ";"+ "expires="+ expires_date +";" +  "path=preview/atom/product/;";
	//document.cookie = name  +  "=" + "#" + ";" + "expires=Wednesday, 09-Nov-1999 00:00:00 GMT;" + " path=/data/photolib/;";
	if(yesno == "yes"){//関係者
		location.replace("index1.html");}
	else{//関係者以外
		location.replace("index2.html");}
	return;
}
//+++++++++++++++cookieを保存
function setcookie2(answer) {
	var name = "select";
	var yesno = answer;
	var info = get_cookie(name);
	if(yesno == "yes"){//関係者
		var info_buf = info.split("#");
		document.cookie = name  +  "=" + yesno + "#"+info_buf[1]+ ";"+ "path=/;";			
		location.replace(info_buf[1]);
	}
	else{
		document.cookie = name  +  "=" + yesno + "#not"+ ";"+ "path=/;";			
		location.replace("index2.html");	
	}
return;
}

function date_check(){//有効期限（現在の24時間後）
    var d = new Date();
    var previsit = d.toGMTString();
    d.setTime(d.getTime() + 24*60*60*1000); //24時間後
    expire = d.toGMTString();
    return expire;
}
//++++++++++cookieを取得
function get_cookie(name){
	var search    = name + "=";
	var searchlen = search.length;
	var cookie    = document.cookie;
	if(cookie == null || cookie.length == 0)   return null;
	var start = 0, end = 0;
	var index = 0;
	while(true){
		start = cookie.indexOf(search, index);
		if(start == -1)    break;
		end = cookie.indexOf(";", start);
		var c = "" + cookie.charAt(start - 1);
		var checkstr = "; ";
		if(start == 0 || checkstr.indexOf(c) != -1){
			if(end == -1)    end = cookie.length;
			return unescape(cookie.substring(start + searchlen, end));
		}
		else if(end == -1){break;}
		else{index = end + 1;}
	}
	return null;
}

//++++++++++cookieを取得



function openerJump3(url){
	var url = "http://www2.atomed.co.jp/cad/data/" + url;
	//alert(url);
	winTest = win_closed(window.opener);
	if(winTest){
		wname = window.open(url,'nwin2','');
	}else{
		wname = window.opener;
	}
	wname.location.href=url;
	wname.focus();
}

function win_closed(winOj) { 
      var ua = navigator.userAgent
      if( !!winOj )
          if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 )
               && ua.indexOf('Win')!=-1 ) 
               return winOj.closed
          else return typeof winOj.document  != 'object'
      else return true
}
