var smallTransparentGif = "";
function fixupIEPNG(strImageID, transparentGif) 
{
    smallTransparentGif = transparentGif;
    if (windowsInternetExplorer && (browserVersion < 7))
    {
        var img = document.getElementById(strImageID);
        if (img)
        {
            var src = img.src;
            img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
            img.src = transparentGif;
            img.attachEvent("onpropertychange", imgPropertyChanged);
        }
    }
}
function onPageLoad()
{
    detectBrowser();
    fixupIEPNG("id2", "image/transparent.gif");
    return true;
}

function NBmouseover(index)
{
    document.getElementById(index).src="image/navbar_"+index+"_r.gif";
}

function NBmouseout(index)
{
    document.getElementById(index).src="image/navbar_"+index+"_n.gif";
}

var windowsInternetExplorer = false;
var browserVersion = 0;
function detectBrowser()
{
    windowsInternetExplorer = false;
    var appVersion = navigator.appVersion;
    if ((appVersion.indexOf("MSIE") != -1) &&
        (appVersion.indexOf("Macintosh") == -1))
    {
        var temp = appVersion.split("MSIE");
        browserVersion = parseFloat(temp[1]);
        windowsInternetExplorer = true;
    }
}

var inImgPropertyChanged = false;
function imgPropertyChanged()
{
    if ((window.event.propertyName == "src") && (! inImgPropertyChanged))
    {
        inImgPropertyChanged = true;
        var el = window.event.srcElement;
        if (el.src != smallTransparentGif)
        {
            el.filters.item(0).src = el.src;
            el.src = smallTransparentGif;
        }
        inImgPropertyChanged = false;
    }
}
	function changeSrc(ximage,yimage)
 		{
   			switch (yimage)
				{
					case 1:
						photono=ximage-1
						if (photono<firstimage)
							{
								photono=firstimage
								alert("這是第一張相片！！")
							}
						break
					case 2:
						photono=ximage+1
						if (photono>lastestimage)
							{
								photono=lastestimage
								alert("這是最後一張相片！！")
							}
						break
					default:
						photono=ximage
				}
			scrimage =photopath+photono+".jpg"
			//document.getElementById("loadingbar").style.display="block"
			//document.getElementById("photo").style.display="none"
			document.getElementById("photo").src="../image/loding.gif"
			var t1=setTimeout("preImageload(scrimage)",1000)
 		}
	function preImageload(showimage)
		{
			document.getElementById("photo").src=showimage
			//document.getElementById("loadingbar").style.display="none"
			//document.getElementById("photo").style.display="block"
		}
	
	function changeSrc1(ximage,yimage)
		{
			switch (yimage)
				{
					case 4:
						thumbnailno=ximage-8
						if (thumbnailno<firstimage)
							{
								thumbnailno=firstimage
							}
						break
					case 5:
						thumbnailno=ximage+8
						if (thumbnailno>lastestimage-7)
							{
								thumbnailno=lastestimage-7
							}
						break
				}
		a=1
		for(i=thumbnailno; i<=thumbnailno+7; i++)
			{
				thumbnailid="thumbnail"+a
				newhtml="<img src="+thumbnailpath+i+".jpg border=0 onMousedown=changeSrc("+i+",3) >"
				document.getElementById(thumbnailid).innerHTML=newhtml
				a++
			}
		}
function open_win(url)
{
window.open(url,"_blank","toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width="+screen.availWidth+", height="+screen.availHeight)
}

