﻿var ie=true;
if(navigator.appName.indexOf("Internet Explorer")==-1)
	ie=false;


function switch1(bull)
{
	for(i=1; i<=5; i++)
		document.all['bull'+i].style.display='none';
	
	if(ie)
		document.all[bull].style.display='block';
	else
		document.all[bull].style.display='table-row';
}

function switch2(bull)
{
	for(i=1; i<=5; i++)
	document.all['place'+i].style.display='none';
	
	if(ie)
		document.all[bull].style.display='inline';
	else
		document.all[bull].style.display='table-row';
}

var bookActive=1;
function bookNext()
{
	if(bookActive<bookMax)
	{
	document.all['book'+bookActive++].style.display='none';
	if(ie)
		document.all['book'+bookActive].style.display='inline';
	else
		document.all['book'+bookActive].style.display='table-row';
	}
	else
		alert("這是最後一頁");
}

function bookPre()
{
	if(bookActive>1)
	{
		document.all['book'+bookActive--].style.display='none';
		if(ie)
			document.all['book'+bookActive].style.display='inline';
		else
			document.all['book'+bookActive].style.display='table-row';
	}
	else
		alert("這是第一頁");
}

//album
function preview(inp, inp2)
{
	document.getElementById("photoView").width=200;
	document.getElementById("photoView").height=200;
	document.getElementById("photoView").src=inp;
	document.getElementById("aUserName").innerHTML=inp2.replace("&", "&amp;");
}


function resize(img)
{
		img.resized=true; 
		var img2 = new Image();
		img2.onload= function()
		{
			if(img2.width>200 && img2.width>=img2.height)
			{
				img.width=200;
				img.height=img2.height*200/img2.width;
			}
			else if(img2.height>200 && img2.height>=img2.width)
			{
				img.height=200;
				img.width=img2.width*200/img2.height;
			}
			else if(img2.width>50)
			{
				img.width=img2.width;
				img.height=img2.height;
			}
		}
		img2.src=img.src;
}

function show3()
{
	window.parent.document.getElementById("showdiv").style.top=document.body.scrollTop;
	window.parent.document.getElementById("showdiv").style.display='inline';	
	window.parent.document.body.style.overflow='hidden';
}


function hidden()
{
	if(window.parent.document.getElementById("showdiv")!=null)
	{
		window.parent.document.getElementById("showdiv").style.display='none';
		window.parent.document.body.style.overflow='auto';
		window.showIf.location.href='blank.htm'
	}
	else
		window.close();
}

function hidden2()
{
	document.getElementById("showdiv").style.display='none';
	document.body.style.overflow='auto';
	window.showIf.location.href='blank.htm'
}

