var slideShowWin=null;

function Browser() {
	var b=navigator.appName;
	if (b.indexOf('Netscape')!=-1) this.b="ns";
	else if ((b=="Opera") || (navigator.userAgent.indexOf("Opera")>0)) this.b = "opera";
	else if (b=="Microsoft Internet Explorer") this.b="ie";
	if (!b) alert('Unidentified browser.\nThis browser is not supported,');
	this.version=navigator.appVersion;
	this.v=parseInt(this.version);
	this.ns=(this.b=="ns" && this.v>=4);
	this.ns4=(this.b=="ns" && this.v==4);
	this.ns6=(this.b=="ns" && this.v==5);
	this.ie=(this.b=="ie" && this.v>=4);
	this.ie4=(this.version.indexOf('MSIE 4')>0);
	this.ie5=(this.version.indexOf('MSIE 5')>0);
	this.ie55=(this.version.indexOf('MSIE 5.5')>0);
	this.ie6=(this.version.indexOf('MSIE 6.0')>0);
	this.opera=(this.b=="opera");
	this.dom=(document.createElement && document.appendChild && document.getElementsByTagName)?true:false;
	this.def=(this.ie||this.dom); // most used browsers, for faster if loops
	var ua=navigator.userAgent.toLowerCase();
	if (ua.indexOf("win")>-1) this.platform="win32";
	else if (ua.indexOf("mac")>-1) this.platform="mac";
	else this.platform="other";
}
is=new Browser();

var dimReady=false;
var sWidth=null;
var sHeight=null;

// This is the main entry point for invoking the slide show from a user page.
// See comments in "slideshow.html"
function launch_slideshow(slideShowFile,width,height)
{
	var len = launch_slideshow.arguments.length;
	// Setup some default dimension in case no args are given.
	// Inc by 10
	var w=((is.platform=="mac") ? (is.ie ? 550 : 480) : 550);
	var h=((is.ie && is.platform=="mac") ? 620 : 550); 
	var f="slideshow.html";
	
	// If already open and running, then close it first.
	if (slideShowWin != null)
	{
		slideShowWin.close();  slideShowWin = null;
	}
	// Override the defaults if alternates provided.
	if (len > 0) f = slideShowFile;
	if (len > 1) w = width;
	if (len > 2) h = height;
	
	availX = window.screen.availWidth;
	availY = window.screen.availHeight;
	var too_big=false;
	if(w>(availX-25))
	{
		too_big=true;
		w=availX-25
	}
	if(h>(availY-30))
	{
		too_big=true;
		h=availY-30
	}
	

	// alert("(w,h)=("+w+","+h+")");
	// Open the slide show window.


	if(false) //too_big)
	{
		slideShowWin = window.open(f,'slideshow','status=no,toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,copyhistory=no,width='+w+',height='+h);
		slideShowWin.sWidth = sWidth = w - 14;
		slideShowWin.sHeight = sHeight = h - 14;
		slideShowWin.too_big=true;
	}else
	{
		if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)==4) 
		{
			resizeable='yes'
		}else
		{
			resizeable='no'
		}
       		
       		slideShowWin = window.open(f,'slideshow','status=no,toolbar=no,location=no,directories=no,scrollbars=no,resizable=' + resizeable + ',copyhistory=no,width='+w+',height='+h);
		slideShowWin.sWidth = sWidth = w;
		slideShowWin.sHeight = sHeight = h;
		slideShowWin.too_big=false;
	}
	slideShowWin.requested_width = width;
	slideShowWin.requested_height = height;
//	slideShowWin.moveTo(0,0);
	slideShowWin.dimReady = dimReady = true;
}

