/*更新ロジック&共通関数群*/

/************************************************/
//最終更新日
//最終更新フラグ　●…更新
/************************************************/
//プロフィール
	var flg_profile       = '';
	var new_profile       = '2006/11/05';
//舞台裏雑記
	var flg_diary         = '●';
	var new_diary         = '2007/03/24';
//真剣遊戯
	var flg_game          = '';
	var new_game          = '2007/03/12';
//サークル_最新情報
	var flg_circle_top    = '';
	var new_circle_top    = '2007/02/17';
//サークル_ＣＧ小屋
	var flg_circle_cgtop  = '';
	var new_circle_cgtop  = '2006/10/23';
//サークル_既刊案内
	var flg_circle_books  = '';
	var new_circle_books  = '2007/02/17';
//サークル_イベント
	var flg_circle_event  = '';
	var new_circle_event  = '2007/02/17';
//サークル_レポート
	var flg_circle_report = '';
	var new_circle_report = '2007/02/17';
//落書倉庫
	var flg_rough         = '';
	var new_rough         = '2007/03/17';
//リンク
	var flg_link          = '';
	var new_link          = '2006/11/05';

//自動設定用
//全体
	var flg_top           = '';
	var lastupdate        = ''
//サークル
	var new_circle        = '';
	var flg_circle        = '';


/************************************************/
//サークル最終更新日付設定
/************************************************/
	new_circle = new_circle_top;

	if (new_circle < new_circle_cgtop){
		new_circle = new_circle_cgtop;
	}
	if (new_circle < new_circle_books){
		new_circle = new_circle_books;
	}
	if (new_circle < new_circle_event){
		new_circle = new_circle_event;
	}
	if (new_circle < new_circle_report){
		new_circle = new_circle_report;
	}

/************************************************/
//サークル更新フラグ設定
/************************************************/
	flg_circle = flg_circle_top;

	if (flg_circle_cgtop  == '●'){
		flg_circle = '●';
	}
	if (flg_circle_books  == '●'){
		flg_circle = '●';
	}
	if (flg_circle_event  == '●'){
		flg_circle = '●';
	}
	if (flg_circle_report == '●'){
		flg_circle = '●';
	}

/************************************************/
//最終更新日付設定
/************************************************/
	lastupdate = new_profile;

	if (lastupdate < new_diary){
		lastupdate = new_diary;
	}
	if (lastupdate < new_game){
		lastupdate = new_game;
	}
	if (lastupdate < new_circle){
		lastupdate = new_circle;
	}
	if (lastupdate < new_rough){
		lastupdate = new_rough;
	}
	if (lastupdate < new_link){
		lastupdate = new_link;
	}

/************************************************/
//トップページ用更新情報取得
/************************************************/

function GetIndexString(flg, title){
	if (flg == '●'){
		document.write('<FONT CLASS="F_R10 F_B">●' + title + '</FONT><BR>');
	}
}

function GetIndexTopString(){
	GetIndexString(flg_top          , 'トップページ')
}
function GetIndexProfileString(){
	GetIndexString(flg_profile      , 'プロフィール');
}
function GetIndexDiaryString(){
	GetIndexString(flg_diary        , '舞台裏雑記');
}
function GetIndexGameString(){
	GetIndexString(flg_game         , '真剣遊戯');
}
function GetIndexPangyaString(){
	GetIndexString(flg_game         , 'パンヤ日記');
}
function GetIndexCircleString(){
	GetIndexString(flg_circle       , 'サークル');
}
function GetIndexCircle_TopString(){
	GetIndexString(flg_circle_top   , '最新情報');
}
function GetIndexCircle_CgtopString(){
	GetIndexString(flg_circle_cgtop , 'ＣＧ小屋');
}
function GetIndexCircle_BooksString(){
	GetIndexString(flg_circle_books , '既刊案内');
}
function GetIndexCircle_EventString(){
	GetIndexString(flg_circle_event  , 'イベント');
}
function GetIndexCircle_ReportString(){
	GetIndexString(flg_circle_report, 'レポート');
}
function GetIndexRoughString(){
	GetIndexString(flg_rough        , '落描倉庫');
}
function GetIndexLinkString(){
	GetIndexString(flg_link         , 'リンク');
}

/************************************************/
//更新日付取得
/************************************************/

//最終更新日
function GetLastUpdate(){
	document.write(lastupdate);
}
//プロフィール更新日
function GetProfileUpdate(){
	document.write(new_profile);
}
//日記更新日
function GetDiaryUpdate(){
	document.write(new_diary);
}
//真剣遊戯更新日
function GetGameUpdate(){
	document.write(new_game);
}
//サークル更新日
function GetCircleUpdate(){
	document.write(new_circle);
}
//サークル_最新情報更新日
function GetCircle_TopUpdate(){
	document.write(new_circle_top);
}
//サークル_ＣＧ小屋更新日
function GetCircle_CgtopUpdate(){
	document.write(new_circle_cgtop);
}
//サークル_既刊案内更新日
function GetCircle_BooksUpdate(){
	document.write(new_circle_books);
}
//サークル_イベント更新日
function GetCircle_EventUpdate(){
	document.write(new_circle_event);
}
//サークル_レポート更新日
function GetCircle_ReportUpdate(){
	document.write(new_circle_report);
}
//落描倉庫更新日
function GetRoughUpdate(){
	document.write(new_rough);
}
//リンク更新日
function GetLinkUpdate(){
	document.write(new_link);
}


/************************************************/
//更新文字列取得
/************************************************/


//共通文字列生成
function GetString(flg, title){
	if (flg == '●'){
		document.write('<FONT CLASS="F_R10 F_B">●' + title + '</FONT>');
	}else{
		document.write('<FONT CLASS="F_BR10 F_B">' + title + '</FONT>');
	}
}

function GetTopString(){
	GetString(flg_top          , 'トップページ')
}
function GetProfileString(){
	GetString(flg_profile      , 'プロフィール');
}
function GetDiaryString(){
	GetString(flg_diary        , '舞台裏雑記');
}
function GetGameString(){
	GetString(flg_game         , '真剣遊戯');
}
function GetPangyaString(){
	GetString(flg_game         , 'パンヤ日記');
}
function GetCircleString(){
	GetString(flg_circle       , 'サークル');
}
function GetCircle_TopString(){
	GetString(flg_circle_top   , '最新情報');
}
function GetCircle_CgtopString(){
	GetString(flg_circle_cgtop , 'ＣＧ小屋');
}
function GetCircle_BooksString(){
	GetString(flg_circle_books , '既刊案内');
}
function GetCircle_EventString(){
	GetString(flg_circle_event  , 'イベント');
}
function GetCircle_ReportString(){
	GetString(flg_circle_report, 'レポート');
}
function GetRoughString(){
	GetString(flg_rough        , '落描倉庫');
}
function GetLinkString(){
	GetString(flg_link         , 'リンク');
}


/************************************************/
//メインフレームへのリンク
/************************************************/
function GetReturnIndex(level){
	levelstring = '';
	//LEVEL分リンク先の戻り階層を設定
	for (i=0; i<level; i++){
		levelstring = levelstring + '../';
	}
	document.write('<A target="_top" href="' + levelstring + 'frame.htm" CLASS="F_BR08 F_B F_I">メインフレームへ</A>');
}

/************************************************/
//２フレーム同時リンク
/************************************************/
function DblLink(subframe, SubUrl, mainframe, MainUrl){
	window.open(SubUrl, subframe);
	window.open(MainUrl, mainframe);
}

/************************************************/
//<DIV>タグの表示制御
/************************************************/
function DispOperate(ID){
	var image_name;
	image_name = "img" + ID;
	/*プラスクリックで非表示*/
	if ( document.all.item(ID).style.display=='none' ){
		document.all.item(ID).style.display="block";
	}
	/*マイナスクリックで表示*/
	else{
		document.all.item(ID).style.display="none";
	}
}

/************************************************/
//<DIV>タグの表示制御
/************************************************/
function pullDown(ID){
	var image_name;
	image_name = "img" + ID;
	/*プラスクリックで非表示*/
	if ( document.all.item(ID).style.visibility=='visible' ){
		document.all.item(ID).style.visibility="hidden";
	}
	/*マイナスクリックで表示*/
	else{
		document.all.item(ID).style.visibility="visible";
	}
}

/************************************************/
//画像差替スクリプト
//使用例
//'「Onload」イベントで、「preloadImages」関数を呼び出す
//<body onLoad="preloadImages('mame1.jpg','mame2.jpg')">
//
//'「onMouseOut」イベントで、「swapImgRestore」関数を呼び出す
//'「onMouseOver」イベントで、「swapImage」関数を呼び出す
//<a onMouseOut="swapImgRestore()" onMouseOver="swapImage('Image1','','mame1.jpg',1)">
//  <img name="Image1" src="mame2.jpg">    //初期表示画像
//</a>
/************************************************/

//画像戻し
function swapImgRestore() {
  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 preloadImages() {
  var d=document;
  if(d.images){ 
    if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=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 findObj(n, d) {
  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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); 
  return x;
}

//画像入替
function swapImage() {
  var i,j=0,x,a=swapImage.arguments; 
  document.MM_sr=new Array;
  for(i=0;i<(a.length-2);i+=3)
  if ((x=findObj(a[i]))!=null){
    document.MM_sr[j++]=x;
    if(!x.oSrc) x.oSrc=x.src;
    x.src=a[i+2];
  }
}
/************************************************/
