var reset, distance;

// The Concise Platform and Browser sniffer - Mark 2
// This Script has been taken from the NET and modified to include ALOT more
// Browsers as well as Platforms then previously.
// Written by Lukas Smola 14 January 2003 Version 1.2 

	var agt					= navigator.userAgent.toLowerCase();
	var is_major 		= parseInt(navigator.appVersion);
	var is_minor 		= parseFloat(navigator.appVersion);
	var is_nav  		= ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
	            			&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
	            			&& (agt.indexOf('webtv')==-1));
	var is_mac    	= (agt.indexOf("mac")!=-1); 
	var is_os2   		= ((agt.indexOf("os/2")!=-1) || 
	                	(navigator.appVersion.indexOf("OS/2")!=-1) ||   
	                	(agt.indexOf("ibm-webexplorer")!=-1));
	var is_linux 		= (agt.indexOf("inux")!=-1);
	var is_win   		= ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
	var is_nav2 		= (is_nav && (is_major == 2));
	var is_nav3 		= (is_nav && (is_major == 3));
	var is_nav4 		= (is_nav && (is_major == 4));
	var is_nav4up 	= (is_nav && (is_major >= 4));
	var is_nav46up 	= (is_nav && (is_major >= 4) && (is_minor >= 4.6) );
	var is_nav46down= (is_nav && (is_major <= 4) && (is_minor <= 4.6) );
	var is_navonly  = (is_nav && ((agt.indexOf(";nav") != -1) ||
	                  (agt.indexOf("; nav") != -1)) );
	var is_nav5 		= (is_nav && (is_major == 5));
	var is_nav5up 	= (is_nav && (is_major >= 5));
	var is_ie   		= (agt.indexOf("msie") != -1);
	var is_ie3  		= (is_ie && (is_major < 4));
	var is_ie4  		= (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
	var is_ie4up  	= (is_ie && (is_major >= 4));
	var is_ie4down  = (is_ie && (is_major < 4));
	var is_ie5  		= (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
	var is_ie5up  	= (is_ie && !is_ie3 && !is_ie4);


function windowOpen(imageLocation, imageWidth, imageHeight) {
	if (is_nav4) {
			displayWindow=window.open("","dynamicWindow","toolbar=no,width=" +imageWidth+ ",height=" +imageHeight+ ",directories=no,status=yes,scrollbars=no,resizable=no,menubar=no");
			displayWindow.document.write('<div style="position:absolute; top:0px; left:0px; z-index:3;">');
			displayWindow.document.write('<title>Click to close this window</title>'); 
			displayWindow.document.write('<a href="javascript:window.close();"><img src="'+imageLocation+'" width="'+imageWidth+'" height="'+imageHeight+'" border="0" alt="Click on Image to close window"></a>');
			displayWindow.document.write('</div>');
			displayWindow.document.bgColor = '#FFFFFF';
	}	else {
	displayWindow=window.open("","dynamicWindow","toolbar=no,width=100,height=100,directories=no,status=no,scrollbars=no,resizable=no,menubar=no");
	displayWindow.document.write('<div style="position:absolute; top:0px; left:0px; z-index:3;">');
	displayWindow.document.write('<title>Click to close this window</title>'); 
	displayWindow.document.write('<a href="javascript:window.close();"><img src="'+imageLocation+'" width="'+imageWidth+'" height="'+imageHeight+'" border="0" alt="Click on Image to close window"></a>');
	displayWindow.document.write('</div>');
	displayWindow.document.bgColor = '#FFFFFF';
	displayWindow.document.close();
	displayWindow.window.focus();
	resizeStart(imageWidth,imageHeight);
	}


function resizeStart(targetWidth,targetHeight)
{ 
	if (reset) { clearTimeout(reset); }
	// increase target height to allow for title bar in window
	// Martin Bauer 9/3/03
	targetHeight = targetHeight + 30;
	var currentWidth = (window.innerWidth) ? displayWindow.window.innerWidth : parseInt(displayWindow.document.body.clientWidth);
	var currentHeight = (window.innerHeight) ? displayWindow.window.innerHeight : parseInt(displayWindow.document.body.clientHeight);
	resizeCycle(targetWidth,targetHeight,currentWidth,currentHeight);
}

	
function resizeCycle(targetWidth,targetHeight,currentWidth,currentHeight)
{ 
	if ((currentWidth != targetWidth) && (currentHeight != targetHeight))
	{ 
		if (currentWidth < targetWidth)
		{ distance = targetWidth - currentWidth;
			distance = (distance/10);
			distance = Math.round(distance);
			distance = (distance<1)?1:distance;
			currentWidth += distance;
		} 
		else
		{ distance = currentWidth - targetWidth;
			distance = (distance/10);
			distance = Math.round(distance);
			distance = (distance<1)?1:distance;
			currentWidth -= distance;
		}
		if (currentHeight < targetHeight)
		{ distance = targetHeight - currentHeight;
			distance = (distance/10);
			distance = Math.round(distance);
			distance = (distance<1)?1:distance;
			currentHeight += distance;
		} 
		else
		{ distance = currentHeight - targetHeight;
			distance = (distance/10);
			distance = Math.round(distance);
			distance = (distance<1)?1:distance;
			currentHeight -= distance;
		}
		displayWindow.window.resizeTo(currentWidth,currentHeight);
		reset = setTimeout('resizeCycle('+targetWidth+','+targetHeight+','+currentWidth+','+currentHeight+')','25');
	}
	return;
}
	
function findObj(n,d)
// searches document for object id tags
{ 
	var p,i,x
	if(!d)d=document;
	if(document.all)
	{ x = eval("document.all."+n);
		return x;
	}
	if((p=n.indexOf("?"))>0&&parent.frames.length)
	{ d=parent.frames[n.substring(p+1)].document
		n=n.substring(0,p)
	}
	if(!(x=d[n])&&d.all) x=d.all[n]
	if(!(x=d[n])&&d.getElementById) x=d.getElementById(n)
	for (i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n]
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=findObj(n,d.layers[i].document, '0')
	return x
}

