//slideshow functions
function startSlideShow(delay)
{
    setTimeout("next()",delay);
}
   
// this function will be called when the image has been loaded and it
// will resize the image and turns on the visibility for the layer. 
function ResizeImage()
{
    var ns = (navigator.appName == "Netscape") ? true : false;
    
	var iheight = ns ? window.innerHeight : document.body.clientHeight;
	var iwidth = ns ? window.innerWidth : document.body.clientWidth;
	var imwidth = document.images[0].width;
	var imheight = document.images[0].height;
	
	iheight -= 200;        
	iwidth -= 40;
	var portrait = imwidth < imheight ? true : false;
	var newwidth = 0; 

	if(portrait)
	{
		if(imwidth * (iheight / imheight) > iwidth)
		{
			document.images[0].height = imheight * (iwidth / imwidth);
			newwidth = document.images[0].width = iwidth;
		}
		else
		{
			document.images[0].height = iheight;
			newwidth = document.images[0].width = imwidth * (iheight / imheight);
		}
	}
	else
	{
		if(imheight * (iwidth / imwidth) > iheight)
		{
			document.images[0].height = iheight;
			newwidth = document.images[0].width = imwidth * (iheight / imheight);
		}
		else
		{
			document.images[0].height = imheight * (iwidth / imwidth);
			newwidth = document.images[0].width = iwidth;
		}
	}
	
	//document.getElementById('wait').style.visibility = 'hidden';
	document.getElementById('resizeme').style.visibility = 'visible';
	document.getElementById('resizeme').style.top = 5;
	document.getElementById('resizeme').style.left = iwidth / 2 - (newwidth / 2);
}


function PopupImage(strImageName,nImageWidth,nImageHeight) 
{
	var bgcolor = "#ffffff";
	var adj=10;
	var w = screen.width;
	var h = screen.height;
	var scrWidth = w;
	var scrHeight = h;
	var hugMargin = 20; 
	
	var scrHeightTemp = nImageHeight - 0 + 2*hugMargin;
	if (scrHeightTemp < scrHeight) { scrHeight = scrHeightTemp; } 

	var scrWidthTemp = nImageWidth - 0 + 2*hugMargin;
	if (scrWidthTemp < scrWidth) { scrWidth = scrWidthTemp; }

	var posTop =  ((h-scrHeight)/2);
	var posLeft = ((w-scrWidth)/2);
	
	var agt=navigator.userAgent.toLowerCase(); 
	var is_opera = (agt.indexOf("opera") != -1); 

	if (is_opera === true)
	{
		var args = new Array();
		args[0]='parent';
		args[1]=strImageName;
		var i ; 
		document.MM_returnValue = false;
		
		for (i=0; i<(args.length-1); i+=2) 
        {
            eval(args[i]+".location='"+args[i+1]+"'");
        }
	} 
	else 
	{
		var strOptions = "width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop;
		var newWindow = window.open(strImageName,"ImageWindow", strOptions);
	}
}

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

function low(which2)
{
	clearInterval(highlighting);
	which2.filters.alpha.opacity = 20;
}

function highlightit(cur2)
{
    if (cur2.filters.alpha.opacity<100)
    {
        cur2.filters.alpha.opacity+=5;
    }
    else if (window.highlighting)
    {
        clearInterval(highlighting);
    }
}

