function linkJsCss()
{
	if (jsOK)
	{
		document.write('<link rel="stylesheet" type="text/css" href="image/trident/trident-jsok.css">');
	}
}

function setSb1()
{
	if (ddEnabled) return;
	sa1H=document.getElementById('sarea1').offsetHeight;
	sc1H=document.getElementById('scont1').offsetHeight;
	sa1S=document.getElementById('sarea1').scrollTop;
	isIE? sa1H-=265 : false;
	document.getElementById('grbtm1').style.visibility='visible';
	if (sa1H > 77)
	{
		if (sc1H > sa1H)
		{
			document.getElementById('sbar1').style.height=(sa1H+1);
			document.getElementById('sbtn1').style.height=(sa1H/sc1H*sa1H);
			document.getElementById('sbtn1f').style.height=(sa1H/sc1H*sa1H-2);
			document.getElementById('sbtn1').style.top=(sa1H/sc1H*sa1S);
			document.getElementById('nav1').style.visibility='visible';
			document.getElementById('sbar1').style.visibility='visible';
			document.getElementById('grbtm1').style.bottom=37;
		}
		else
		{
			document.getElementById('nav1').style.visibility='hidden';
			document.getElementById('sbar1').style.visibility='hidden';
			document.getElementById('grbtm1').style.bottom=(37+sa1H-sc1H);
		}
	}
	else
	{
		document.getElementById('nav1').style.visibility='hidden';
		document.getElementById('grbtm1').style.visibility='hidden';
	}
}

function setSb2()
{
	if (ddEnabled) return;
	sa2H=document.getElementById('sarea2').offsetHeight;
	sc2H=document.getElementById('scont2').offsetHeight;
	sa2S=document.getElementById('sarea2').scrollTop;
	isIE? sa2H-=55 : false;
	if (sc2H > sa2H)
	{
		document.getElementById('sbar2').style.height=(sa2H);
		document.getElementById('sbtn2').style.height=(sa2H/sc2H*sa2H);
		document.getElementById('sbtn2f').style.height=(sa2H/sc2H*sa2H-2);
		document.getElementById('sbtn2').style.top=(sa2H/sc2H*sa2S);
		document.getElementById('nav2').style.visibility='visible';
		document.getElementById('sbar2').style.visibility='visible';
	}
	else
	{
		document.getElementById('nav2').style.visibility='hidden';
		document.getElementById('sbar2').style.visibility='hidden';
	}
}

function popupww(gid,id,winw,winh)
{
	if (!pww.closed && pww.location)
	{
		pww.resizeBy(winw-pwwinW(),winh-pwwinH());
		pww.location.href = ("photoview.php?gid="+gid+"&id="+id);
	}
	else
	{
		pww=window.open("photoview.php?gid="+gid+"&id="+id,"pww",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+winw+',height='+winh+',left=20,top=20');
	}
	if (window.focus) {pww.focus()};
}


function pwwinW()
{
	if (pww.innerWidth) return pww.innerWidth;
	else if (pww.document.documentElement && pww.document.documentElement.clientWidth) return pww.document.documentElement.clientWidth;
	else if (pww.document.body && pww.document.body.clientWidth) return pww.document.body.clientWidth;
	else return false;
}

function pwwinH()
{
	if (pww.innerHeight) return pww.innerHeight;
	else if (pww.document.documentElement && pww.document.documentElement.clientHeight) return pww.document.documentElement.clientHeight;
	else if (pww.document.body && pww.document.body.clientHeight) return pww.document.body.clientHeight;
	else return false;
}

function scrollu1	()	{tmr=setInterval('sRepeat1(-2)',20);}
function scrolld1	()	{tmr=setInterval('sRepeat1( 2)',20);}
function sRepeat1	(sStep)	{isIE ? document.all.sarea1.scrollTop+=sStep : document.getElementById('sarea1').scrollTop+=(sStep)}
function scrollt1	()	{isIE ? document.all.sarea1.scrollTop=0 : document.getElementById('sarea1').scrollTop=0}
function scrollb1	()	{isIE ? document.all.sarea1.scrollTop=99999 : document.getElementById('sarea1').scrollTop=99999}
function scrollu2	()	{tmr=setInterval('sRepeat2(-2)',20);}
function scrolld2	()	{tmr=setInterval('sRepeat2( 2)',20);}
function sRepeat2	(sStep)	{isIE ? document.all.sarea2.scrollTop+=sStep : document.getElementById('sarea2').scrollTop+=(sStep)}
function scrollt2	()	{isIE ? document.all.sarea2.scrollTop=0 : document.getElementById('sarea2').scrollTop=0}
function scrollb2	()	{isIE ? document.all.sarea2.scrollTop=99999 : document.getElementById('sarea2').scrollTop=99999}
function noScroll	()	{clearInterval(tmr)}


function ddInit(e)
{
	topL=isIE||isOP? "BODY" : "HTML";
	objX=isIE||isOP? event.srcElement : e.target;
	while (objX.id!="sbtn1"&&objX.id!="sbtn2"&&objX.tagName!=topL) {
		objX=isIE||isOP? objX.parentElement : objX.parentNode;
	}

	if (objX.id=="sbtn1")
	{
		barA=isIE ? document.all.sbar1 : document.getElementById("sbar1");
		btnA=isIE ? document.all.sbtn1 : document.getElementById("sbtn1");
		saA=isIE ? document.all.sarea1 : document.getElementById("sarea1");
		scA=isIE ? document.all.scont1 : document.getElementById("scont1");
		offsety=isIE||isOP ? event.clientY : e.clientY;
		nowY=parseInt(btnA.style.top);
		ddEnabled=true;
		document.onmousemove=dd;
	}
	if (objX.id=="sbtn2")
	{
		barA=isIE ? document.all.sbar2 : document.getElementById("sbar2");
		btnA=isIE ? document.all.sbtn2 : document.getElementById("sbtn2");
		saA=isIE ? document.all.sarea2 : document.getElementById("sarea2");
		scA=isIE ? document.all.scont2 : document.getElementById("scont2");
		offsety=isIE||isOP ? event.clientY : e.clientY;
		nowY=parseInt(btnA.style.top);
		ddEnabled=true;
		document.onmousemove=dd;
	}
}

function dd(e)
{
	if (!ddEnabled) return;
	if (isIE||isOP)
	{
		if (isIE&&saA.id=="sarea1") bor=265;
		if (isIE&&saA.id=="sarea2") bor=54;
		posY=nowY+event.clientY-offsety;
	}
	else
	{
		posY=nowY+e.clientY-offsety;
	}
	if (posY<0) posY=0;
	if (posY>(barA.offsetHeight-objX.offsetHeight)) posY=(barA.offsetHeight-objX.offsetHeight);
	btnA.style.top=posY;
	saA.scrollTop=((posY)*(scA.offsetHeight/(saA.offsetHeight-bor)))
	return false;
}

//---------------------------------------------------------------------------[-]
jsOK=document.getElementById && document.documentElement.style;
isIE=document.all && !window.innerHeight;
isOP=document.all && window.innerHeight;
ddEnabled=false;
var bor=0;
var pww="";
var tmr="";
linkJsCss();
document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");
//---------------------------------------------------------------------------[K]