var d = document;
var ns = d.layers;
var app = navigator.appVersion;
var tresholdWidth = 1000;
var wideScreen = false;

window.onload = function(){ AdjustWidth( true ); }
window.onresize = function(){ AdjustWidth( true ); }



function AdjustWidth( loaded )
{
	if( d.getElementById && (app.indexOf("MSIE 5")==-1) )
	{
		var w = document.body.clientWidth;
		var c = d.getElementById( "pagehead" );

		var x = d.getElementById( "mainp" );

		if( w < tresholdWidth )
		{
			c.setAttribute("style","width: 780px !important" );
			c.style.width = "780 px";

			if( loaded )
			{ 
				x.setAttribute("style","width: 780px !important" );
				x.style.width = "780 px";

			}
			wideScreen = false;
		}
		else if( w > tresholdWidth && wideScreen == false )
		{
			c.setAttribute("style","width: 970px !important" );
			c.style.width = "970px";

			if( loaded )
			{
				x.setAttribute("style","width: 970px !important" );
				x.style.width = "970px";
				wideScreen = true;
			}
		}
	}
}


if( d.layers )
{
	var url = location.href.split("/");
	var filename = url[ url.length-1 ];
	if( filename.indexOf("ns4_") == -1)
	{
		if( filename != "" )
		{
			newhref = "ns4_" + filename;
		}
		else
		{
			newhref = "ns4_index.html";
		}
		location.replace( newhref );
	}
}

// slideshow
function gotoshow()
{
	if (newwindow)
	{
		window.open(slidelinks[whichlink]);
	}
	else
	{
		window.location=slidelinks[whichlink];
	}
}

function slide_init1()
{
	for (i=0;i<slideimages.length;i++)
	{
		imageholder[i]=new Image();
		imageholder[i].src=slideimages[i];
	}
}

function slideit()
{
	if (!d.images) return;
	if (ie) d.images.slide.filters[0].apply();
	d.images.slide.src=imageholder[whichimage].src;
	if (ie) d.images.slide.filters[0].play();
	whichlink=whichimage;
	whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0;
	setTimeout("slideit()",slidespeed+blenddelay);
}
