// JavaScript Document

//---NAV---//
this_url=document.URL;
now_OBJ=null;
archi_name_en=new Array();
cr_name_en=new Array();
archi_name_en[0]="ENRIC RUIZ-GELI // CLOUD 9"; cr_name_en[0]="Spain";
archi_name_en[1]="R&Sie (n)"; cr_name_en[1]="France";
archi_name_en[2]="Polaris Architects"; cr_name_en[2]="Luxembourg & Belgium";
archi_name_en[3]="NL Architects"; cr_name_en[3]="Netherlands";
archi_name_en[4]="B.I.G. – Bjarke Ingels Group"; cr_name_en[4]="Denmark";
archi_name_en[5]="JDS architects"; cr_name_en[5]="Denmark";
archi_name_en[6]="D O G M A | O F F I C E"; cr_name_en[6]="Italy & Belgium";
archi_name_en[7]="Andreas Angelidakis"; cr_name_en[7]="Greece";
archi_name_en[8]="Zizi & Yoyo"; cr_name_en[8]="Estonia";
archi_name_en[9]="Duangrit Bunnag Architect Limited"; cr_name_en[9]="Thailand";
archi_name_en[10]="Gary Chang / Edge Design Institute Ltd."; cr_name_en[10]="Hong Kong";
archi_name_en[11]="MADA s.p.a.m."; cr_name_en[11]="China";
archi_name_en[12]="Mass Studies"; cr_name_en[12]="Korea";
archi_name_en[13]="TAIRA NISHIZAWA ARCHITECTS"; cr_name_en[13]="Japan";
archi_name_en[14]="iredale pedersen hook architects"; cr_name_en[14]="Australia";
archi_name_en[15]="SEAN GODSELL ARCHITECTS"; cr_name_en[15]="Australia";
hit_cl="#ffffff";
lang_title=new Array();
lang_title["jp"]="English";
lang_title["en"]="日本語";
link_title=new Array();
link_title["jp"]="リンクを表示";
link_title["en"]="link";
//---Set OBJ---//
function set_OBJ(objid){
	if(document.all){
		OBJ=document.all(objid);
	}
	else if(document.getElementById){
		OBJ=document.getElementById(objid);
	}
	else if(document.layers){
		OBJ=objid.target;
	}
}

//---Get WIN Size---//
function gtWinSize(){
	if(document.all || document.getElementById){
		scrW=document.body.clientWidth; scrH=document.body.clientHeight;
		if(! scrH){scrW=window.innerWidth;scrH=window.innerHeight;}
	}
	else if(document.Layers){
		scrW=win.innerWidth; scrH=win.innerHeight;
	} 
}

//---CH Main Position---//
function scrPos(){
	gtWinSize();
	set_OBJ('main');
	OBJ.style.left=(scrW-790)/2;
	OBJ.style.top=(scrH-590)/2;
	set_OBJ('win');
	if(OBJ){
		OBJ.style.left=(scrW-790)/2;
		OBJ.style.top=(scrH-590)/2;
	}
	OBJ=null;
}

//---CH Back IMG Size---//
function scrSize(){
	gtWinSize();
	per_w=scrW/bgimgW;
	per_h=scrH/bgimgH;
	if(per_w*bgimgH>scrH){chimgH=per_w*bgimgH; chimgW=scrW;}
	if(per_h*bgimgW>scrW){chimgW=per_h*bgimgW; chimgH=scrH;}
	set_OBJ('back_img');
	OBJ.style.width=chimgW;
	OBJ.style.height=chimgH;
	vax=OBJ.style.left=(scrW-chimgW)/2;
	OBJ.style.top=(scrH-chimgH)/2;
	OBJ=null;
}

/*---Timer---
if (document.all){
	ie=true;
	m_opacity=70;
}
else {
	ie=false;
	m_opacity=0.7;
}

function wait_ed(obj_id){
	id=obj_id;
	set_OBJ(id);

	if(ie){m_opacity=OBJ.style.opacity=m_opacity-10;}
	else{m_opacity=OBJ.style.opacity=m_opacity-0.1;}

	if(m_opacity>=0){
		waitTimer=setTimeout("wait_ed(id)",1);
	}
	else{
		if(window.waitTimer){clearTimeout(waitTimer);}
		var body=document.getElementsByTagName("body").item(0);
		body.removeChild(OBJ);
		if(ie){m_opacity=70;}
		else{m_opacity=0.7;}
	}
}
*/
//---END---//

//---CH_TEXT---//
function ch_tex_1(target,id,num){
	set_OBJ(target);
	OBJ.style.height=null;
	OBJ.innerHTML=id[num];
	OBJ=null;
	for(i=0; i<=2; i++){
		if(i==num){
			set_OBJ("switch_"+i);
			OBJ.style.textDecoration="underline";
			OBJ.style.cursor="auto";
		}
		else{
			set_OBJ("switch_"+i);
			OBJ.style.textDecoration="none";
			OBJ.style.cursor="pointer";
		}
	}
}

//---ARCHI_LOGO_TOP---//
function ch_over(num){
	if(now_OBJ) now_OBJ.style.visibility="hidden";
	set_OBJ("logo_"+num);
	pOBJ=OBJ;
	set_OBJ("logo_img_"+num);
	iOBJ=OBJ;
	set_OBJ("info");
	ptop=pOBJ.offsetTop+pOBJ.offsetHeight/2-OBJ.offsetHeight/2;
	ptop=eval(ptop);
	OBJ.innerHTML=archi_name_en[num]+"<p class=\"country\"> [ "+cr_name_en[num]+" ]</p>";
	OBJ.style.top=ptop;
	OBJ.style.left="auto";
	OBJ.style.right=70+iOBJ.offsetWidth/2;
	OBJ.style.visibility="visible";
	now_OBJ=OBJ;
}
//---ARCHI_OUT---//
function ch_out(i){
	set_OBJ("info");
	OBJ.style.visibility="hidden";
}

//---EXHIBIT_LOGO_TOP---//
function ex_over(){
	if(now_OBJ) now_OBJ.style.visibility="hidden";
	set_OBJ("exhibit");
	pOBJ=OBJ;
	set_OBJ("info_exhibit");
	re_timer();
	if(! OBJ){
		div=document.createElement("div");
		div.id="info_exhibit";
		div.innerHTML="<div style=\"position:static;\" onmouseout=\"exhibit_timer();\" onmouseover=\"re_timer();\">";
		for(i=0; i<exhibition.length; i++){
			div.innerHTML+="<a href=\"javascript:cr_win('exhibit',"+i+");\" style\"width:100%\" class=\"exhibit\" onmouseover=\"re_timer();\">"+exhibition[i]+"</a>";
		}
		div.innerHTML+="</div>";
		div.style.left=218;
		div.style.width=150;
		div.style.top=70;
		pOBJ.appendChild(div);
	}
	else{OBJ.style.visibility="visible";}
	set_OBJ("info_exhibit");
	now_OBJ=OBJ;
}

function ex_out(){
	set_OBJ("exhibit");
	pOBJ=OBJ;
	set_OBJ("info_exhibit");
	if(OBJ){pOBJ.removeChild(OBJ);}
	if(window.vbTimer){clearTimeout(vbTimer);}
}

function exhibit_timer(){
	set_OBJ("info_exhibit");
	cont_OBJ=OBJ;
	vbTimer=setTimeout("ex_out();",1500);
}

function re_timer(){
	if(window.vbTimer){clearTimeout(vbTimer);}
}

//---CR_WINDOW---//
url_num=new Array();
function cr_win(type,num){
	url=null;
	var body=document.getElementsByTagName("body").item(0);
	set_OBJ('win');
	pOBJ=OBJ;
	pOBJ.style.visibility="visible";
	set_OBJ('ifr_div');
	if(type=='archi'){
		url=type+".php?num="+num+"&lang="+lang;
	}
	else if(type=='exhibit'){
		url=type+"_"+lang+"_"+num+".html";
	}
	else if(type=='report'){
		url=type+".php?report_num="+report_num[num]+"&num="+num+"&lang="+lang;
	}
	url_num[type]=num;
//	alert(url_num[type]);

	if(OBJ){
		set_OBJ("ifr_name");
		OBJ.innerHTML="<a href=\"javascript:del_win('"+type+"');\" title=\"close\"><img src=\"img/top/close.gif\" style=\"margin-right:5;\"></a>";
		if(type=='archi'){
			OBJ.innerHTML+=archi_name[num]+"<p class=\"country\" style=\"color:rgb(255,255,255);\"> [ "+cr_name[num]+" ]</p>";
			ch_out(num);
		}
		else if(type=='exhibit'){
			OBJ.innerHTML+=exhibition[num];
			for(i=0; i<num_max[type]; i++){
				ch_exhbitbt_bgcolor(type,i);
			}
		}
		else if(type=='report'){
			year=report_num[num].slice(0,4);
			month=report_num[num].slice(4,6);
			date=report_num[num].slice(6,8);
			OBJ.innerHTML+=year;
			OBJ.innerHTML+="."+month+"."+date;
		}
	//---LANGUAGE BUTTOM---//
	set_OBJ("ifr_lang");
	OBJ.innerHTML=ch_lang_inner(type);
	//---END---//
		window.open(url,"ifr_frame");
	}else{
		//---LANGUAGE BUTTOM---//
		div = document.createElement("div");
		div.id="ifr_lang";
		div.innerHTML=ch_lang_inner(type);
		pOBJ.appendChild(div);
		//---END---//
		ifr_id="ifr_frame";
		div = document.createElement("div");
		div.id="ifr_div";
		div.style.zIndex=1;
		div.innerHTML="<iframe src=\"\" name=\"ifr_frame\" frameborder=\"no\" width=\"100%\" height=\"100%\"></iframe>";
		pOBJ.appendChild(div);
		div = document.createElement("div");
		div.id="ifr_name";
		div.style.zIndex=2;
		div.innerHTML="<a href=\"javascript:del_win('"+type+"');\" title=\"close\"><img src=\"img/top/close.gif\" style=\"margin-right:5;\"></a>";

		if(type=='archi'){
			div.innerHTML+=archi_name[num]+"<p class=\"country\" style=\"color:rgb(255,255,255);\"> [ "+cr_name[num]+" ]</p>";
			ch_out(num);
		}
		else if(type=='exhibit'){
			div.innerHTML+=exhibition[num];
		}
		else if(type=='report'){
			year=report_num[num].slice(0,4);
			month=report_num[num].slice(4,6);
			date=report_num[num].slice(6,8);
			div.innerHTML+=year;
			div.innerHTML+="."+month+"."+date;
		}

		//---DIRECTION BUTTOM---//
		div_dir_L = document.createElement("div");
		div_dir_L.id="dir_L";
		div_dir_L.innerHTML="<a href=\"javascript:win_goto('"+type+"','pre')\"><img src=\"img/top/dir_L.gif\"></a>";
		div_dir_R = document.createElement("div");
		div_dir_R.style.zIndex=2;
		div_dir_L.style.zIndex=2;
		div_dir_R.id="dir_R";
		div_dir_R.innerHTML="<a href=\"javascript:win_goto('"+type+"','for')\"><img src=\"img/top/dir_R.gif\"></a>";
		pOBJ.appendChild(div_dir_R);
		pOBJ.appendChild(div_dir_L);
		if(type=='archi'){
			div_bn = document.createElement("div");
			div_bn.id="div_bn";
			for(j=0; j<2; j++){
				ta=document.createElement("table");
				tbody=document.createElement("tbody");
				ta.appendChild(tbody);
				ta.style.width="810";
				ta.style.height="35";
				tr=document.createElement("tr");
				tbody.appendChild(tr);
				if(j==0){min=0; max=9}else{min=9; max=16;}
				for(i=min; i<max; i++){
					td=document.createElement("td");
					td.innerHTML+="<a href=\"javascript:cr_win('archi',"+i+");\"><img src=\"img/logo_b/"+i+".gif\"></a>";
					tr.appendChild(td);
					td.style.width="auto";
					td.style.textAlign="center";
					td.style.paddingLet=20;
					td.style.paddingRight=20;
				}
				div_bn.appendChild(ta);
			}
			pOBJ.appendChild(div_bn);
		}
		else if(type=='exhibit'){
			div_bn = document.createElement("div");
			div_bn.id="div_bn";
				ta=document.createElement("table");
				tbody=document.createElement("tbody");
				ta.appendChild(tbody);
				ta.style.width="780";
				ta.style.height="35";
				tr=document.createElement("tr");
				tbody.appendChild(tr);
				for(i=0; i<exhibition.length; i++){
					td=document.createElement("td");
					tr.appendChild(td);
					td.style.width=Math.floor(100/exhibition.length)+"%";
					td.style.margin=0;
					td.style.textAlign="center";
					td.style.paddingLet=0;
					td.id="exhibit_bt_"+i;
				}
			div_bn.appendChild(ta);
			pOBJ.appendChild(div_bn);
			for(i=0; i<num_max[type]; i++){
				ch_exhbitbt_bgcolor(type,i);
			}
		}

		window.open(url,"ifr_frame");
		pOBJ.appendChild(div);
		set_OBJ('ifr_name');
		OBJ.style.top=50-OBJ.offsetHeight/2;
		bg_div = document.createElement("div");
		bg_div.id='bg';
		bg_div.style.zIndex=0;
		bg_div.innerHTML="<div style=\"width:100%; height:100%;\" onMousedown=\"del_win('"+type+"')\"></div>";
		body.appendChild(bg_div);
	}
}

function win_goto(type,dir){
	if(dir=='for'){
		url_num[type]++;
		if(url_num[type]>num_max[type]-1){url_num[type]=0;}
	}
	else if(dir=='pre'){
		url_num[type]--;
		if(url_num[type]<0){url_num[type]=num_max[type]-1;}	
	}
	set_OBJ("ifr_name");
	OBJ.innerHTML="<a href=\"javascript:del_win('"+type+"');\" title=\"close\"><img src=\"img/top/close.gif\" style=\"margin-right:5;\"></a>";
	if(type=='archi'){
		OBJ.innerHTML+=archi_name[url_num[type]]+"<p class=\"country\" style=\"color:rgb(255,255,255);\"> [ "+cr_name[url_num[type]]+" ]</p>";
		url=type+".php?num="+url_num[type]+"&lang="+lang;
	}
	else if(type=='exhibit'){
		OBJ.innerHTML+=exhibition[url_num[type]];
		url=type+"_"+lang+"_"+url_num[type]+".html";
		for(i=0; i<num_max[type]; i++){
			ch_exhbitbt_bgcolor(type,i);
		}
	}
	else if(type=='report'){
		var num=report_num[url_num[type]];
		year=num.slice(0,4);
		month=num.slice(4,6);
		date=num.slice(6,8);
		OBJ.innerHTML+=year;
		OBJ.innerHTML+="."+month+"."+date;
		url=type+".php?report_num="+report_num[url_num[type]]+"&num="+url_num[type]+"&lang="+lang;
	}
	//---LANGUAGE BUTTOM---//
	set_OBJ("ifr_lang");
	OBJ.innerHTML=ch_lang_inner(type);
	//---END---//
	window.open(url,"ifr_frame");
}

//---LANGUAGE BUTTOM---//
function ch_lang_inner(type){
	if(lang=="en") lang_value="jp";
	if(lang=="jp") lang_value="en";
	var innertext="";
	if(type != "report" || type==null){
		if(! type) img_type="_w";
		else img_type="";
		innertext="<form action=\"../2006_2007/\" method=\"post\" class=\"lang\">";
		if(type!=null){
			innertext+="<input type=\"hidden\" name=\"type\" value=\""+type+"\"><input type=\"hidden\" name=\"num\" value=\""+url_num[type]+"\">";
		}
		innertext+="<input type=\"hidden\" name=\"lang\" value=\""+lang_value+"\"><input type=\"image\" src=\"img/top/"+lang+img_type+".gif\" name=\"submit\" style=\"margin-bottom:2\" title=\""+lang_title[lang]+"\"></form>";
		if(type!=null) innertext+="<br>";
	}
	if(type != null) innertext+="<a href=\"index.php?type="+type+"&num="+url_num[type]+"&lang="+lang+"\" title=\""+link_title[lang]+"\"><img src=\"img/top/book.gif\"></a>";
	return innertext;
}

function cr_lang(){
	set_OBJ('main');
	pOBJ=OBJ;
	div=document.createElement("div");
//	div.innerHTML
	div.innerHTML+=ch_lang_inner();
	div.style.bottom=32;
	div.style.right=5;
	pOBJ.appendChild(div);
}

//---ch_exhibition_buttom---//
function ch_exhbitbt_bgcolor(type,i){
	set_OBJ("exhibit_bt_"+i);
	if(i==url_num[type]){
		OBJ.innerHTML="<div class=\"exhibit\" style=\"position:static; background:"+hit_cl+"; margin:0; border-color:#ffffff #000000;\"><h5 class=\"exhibit_text\">"+exhibition[i]+"</h5></div>";
	}
	else{
		OBJ.innerHTML="<a href=\"javascript:cr_win('exhibit',"+i+")\" class=\"exhibit\" style=\"margin:0;  border-color:#ffffff\"><h5 class=\"exhibit_text\">"+exhibition[i]+"</h5></a>";
		OBJ.style.backgroundColor=null;
	}
}

function del_win(type){
	set_OBJ('win');
	pOBJ=OBJ;
	pOBJ.style.visibility="hidden";
	set_OBJ('ifr_div');
	pOBJ.removeChild(OBJ);
	set_OBJ('ifr_name');
	pOBJ.removeChild(OBJ);
	set_OBJ('ifr_lang');
	pOBJ.removeChild(OBJ);
	set_OBJ('dir_L');
	if(OBJ){
		pOBJ.removeChild(OBJ);
	}
	set_OBJ('dir_R');
	if(OBJ){
		pOBJ.removeChild(OBJ);
	}
	set_OBJ('div_bn');
	if(OBJ){
		pOBJ.removeChild(OBJ);
	}
	var body=document.getElementsByTagName("body").item(0);
	set_OBJ('bg');
	body.removeChild(OBJ);
}