
var tb_show = true;

//If you want it to move faster you can set this lower:
var speed=50;

//Sets variables to keep track of what's happening
var loop, timer;

//Makes the object
var loaded;
//Object constructor

/*
var nindex;
var zIndex=16384;
var VIEWER_ID_PREFIX="BookPhotoViewer";
var VIEWER_ID_IMG_FRAME=VIEWER_ID_PREFIX+"frame";
var VIEWER_ID_LARGE_IMG=VIEWER_ID_PREFIX+"largeImage";

var agent=navigator.userAgent.toLowerCase();
var IE=(agent.indexOf("msie")!=-1&&agent.indexOf("opera")==-1);
var IE7=(agent.indexOf("msie 7")!=-1);
var OPERA=(agent.indexOf("opera")!=-1);
var STRICT_MODE=(document.compatMode=="CSS1Compat");
var _DOMAIN=undefined;
var GALLERY_W=675;
var OPACITY = 0.9;
*/

var tmpimg;

function gotoPic(n) 
{
    if (isNaN(n) == false)
        if (n > 0 && n < picsarray.length)
            picview(eval(n));
    
}
function picview(str)
{
   
	//window.location.reload(true);
    //debugger;
    //document.getElementById("verticalslidesshow").style.display = 'none';
	document.getElementById("main").style.display = 'block';
	document.getElementById("navl").style.display = 'block';
	document.getElementById("navr").style.display = 'block';

	if(eval(str) > 0 && eval(str) < picsarray.length)
	{
		nindex = eval(str);
	}
	else if (eval(str) > picsarray.length - 1)
	{
		nindex = 1;
	}
	else
	{		
		nindex = picsarray.length - 1;	
	}
    tmpimg = document.getElementById("enlarge");
	//alert(nindex);
	//Set timeout while Preload image
	
	window.setTimeout("tmpimg.src = picsarray[eval(nindex)][0];", 300);
	//document.enlarge.src = picsarray[eval(nindex)][0];

    //window.setTimeout("document.VIEWER_ID_LARGE_IMG.src=picsarray[eval(nindex)][0];", 300);		
	//ImageBook();
	
	document.getElementById("index").value = eval(nindex);
	document.getElementById("divcontent").style.display = 'none';
	document.getElementById("navr").style.display = 'block';
	document.getElementById("navl").style.display = 'block';

	document.getElementById("totalimg").innerHTML = 'Photo: ' + countimg(document.getElementById("index").value);
	if (document.getElementById("GoToID") != null)
	    document.getElementById("GoToID").value = eval(nindex);
	//divcomment.innerText = commentarray[nindex]; 
	if(commentarray[nindex] != "")
	{
		document.getElementById("divcomment").style.display = 'block';
		document.getElementById("divcomment").innerHTML = commentarray[nindex];
	}	
}

function piclist()
{
	document.getElementById("divcontent").style.display = 'block';
	document.getElementById("main").style.display = 'none';
	document.getElementById("navl").style.display = 'none';
	document.getElementById("navr").style.display = 'block';
	document.getElementById("divcomment").style.display = 'none';
}

function displayInlineError(sField, sErrMsg)
{
    
    if(sErrMsg != "")
    {
    	divcomment.style.display = 'block';
		var itop;
		var ileft;
		var size;
		var sName;
		var oItem;
	        
		oItem = sField;
		if(typeof(oItem)!="object")
			return;
			    
		itop = 0;
		ileft = 225;
			    
		itop = oItem.offsetHeight;
		while (oItem.tagName != "BODY" )
		{
			itop  += oItem.offsetTop - 2;
			ileft += oItem.offsetLeft;
			oItem = oItem.offsetParent;
		}
			        
		document.getElementById("divcomment").style.left = ileft + "px";
		document.getElementById("divcomment").style.top  = itop + "px"; 
	  
		document.getElementById("divcomment").innerText = sErrMsg; 
		document.getElementById("divcomment").style.display = "inline";
	}
}

function countimg(n)
{
	var numberimg;
	var total = picsarray.length - 1;
	//if(n == 0)
	//    n = total;
	
    numberimg = "<font color=#ff0000> " + n + "</font>" + "/" + total;
    
	return numberimg;
}
//////////////////////////////////////////////
function loadslideshow()
{      
    imageslide();   
    display(); 
}
function makeObj(obj,nest)
{
    nest=(!nest) ? '':'document.'+nest+'.';
	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
  	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight;
	this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight;
	this.up=goUp;this.down=goDown;
	this.moveIt=moveIt; this.x; this.y;
    this.obj = obj+"Object";
    eval(this.obj+"=this");
    
    return this;
}

function moveIt(x,y)
{
	this.x = x;
	this.y = y;
	this.css.left=this.x
	this.css.top=this.y
}

//Makes the object go up
function goDown(move)
{
	if(this.y>-this.scrollHeight+oCont.clipHeight)
	{
		this.moveIt(0,this.y-move);
			if(loop) 
			{
			    setTimeout(this.obj + ".down("+move+")",speed); 
			}
	}
}

//Makes the object go down
function goUp(move)
{
	if(this.y<0)
	{
		this.moveIt(0,this.y-move);
		if(loop) 
			setTimeout(this.obj+".up("+move+")",speed);
	}
}

//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed)
{
	if(loaded)
	{  
		loop = true;
		if(speed>0) 
			oScroll.down(speed);
		else 
			oScroll.up(speed);
	}
}

//Stops the scrolling (called on mouseout)
function noScroll()
{
	loop = false;
	if(timer) clearTimeout(timer);
}


function scrollInit()
{
	oCont=new makeObj('divCont');
	oScroll=new makeObj('divText','divCont');
	
	oScroll.moveIt(0,0)
	oCont.css.visibility='visible';
	loaded = true;
}

//Call the init on page load
onload=scrollInit;

function display()
{
	layhei=page.y2/10*9;
	zellhoehe=page.x2/8*9;
	buthei=page.y2/100*3;
	butwid=page.x2/3*2;
	butwidpos=page.x2/6;
	conheipos=page.y2/100*5;
	butheipos=page.y2/100*97;
	bildbreite=page.x2;
	bildhoehe=bildbreite/4*3;
	//document.write("<div id='divUp'><a href='#' onmouseover='scroll(-10)' onmouseout='noScroll()'><img src='images/buttono.gif' width='"+butwid+"px' height='"+buthei+"px' border='0'></a></div>");
  	//document.write("<div id='divDown'><a href='#' onmouseover='scroll(10)' onmouseout='noScroll()'><img src='images/buttond.gif' width='"+butwid+"px' height='"+buthei+"px' border='0'></a></div><div id='divCont'><div id='divText'>");
	
	//document.write("<div id='divUp'><a href='#' onmouseover='scroll(-10)' onmouseout='noScroll()'><img src='images/buttono.gif' width='90px' height='20px' border='0'></a></div>");
  	//document.write("<div id='divDown'><a href='#' onmouseover='scroll(10)' onmouseout='noScroll()'><img src='images/buttond.gif' width='90px' height='20px' border='0'></a></div>");
	//document.write("<div id='divUp' style='width:80px'><a href='#' onmouseover='scroll(-10)' onmouseout='noScroll()'>Scoll Up</a></div>");
    //document.write("<div id='divDown' style='width:80px'><a href='#' onmouseover='scroll(10)' onmouseout='noScroll()'>Scoll Down</a></div>");
     
      shows();
      window.onresize=resized;
}

function shows()
{
     document.write("<div id='divUp' style='width:50px;'><a href='#' onmouseover='scroll(-10)' onmouseout='noScroll()'>Scroll <img width='16' height='16' border='0' alt='Scroll Down' src='/images/nav-down.gif'></a></div>");
     document.write("<img border='0' style='width: 5px; height: 5px' src='/images/transparent.gif' alt=''><br clear='all'>");
	        
	 document.write("<img border='0' style='width: 5px; height: 5px' src='/images/transparent.gif' alt=''><br clear='all'>");
	   
     document.write("<div id='divCont' style='position:relative;'><div id='divText'><table  cellspacing='0' cellpadding='0'>");
    	
	       
    for(i = 1; i < picsarray.length; i++) 
    {
        picnumx = i;
        if (picnumx < 10)
        {
	        picnumx = i;
        }
	        //document.write("<tr valign='top'><td height='"+zellhoehe+"px'><a href='images/pic"+picnumx+".html' target='FensterAA'><img id='pic"+picnumx+"' onMouseOut=low(this) onMouseOver=high(this) src='picssmall/pic"+picnumx+"s.jpg' width='"+bildbreite+"px' height='"+bildhoehe+"px' border='0' style='position:absolute; left:0; FILTER: alpha(opacity=30); MozOpacity:30%; '></a></td></tr>");
        //For LocalHost
        //document.write("<tr valign='top'><td height='65'><a href='javascript:void(0)' onclick='picview(" + picnumx + ")'><img id='pic"+picnumx+"' onMouseOut=low(this) onMouseOver=high(this) src='../" + picsarray[0][picnumx]+ "' width='70px' height='60px' border='0' style='position:absolute; left:0; FILTER: alpha(opacity=50); MozOpacity:20%; '></a></td></tr>");
       
        //For Website
        document.write("<tr valign='top'><td height='65'><a href='javascript:void(0)' onclick='picview(" + picnumx + ")'><img class='vSlideshowThumbnail' id='pic"+picnumx+"' onMouseOut=low(this) onMouseOver=high(this) src='../" + picsarray[picnumx][1]+ "' style='FILTER: alpha(opacity=50); MozOpacity:20%;'></a></td></tr>");
    }
    document.write("<style type='text/css'>");
	//document.write("#divDown{position:absolute; left:0; top:"+butheipos+";}");
	//document.write("#divUp{position:relative; left:0; top:0;}");
	//document.write("#divCont{position:absolute; width:"+page.x2+"; height:"+layhei+"; overflow:hidden; top:"+conheipos+"; left:0; clip:rect(0,"+page.x2+","+layhei+",0); visibility:hidden;}");
	
	//set the width of slide show
	document.write("#divCont{ width:65px; height:200px; overflow:hidden; top:0; left:0; clip:rect(0,10,0,0); visibility:hidden;}");

	document.write("#divText{float:left; position:relative; top:0; left:0;}");
	document.writeln("</style>");

	document.write("<tr valign='top'><td height='1'>&nbsp;</td></tr>");

	document.write("</table></div>");
	                                                           
}
function domoz()
{
	for(i = 1; i < picsarray.length; i++) 
	{
	    picnumx = i;
	    if (picnumx<10)
	    {
	        picnumx = i;
	    }
	    id="pic"+picnumx;
	        document.getElementById(id).style.MozOpacity='0.3';}
}

//Default browsercheck, added to all scripts!
function checkBrowser()
{
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

bw=new checkBrowser();
/********************************************************************************
Here's the pageobject, see www.bratta.com/dhtml for tutorial on how it works.
********************************************************************************/
function makePageObject(){
	this.x=0;
	this.x2=(bw.ns4 || bw.ns5)?innerWidth:document.body.offsetWidth-4;
	this.y=0;
	this.y2=(bw.ns4 || bw.ns5)?innerHeight:document.body.offsetHeight-4;
	this.x50=this.x2/2;
	this.y50=this.y2/2;
	this.x10=(this.x2*10)/100
	this.y10=(this.y2*10)/100
	this.x15=(this.x2*15)/100
	this.y15=(this.y2*15)/100
	return this;
}
function resized()
{
	page2=new makePageObject();
	//if(page2.x2!=page.x2 || page2.y2!=page.y2){
	//	location.reload() //If the width or height have changed we reload the page.
	//}
}

function imageslide()
{
	page=new makePageObject()
	siz=page.x2/115 + page.y2/115
	zwischenraum=page.x2/200;
	col01 = '#c0c0c0';
	col02 = '#223333';
	col03 = '#556666'; //col03 = '#333333'; col03 = '#445555'; 
	col04 = '#900000';
	col05 = '#00cc99';
	col06 = '#505050';
	col07 = '#202020';
	col08 = '#404040';	
	col09 = '#292929';		
	/*						
    document.write("<style type='text/css'>");
    document.write("a:active { text-decoration:none; color:"+col01+"; }");
    document.write("a:hover { text-decoration:none; color:"+col01+"; }");
    document.write("a:link { text-decoration:none; color:"+col01+"; }");
    document.write("a:visited { text-decoration:none; color:"+col01+"; }");
    document.write(".bodyg { background-color:"+col02+"; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0;width:100%;height:100%;overflow:hidden;}");
    document.write(".bodyb { background-color:"+col03+"; margin-left:0; margin-right:0; margin-top:0; margin-bottom:0;width:100%;height:100%;overflow:hidden;}");
    document.write("font { font-family:Verdana,Arial,sans-serif; }");
    document.write(".fon01 { color:"+col01+"; font-weight:700; font-size:"+siz+"px; }");
    document.write(".fon02 { color:"+col01+"; font-weight:500; font-size:"+siz+"px; }");
    document.write(".fon03 { color:"+col01+"; font-weight:700; font-size:"+siz*1.2+"px; }");
    document.write(".fon04 { color:"+col01+"; font-weight:700; font-size:"+siz*1.5+"px; }");
    document.write(".fon05 { color:"+col04+"; font-weight:700; font-size:"+siz+"px; }");
    document.write(".fon06 { color:"+col04+"; font-weight:700; font-size:"+siz*1.2+"px; }");
    document.write(".fon07 { color:"+col04+"; font-weight:700; font-size:"+siz*2+"px; }");
    document.write(".fon08 { color:"+col04+"; font-weight:700; font-size:"+siz*2.5+"px; }");
    document.write(".fon09 { color:"+col04+"; font-weight:500; font-size:"+siz*.9+"px; }");
    document.write(".fon10 { color:"+col04+"; font-weight:900; font-size:"+siz+"px; }");
    document.write(".fon11 { color:"+col05+"; font-weight:700; font-size:"+siz+"px; visibility:hidden; }");
    document.write(".fon12 { color:"+col05+"; font-weight:700; font-size:"+siz+"px; }");
    document.write(".fon13 { color:"+col02+"; font-weight:500; font-size:"+siz*.1+"px; }");
    document.write(".fon14 { color:"+col03+"; font-weight:500; font-size:"+siz*.9+"px; }");        
    document.write(".fon15 { color:"+col02+"; font-weight:500; font-size:"+siz*.9+"px; }");
    document.write(".fon16 { color:"+col01+"; font-weight:700; font-size:"+page.x2/10+"px; }");
    document.write(".tab01 { border:0px; }");
    document.write(".tab02 { background-color:"+col03+"; border-style:solid; border-width:1px; border-top-color:"+col06+"; border-bottom-color:"+col07+"; border-left-color:"+col06+"; border-right-color:"+col07+"; }");        
    document.write(".tab03 { border:0px; background-color:"+col02+";  padding:0;}");
    document.write(".tab04 { border:0px; background-color:"+col03+"; }");
    //document.write(".tab05 { background-color:"+col02+"; border-style:none; border-width:'"+page.x2/50+"px'; border-color='"+col02+"'; }");              
    //document.write(".cel01 { background-color:"+col02+"; border-style:solid; border-width:1px; border-top-color:"+col08+"; border-bottom-color:"+col09+"; border-left-color:"+col08+"; border-right-color:"+col09+"; cursor:default; }");
    //document.write(".cel02 { background-color:"+col02+"; border-style:solid; border-width:1px; border-top-color:"+col07+"; border-bottom-color:"+col06+"; border-left-color:"+col06+"; border-right-color:"+col07+"; cursor:hand; }");
    document.write(".tab05 { background-color:"+col02+"; border:"+page.x2/50+"px none "+col02+"'; }");              
    document.write(".cel01 { background-color:"+col02+"; border:1px solid; border-top-color:"+col08+"; border-bottom-color:"+col09+"; border-left-color:"+col08+"; border-right-color:"+col09+"; cursor:default; }");
    document.write(".cel02 { background-color:"+col02+"; border:1px solid; border-top-color:"+col07+"; border-bottom-color:"+col06+"; border-left-color:"+col06+"; border-right-color:"+col07+"; cursor:hand; }");
    document.write(".cel03 { padding-top:0px; padding-bottom:"+zwischenraum+"px; padding-left:0px; padding-right:"+zwischenraum+"px; }");
    document.write(".cel04 { padding-top:0px; padding-bottom:"+zwischenraum+"px; padding-left:"+zwischenraum+"px; padding-right:"+zwischenraum+"px; }");
    document.write(".cel05 { background-color:"+col02+"; border-style:solid; border-width:1px; border-top-color:"+col07+"; border-bottom-color:"+col06+"; border-left-color:"+col07+"; border-right-color:"+col06+"; padding-top:"+siz/2+"px; padding-bottom:"+siz/2+"px; padding-left:"+siz/2+"px; padding-right:"+siz/2+"px; }");
    document.write(".cel06 { background-color:"+col03+"; border-style:none; border-width:1px; border-color:"+col03+"; }");  
   	document.write(".seeon { visibility:visible; }");
   	document.write(".seeof { visibility:hidden; }");
    document.write(".alig01 { text-align:center; vertical-align:top; }");
    document.write(".alig02 { text-align:center; vertical-align:middle; }");
    document.write(".alig03 { text-align:center; vertical-align:bottom; }"); 
    document.write(".horu1 { color:"+col02+"; }"); 	
   	document.write("</style>");
   	*/
    window.onresize=resized;
}

//////////////////////////
function high(which)
{
	theobject=which;
	highlighting=setInterval("highlightit(theobject)",50);
}

function low(which)
{
	clearInterval(highlighting);
	objb=which.style;
	objb.MozOpacity='0.3';
	objb.filter = "Alpha(Opacity=30)";
}

function highlightit(obj)
{
	nnmoz=obj.style.MozOpacity;
	nnmozb=parseFloat(nnmoz)+(1/20);
	if(obj.style.MozOpacity<1)
    {
		obj.style.MozOpacity=nnmozb;
		//Temp
		//obj.filters.alpha.opacity+=5;
	}
	else
    {
		obj.style.MozOpacity='1';
		obj.style.filter = "Alpha(Opacity=100)";
		clearInterval(highlighting);
	}
}

/////////////////////////////////////////////////////////////////



