//modify by M. Suto Ver0.10 2005/11/07
function SetCookie (name,value)
{
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path    = (argc > 3) ? argv[3] : ckpath;
var domain  = (argc > 4) ? argv[4] : null;
var secure  = (argc > 5) ? argv[5] : false;

document.cookie = name + "="  + escape (value) +
 ((expires == null) ? ""		: ("; expires=" + expires.toGMTString())) +
 ((path == "")    ? ""		: ("; path=" + path)) +
 ((domain == null)  ? "" 	: ("; domain=" + domain)) +
 ((secure == true)  ? "; secure" : "");
}

function set_data(name,put_data)
{
var expdate = new Date ();
expdate.setTime (expdate.getTime() + (24 * 60 * 60 * 1000 * 31 * 1));
SetCookie (name,put_data,expdate);
}

function GetCookie (name)
{
	var arg  = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen)
		{
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
		}
	return null;
}

function getCookieVal (offset)
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset,endstr));
}

function DeleteCookie (name)
{
var exp =new Date();
exp.setTime(exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function set(p){
	kousa=p*1;
//	set_data("STTYPE",kousa);
	}

function setc(p){
	syasinc=document.demo_form.gp_dtc.value*1;
//	set_data("CWIDTH",syasinc);
	}

function setp(p){
	syasinp=document.demo_form.gp_dtp.value*1;
//	set_data("PWIDTH",syasinp);
	}

function set1(p){
	w_time=document.demo_form.tm_dt.value*1;
//	set_data("SSTIME",w_time);
	}

function valueinit(p){
	stm=GetCookie("SSTIME");
	if(stm==null) w_time=5;
	else w_time=stm;
	nwp=GetCookie("PWIDTH");
	if(nwp==null) syasinp=300;
	else syasinp=nwp;
	nwc=GetCookie("CWIDTH");
	if(nwc==null) syasinc=screen.width/2-24;
	else syasinc=nwc;
	stt=GetCookie("STTYPE");
	if(stt==null) kousa=1;
	else kousa=stt;
	}

function valueinitdisp(p){
	document.demo_form.tm_dt.value= w_time;
	document.demo_form.gp_dtp.value= syasinp;
	document.demo_form.gp_dtc.value= syasinc;
	document.demo_form.hk[kousa].checked=true;
	clearTimeout(tout);
	}


function savecookie(p){
	set_data("PWIDTH",syasinp);
	set_data("CWIDTH",syasinc);
	set_data("STTYPE",kousa);
	set_data("SSTIME",w_time);
	err=0;
	stm=GetCookie("SSTIME");
	if(stm!=w_time) err+=1;
	nwp=GetCookie("PWIDTH");
	if(nwp!=syasinp) err+=10;
	nwc=GetCookie("CWIDTH");
	if(nwc!=syasinc) err+=100;
	stt=GetCookie("STTYPE");
	if(stt!=kousa) err+=1000;
	if(err!=0) alert("This script use Cookie for saving setting.Please enable Cookie!");
	}

function valuerst(p){
	w_time=5;
	document.demo_form.tm_dt.value=w_time;
	DeleteCookie ("SSTIME");
//	set_data("SSTIME",w_time);
	syasinp=300;
	document.demo_form.gp_dtp.value= syasinp;
	DeleteCookie ("PWIDTH");
//	set_data("PWIDTH",syasinp);
	syasinc=screen.width/2-24;
	document.demo_form.gp_dtc.value= syasinc;
	DeleteCookie ("CWIDTH");
//	set_data("CWIDTH",syasinc);
	kousa=1;
	document.demo_form.hk[kousa].checked=true;
	DeleteCookie ("STTYPE");
//	set_data("STTYPE",kousa);
	}


function valuesetp(p){
	document.demo_form.gp_dtp.value= p;
//	set_data("PWIDTH",syasinp);
	}

function valuesetc(p){
	document.demo_form.gp_dtc.value= p;
//	set_data("CWIDTH",syasinc);
	}

function radioset(p){
	document.demo_form.hk[p].checked=true;
//	set_data("STTYPE",p);
	}

valueinit(0);
tout=setTimeout("valueinitdisp(0)",100);

for(i=1;i<=n;i++){dt[i]+=",,,";}
fit_flg=0;
help_flg=0;
ana_flg=1;
gc=gaku_color+",,,";
gcc=gc.split(",");
gaku_color=gcc[0];
gfont_color=gcc[1];if(gfont_color==""){gfont_color=document.fgColor;}
gfont_size=gcc[2];if(gfont_size==""){gfont_size=14;}
gaku_bgcolor=gcc[3];if(gaku_bgcolor==""){gaku_bgcolor="#cccccc";}
iti=moji_align+",0";
com_iti=iti.split(",");
moji_align=com_iti[0];yohaku=com_iti[1]*1;
if(sw>0 && sh>0 && gaku<4){
	onload=wh_chack;
	}
sum_w=sw;
scr=kakudai+",,,,";
scr_bg=scr.split(",");
dw_flg=scr_bg[3]*1;
kakudai=scr_bg[0]*1;
if(scr_bg[1]==""){scr_bg[1]="#000000";}
// r=w_time+",0,0,";rr=r.split(",");
// w_time=rr[0]*1;
// w_loop=rr[1]*1;
mac=navigator.appVersion.indexOf("Mac");
nav=navigator.appName.substring(0,1);
nav_ver=navigator.appVersion;
nav_sv=nav_ver.indexOf("Windows NT 5.1; SV1");

//Zoom up
scr_ww=screen.width;

typ=new Array();
typ[0]="channelmode=yes";//Show button & title bar
typ[1]="width="+(screen.width-10)+",height="+(screen.height-52)+",top=0,left=0";//Show title bar
typ[2]="fullscreen=yes,scrollbars=no";//Picture only
typ[3]="fullscreen=yes";//[X] button only
if(nav!="M"){
	typ[3]="outerwidth="+screen.availWidth+",outerheight="+screen.availHeight+",top=0,left=0";//[X]ボタンのみ
	}

//Set image type
function syasin_type(){
	syasinc_typ="width="+syasinc;
	syasinp_typ="width="+syasinp;
	j_syasinc=syasinc;
	j_syasinp=syasinp;
	syasin_typ2=""; //for Anaglyph
	}
//Thumbnail Finish
function wh_chack(){
	for(i=0;i<n;i++){
		sn_l=document.mihon[i].width;
		sn_h=document.mihon[i].height;
		if(sn_l>sum_w){
			document.mihon[i].width=sum_w;
			document.mihon[i].height=(sum_w/sn_l)*sn_h;
			}
		}
	}
//Thumbnail
dd=dt[1].split(",");
if(dd[3]==""){ana_flg=0;}
else{ana_flg=1;}
waku=new Array();
waku[0]='border=0';
waku[1]='border=2 cellpadding=6 bgcolor='+gaku_color;
waku[2]='border=0 cellpadding=0 cellspacing=0 width='+(sw*1+8)+' height='+(sh*1+8)+' style="text-align:left;text-valign:top;"';
waku[3]='border=0 cellpadding=10 cellspacing=0 width='+(sw*1+8)+' height='+(sh*1+8)+' style="text-align:left;text-valign:top;filter:shadow(color='+gaku_color+',direction=135)"';
if(gaku<4 && sw>0 && sh>0){
	document.write('<table width="90%" border="0" cellpadding=0>');
	for(i=1;i<=n;i++){
		dd=dt[i].split(",");
		if(dd[0]==""){dd[0]=dd[1];}
		if(i%xn==1){document.write('<tr height="',sw,'">');}
		document.write('<td align="center" valign=top>');
		document.write('<table ',waku[gaku],'><tr><td ');
		if(gaku!=3){document.write('bgcolor="',gaku_bgcolor,'" ');}
		document.write('valign=middle align=center width="',sw,'"  height="',sh,'">');
		if(document.layers || mac>0){document.write('<a href="javascript:op(',i,')">');}
		document.write('<img src="',ur,dd[0],'" name="mihon" height="',sh,'" border=1 onClick="op(',i,')" style="cursor:hand;border-color:#ffffff">'); 
		if(document.layers || mac>0){document.write('</a>');}
		if(gaku==2){
			document.write('</td><td><table width=8 height=100% border=0 cellpadding=0 cellspacing=0><tr height=8><td></td></tr><tr height='+(sh-8)+'><td bgcolor='+gaku_color+'></td></tr></table>');
			document.write('</td></tr><tr><td colspan=2><table width=100% height=8 border=0 cellpadding=0 cellspacing=0><tr><td width=8></td><td width='+sw+' bgcolor='+gaku_color+'></td></tr></table>');
			}
		document.write('</td></tr></table>');
		
		if(ana_flg==1){
			document.write('<span style="color:',gfont_color,';font-size:',gfont_size,'">',dd[4],' <a href="',dd[1],'">L</A>',' <a href="',dd[2],'">R</A>',' <a href="',dd[3],'">A</A>','</span><br>');
			}
		else{
			document.write('<span style="color:',gfont_color,';font-size:',gfont_size,'">',dd[4],' <a href="',dd[1],'">L</A>',' <a href="',dd[2],'">R</A>','</span><br>');
			}
		document.write('</td>');
			if(i%xn==0){document.write('</tr>');} 
		}
	if(i%xn!=0){document.write('</tr>');}
	document.write('<tr><td align=right colspan="'+xn+'"><BR><a href="http://www2a.biglobe.ne.jp/~qpon/js/index.htm?http://www.ne.jp/asahi/qpon/b/java/quality/quality3_b.htm" target="_qpon"><font size=1 color='+gfont_color+'>Script by QPON</font></a></td></tr>'); 
	document.write('</table>');
	//if(nav_sv>0 && kakudai>=2){
	if(kakudai>=2){
		document.write('<a href="http://www2a.biglobe.ne.jp/~qpon/html/xp_sp2.htm" target="mc"><font size=1 color=#ff4488>Full Screen Setting for WindowsXP(SP2)</font></a><br><br>');
		}
	}

	function write_image(){
		dd=dt[p_no].split(",");
		if(kousa==2 && ana_flg==1){da=dd[3];}
		else{da=dd[1];}
		if(kousa==0){dl=dd[1];dr=dd[2];}
		else{dl=dd[2];dr=dd[1];}
		if(kousa<2){
			if(kousa==0) syasintyp=syasinp_typ;
			else syasintyp=syasinc_typ;
			ww=('<NOBR><img src="'+ur+dl+'" name="myimg" border=0 '+syasintyp +' alt="'+alt_dt[at_flg]+'" galleryimg="no"> <img src="'+ur+dr+'" name="myimg" border=0 '+syasintyp +' alt="'+alt_dt[at_flg]+'" galleryimg="no" onLoad="opener.img_flg()"></NOBR>\n');}
		else{
			ww=('<img src="'+ur+da+'" name="myimg" border=0 '+syasin_typ2 +' alt="'+alt_dt[at_flg]+'" galleryimg="no" onLoad="opener.img_flg()">\n');}
		win.document.getElementById("img_td").innerHTML =ww;
		}

function pre_load(e_in){
	n_no=p_no;
	n_no++;if(n_no>n){n_no=1;}
		ddp=dt[n_no].split(",");
		if(kousa==2 && ana_flg==1){da=ddp[3];}
		else{da=ddp[1];}
		if(kousa==0){dl=ddp[1];dr=ddp[2];}
		else{dl=ddp[2];dr=ddp[1];}
		if(kousa<2){
			ww=('<NOBR><img src="'+ur+dl+'" name="myimg" border=0  width="1" height="1"><img src="'+ur+dr+'" name="myimg" border=0  width="1" height="1" onLoad="opener.pl_flg('+e_in+')"></NOBR>\n');}
		else{
			ww=('<img src="'+ur+da+'" name="myimg" border=0 width="1" height="1" onLoad="opener.pl_flg('+e_in+')" >\n');}
		win.document.getElementById("preload").innerHTML =ww;
}


////////////////////////////////////
alt_dt="Left:Close / Right:Next Image / Alt+Right:Previous Image,Left:Close / Right:Stop".split(",");
if(kakudai==3){alt_dt=",".split(",");}
//Next
seisi_flg=0;
function next_button(){
//return event.shiftKey;

if(at_flg==0){
	p_no++;if(p_no>n){p_no=1;}
//Loop end
	if(w_loop>0 && start_no==p_no){
		cls();
	}
	write_image();
	if(fit_flg==1 && kousa>1){fit(1);}
	pre_load(1);
	}
if(at_flg==1){
	at_flg=0;seisi_flg=0;
	clearTimeout(tim);
	close_button();
}
//win.document.oncontextmenu= win.next;/////////
}

function prev_button(){
//return event.shiftKey;

if(at_flg==0){
	p_no--;if(p_no<1){p_no=n;}
//Loop end
	if(w_loop>0 && start_no==p_no){
		cls();
	}
	write_image();
	if(fit_flg==1 && kousa>1){fit(1);}
	pre_load(1);
}
if(at_flg==1){
	at_flg=0;seisi_flg=0;
	clearTimeout(tim);
	close_button();
}

//win.document.oncontextmenu= win.next;/////////
}

function rewrite(zoom){
	if(kousa>1){return;}
	if(kousa==0){
		syasinp=parseInt(syasinp)+zoom;
		if(syasinp<20){syasinp=20;}
		syasinp_typ="width="+syasinp;
		valuesetp(syasinp);
		j_syasinp=syasinp;
		}
	else{
		syasinc=parseInt(syasinc)+zoom;
		if(syasinc<20){syasinc=20;}
		syasinc_typ="width="+syasinc;
		valuesetc(syasinc);
		j_syasinc=syasinc;
		}
	write_image();
}

function swap(){
	if(kousa>1){return;}
	kousa=(kousa+1)%2;
	radioset(kousa);
	write_image();
}

function modech(){
	kousa++;
	if(ana_flg==1) {kousa=(kousa)%4;}
	else{kousa=(kousa)%3;}
	radioset(kousa);
	write_image();
}

function help(){
	help_flg=(help_flg+1)%2;
	write_image();
	close_button();
}

function fit(e){
	if(kousa<2){
		if(e==1){
			if(kousa==0){
				syasinp=screen.width/2-24;
				syasinp_typ="width="+syasinp;
				valuesetp(syasinp);
				}
			else{
				syasinc=screen.width/2-24;
				syasinc_typ="width="+syasinc;
				valuesetc(syasinc);
				}
			write_image();
			}
		else{
			if(kousa==0){
				syasinp=j_syasinp;
				syasinp_typ="width="+syasinp;
				valuesetp(syasinp);
				}
			else{
				syasinc=j_syasinc;
				syasinc_typ="width="+syasinc;
				valuesetc(syasinc);
				}
			write_image();
			}
		}
	else{
		fit_flg=e;
		img_ww=win.myimg.width;
		img_hh=win.myimg.height;
		if(fit_flg==0){syasin_typ2="";}
		else{
			if((img_ww*100/screen.width)>(img_hh*100/screen.height)) syasin_typ2="width=100%";
			else syasin_typ2="height=100%";
			}
		write_image();
	}
}

//Close
at_flg=0;open_flg=0;
function cls(){

if(at_flg==1 && wip_flg==1){
open_flg=2;
}else{
open_flg=0;
wip_flg=0;
if(at_flg==1){
at_flg=0;seisi_flg=0;
clearTimeout(tim);
}
win.window.close();
}
}
//Close button
function close_button(){
	if(kakudai==3){
		if(at_flg==0){
			if(nav!="M"){
				ww=('<a href="javascript:opener.cls()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Close </a> | <a href="javascript:opener.prev_button()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Previous Image </a> | <a href="javascript:opener.next_button()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Next Image </a>\n');
			}else{
				ww=('Left click:Close | Right click:Next Image | Alt+Right click:Previous Image\n');
			}

		}else{
			if(nav!="M"){
				ww=('<a href="javascript:opener.cls()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Close </a> | <a href="javascript:opener.next_button()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Stop </a>');
			}else{
				ww=('Left click:Close | Right click:Stop ( Slide Show '+w_time+' Sec.)');

			}
		}
		if(help_flg==1){ww=("");}
		win.document.getElementById("button").innerHTML =ww;
	}
}

load_flg=1;
//Slide Show
function at(){
	op(1);
	p_no=0;
	atcnt();
}

function atcnt(){
	if(at_flg==1){
		at_flg=0;seisi_flg=0;
		clearTimeout(tim);
		close_button();
		return;
		}

	at_flg=1;seisi_flg=0;

	load_flg=1;

	at_sub();
	load_flg=1;
	close_button();
}
//
wip_flg=0;

function at_sub(){
//	tim=setTimeout("at_sub()",w_time*1000);
	timer_flg=1;
	if(seisi_flg==0){
	if(load_flg==1 || nav!="M"){
		load_flg=0;
		p_no++;
		if(p_no>n){
			p_no=1;
			if( w_loop>0){
				open_flg=2;
			}
		}
		if(open_flg==1){
			wip_flg=1;
			if(wip>0 && nav=="M"){
				if(wip==23){
					win.tp.filters["blendTrans"].Apply();
				}else{
					win.tp.filters["revealTrans"].Apply();
				}
				write_image();
				if(wip==23){
					win.tp.filters["blendTrans"].play();
				}else{
					win.tp.filters["revealTrans"].Transition=(wip-1);
					win.tp.filters["revealTrans"].play();
				}
			}else{
				write_image();
			}
			pre_load(0);
			wip_flg=0;
		}
	}
}
//For low performance PC
		if(open_flg==2){
		open_flg=0;
		at_flg=0;
		clearTimeout(tim);
		win.window.close();
		seisi_flg=0;
//return;
		}
	}

//Check load image
function pl_flg(e_in){
		if(e_in==0 && at_flg==1){tim=setTimeout("at_sub()",w_time*1000);}
		}

function img_flg(){
	load_flg=1;
	//No Comment
	if(dd[5]=="" || help_flg==1){
		win.document.getElementById("com").innerHTML = '';
	}else{
		if(nav!="M"){
		win.document.getElementById("com").innerHTML = dd[5];}
		else{
		win.document.getElementById("com").innerHTML = '<table><tr><td width='+yohaku+'><br></td><td id="txt" style="color:'+moji_color+';background-color:'+moji_bgcolor+';font-size:'+moji_size+'">'+dd[5]+'</td><td width='+yohaku+'><br></td></tr></table>';}
		}
//	if(at_flg==1 && timer_flg==1) {
//		tim=setTimeout("at_sub()",w_time*1000);
//		timer_flg=0;
//		}
	}

//Full Size Window
p_no=1;open_flg=0;start_no=1;

function op(p){
syasin_type();
p_no=p;start_no=p;
dd=dt[p].split(",");
// if(scr_ww<1000 && kakudai==3){kakudai=4;}
win=window.open("","quality",typ[kakudai]);
win.document.open();
www=win_write(p_no);
win.document.write(www);
win.document.close();
if(fit_flg==1 && kousa>1){fit(1);}
if(help_flg==1){
	help_flg=0;
	help();
	}
//win.document.oncontextmenu=win.next;/////////////
open_flg=1;
if(nav_sv>0 && kakudai==2){
win.document.title="StereoPhoto Viewer Script";
}
pre_load(1);
}

//Full Size HTML
function win_write(qq){
alt_t="Left click:Close / Right click:Next Image";
if(kakudai==3){alt_t="";}

scr_w=screen.width;scr_h=screen.height;

if(nav!="M"){
scr_h=innerHeight;
}



no=qq*1;

ddm=dt[no].split(",");
if(kousa==2 && ana_flg==1){da=ddm[3];}
else{da=ddm[1];}
if(kousa==0){dl=ddm[1];dr=ddm[2];}
else{dl=ddm[2];dr=ddm[1];}
if(kousa==0) syasintypm=syasinp_typ;
else syasintypm=syasinc_typ;

ww =('<html>\n');
ww+=('<head><title>StereoPhoto Viewer Script</title>\n');
ww+=('<script language="javascript">\n');
ww+=('nav=navigator.appName.substring(0,1);\n');
ww+=('dw_flg='+dw_flg+';');
ww+=('function next(){\n');
ww+=('if(event.shiftKey && dw_flg==1){return;}\n');
ww+=('if(event.altKey && dw_flg==1){prev();return false;}\n');
ww+=('opener.next_button();\n');
ww+=('document.oncontextmenu=next;\n');

ww+=('return false;\n');
ww+=('}\n');

ww+=('function prev(){\n');
ww+=('if(event.shiftKey && dw_flg==1){return;}\n');
ww+=('opener.prev_button();\n');
ww+=('document.oncontextmenu=next;\n');

ww+=('return false;\n');
ww+=('}\n');

ww+=('function chSize(){\n');
ww+=('var s = event.wheelDelta;\n');
ww+=('if(s >= 120){opener.rewrite(10);}\n');
ww+=('else if(s <= -120){opener.rewrite(-10);}\n');
ww+=('}\n');

ww+=('function keydw(e){;\n');
ww+=('if(nav!="M"){cod=e.which;}else{cod=event.keyCode;};\n');
ww+=('if(cod==32||cod==39){opener.next_button();};\n');
ww+=('if(cod==27||cod==13){opener.cls();};\n');
ww+=('if(cod==37||cod==8){opener.prev_button();};\n');
ww+=('if(cod==38){opener.rewrite(10);};\n');
ww+=('if(cod==40){opener.rewrite(-10);};\n');
ww+=('if(cod==88){opener.swap();};\n');
ww+=('if(cod==65){opener.atcnt();};\n');
ww+=('if(cod==77){opener.modech();};\n');
ww+=('if(cod==72){opener.help();};\n');
ww+=('if(cod==70){opener.fit(1);};\n');//Fit
ww+=('if(cod==74){opener.fit(0);};\n');//Jisun
ww+=('};\n');
ww+=('function keyup(e){cod="";};\n');
ww+=('if (nav!="M"){document.captureEvents( Event.CLICK | Event.CONTEXTMENU | Event.ONKEYDOWN | Event.ONKEYUP );\n');
ww+=('}else{\n');
ww+=('document.oncontextmenu=next;\n');
ww+=('document.onclick=opener.cls;\n');
ww+=('}\n');
ww+=('document.onkeydown=keydw;\n');
ww+=('document.onkeyup=keyup;\n');
ww+=('document.onmousewheel=chSize;\n');

ww+=('</script>\n');
ww+=('</head>\n');
ww+=('<body bgcolor="'+scr_bg[1]+'" background="'+scr_bg[2]+'" leftmargin="0" topmargin="0" marginheight=0 marginwidth=0 scroll="no" onLoad="focus();">\n');
win.document.write(ww);ww="";
ww+=('<center>\n');
//Image
if(nav!="M"){
ww+=('<div id="tp" onClick="opener.cls()" style="position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;vertical-align:middle;filter:revealTrans(Transition='+wip+');margin:auto;">\n');

}else{
if(wip==23){
ww+=('<div id="tp" style="position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;vertical-align:middle;filter:blendTrans(duration=3);margin:auto;">\n');

}else{
ww+=('<div id="tp" style="position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;vertical-align:middle;filter:revealTrans(Transition='+wip+',duration=2);margin:auto;">\n');
}
}
ww+=('<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align="center" valigin="middle" id="img_td">');
if(kousa<2){
ww+=('<NOBR><img src="'+ur+dl+'" name="myimg" border=0 '+syasintypm +' alt="'+alt_t+'" galleryimg="no"> <img src="'+ur+dr+'" name="myimg" border=0 '+syasintypm +' alt="'+alt_t+'" galleryimg="no"></NOBR>\n');}
else{
ww+=('<img src="'+ur+da+'" name="myimg" border=0 '+syasin_typ2 +' alt="'+alt_t+'" galleryimg="no">\n');}
ww+=('</td></tr></table></div>\n');
win.document.write(ww);ww="";
//

nav=navigator.appName.substring(0,1);
win_w=0;
if(nav!="M"){
//	win_h=win.innerHeight-48;
	win_h=0;
	win_w=200;
ww+=('<div id="com" style="position:absolute;top:'+win_h+'px;left:'+win_w+'px;background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:'+moji_size+';cursor:hand">');
if(ddm[5]!=""){
ww+=(ddm[5]);
}
}else{
	win_h=win.document.body.clientHeight-36;
	if(kakudai==1){win_h=win.document.body.clientHeight-54;}
ww+=('<div id="com" style="position:absolute;top:'+(win_h-yohaku)+';left:'+win_w+';width:100%;filter:blendTrans(duration=2);text-align:'+moji_align+';" >\n');
if(ddm[5]!=""){
ww+=('<table><tr><td width='+yohaku+'><br></td><td id="txt" style="color:'+moji_color+';background-color:'+moji_bgcolor+';font-size:'+moji_size+'">'+ddm[5]+'<br></td><td width='+yohaku+'><br></td></tr></table>\n');
}
}
ww+=('</div>\n');

//Pre Load Image
ww+=('<div id="preload" style="position:absolute;top:0;left:0;" >\n');
//ww+=('<img src="'+ur+da+'" name="myimg" border=0 width="30" height="30" >\n');
ww+=('</div>\n');


//Show Close button
if(kakudai==3){
if(nav!="M"){
ww+=('<div id="button" style="position:absolute;top:0;left:0;background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;cursor:hand"><a href="javascript:opener.cls()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Close </a> | <a href="javascript:opener.prev_button()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Previous Image </a> | <a href="javascript:opener.next_button()" style="background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;"> Next Image </a></div>\n');
}else{
ww+=('<div id="button" style="position:absolute;top:0;left:0;background-color:'+moji_bgcolor+';color:'+moji_color+';font-size:12;cursor:hand">Left click:Close | Right click:Next Image | Alt+Right click:Previous Image</div>\n');
}
}

//ww+=('<div id="f" style="position:absolute;top:30;left:100;"><form name=myform><input type=text name="f_w"><input type=text name="f_h"></form></div>\n');
ww+=('</center></body></html>\n');
win.document.write(ww);
}
