/**
	Copyright (c) 2000-2002, Springsite (www.springsite.com). All rights reserved.
*/

// <script language="javascript"> // Trick to enforce Visual Studio syntax coloring.
	
	/**
		different popup scripts
	*/
	function PressWin(destination)
	{
		var now = new Date();
		var millis = now.getMilliseconds();
		window.open(destination,'PressRelease' + millis,"toolbar=0,location=no,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,copyhistory=0,width=675,height=450");
	}
 	
	function PressVLWin(destination)
	{ 
		var now = new Date();
		var millis = now.getMilliseconds();
		window.open(destination,'WL' + millis,"toolbar=0,location=no,directories=0,status=1,menubar=1,scrollbars=0,resizable=1,copyhistory=0,width=1024,height=768");
	}


	function PressLargeWin(destination)
	{
		var now = new Date();
		var millis = now.getMilliseconds();
		window.open(destination,'PressRelease' + millis,"width=675, scrollbars=1");
	}

	function OpenWin(destination)
	{
		var now = new Date();
		var millis = now.getMilliseconds();
		window.open(destination,'W' + millis,"scrollbars=1");
	}

    function ProductWin(destination)
    {
		var now = new Date();
		var millis = now.getMilliseconds();
    	window.open(destination,'Banners' + millis,"toolbar=0,location=no,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,copyhistory=0,width=675,height=520");
    }

    function check(destination)
    {
		if(destination != '') window.location.href = destination;
		else window.status = 'Select a product';
    }

    function launchRemote(WindowURL)
    {
		var now = new Date();
		var millis = now.getMilliseconds();
    	myRemote = open(WindowURL,"venster" + millis,"width=675,height=400,directories=0,location=0,menubar=1,resizable=1,scrollbars=0,status=0,titlebar=1,toolbar=0","myWindow");
    }

	/**
		worldmap images mouseover flipscript
	*/
	function newImage(arg) {
		if (document.images) {
			rslt = new Image();
			rslt.src = arg;
			return rslt;
		}
	}
	function changeImages() {
		if (document.images)
		{
			for (var i=0; i<changeImages.arguments.length; i+=2)
			{
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}

	/**
		sets message text and url of flash animation
	*/
	function message()
	{
		if( window.txtmovie )
		{
			window.txtmovie.SetVariable('_root.textfield', window.animation.msg.value);
			window.txtmovie.SetVariable('_root.flashurl', window.animation.url.value);
		}
	}

	/**
		stores iUrl and flasEnabled flag in cookie and redirects to iUrl
	*/
	function jumpTo( iUrl )
	{
		if( iUrl )
		{
			var lExpiryDate = new Date();
			var lNextYear = lExpiryDate.getTime() + (365*24*60*60*1000);
			lExpiryDate.setTime( lNextYear );
			var lSplitIndex = iUrl.indexOf( '?' );
			var lCookieUrl = iUrl;
			if( lSplitIndex > 0 )
			{
				lCookieUrl = iUrl.substr( 0, lSplitIndex );
			}
			document.cookie = 'sitenew=' + escape( lCookieUrl ) + "; expires=" + lExpiryDate.toGMTString();
			document.cookie = 'flash=' + isFlashEnabled() + "; expires=" + lExpiryDate.toGMTString();
			document.location = iUrl;
		}
	}
		
	/**
		returns the value of the cookie specified by iName (or null if not defined)
	*/
	function readCookie( iName )
	{
		if (document.cookie == '')
		{
			return false;
		}
		else
		{
			var firstChar, lastChar;
			var aWholeCookie = document.cookie;

			firstChar = aWholeCookie.indexOf( iName );
			if( firstChar != -1 )
			{
				firstChar += iName.length + 1;
				// skip 'name' and '='
				lastChar = aWholeCookie.indexOf(';', firstChar);
				if( lastChar == -1 ) lastChar = aWholeCookie.length;
				return unescape( aWholeCookie.substring( firstChar, lastChar ) );
			}
			else
			{
				return false;
			}
		}
	}
		
		
	/**
		forwards the client to the url stored in the cookie, if available
	*/
	function forward()
	{
		var lRedirect = readCookie('sitenew');
		if( lRedirect )
		{
			jumpTo( lRedirect );
		}
		return false;
	}
		
	/**
		returns if a flash plugin has been detected on the client
	*/
	function isFlashEnabled()
	{
		if( readCookie( 'flash' ) == 'true' )
		{
			return true;
		}
		else
		{
			var lPlugin;

			if( document.layers ) //NN is capable for detecting plugins through mimeTypes collection
			{
				lPlugin = navigator.mimeTypes['application/x-shockwave-flash'];
				return ( lPlugin && lPlugin.enabledPlugin );
			}
			else //MSIE (or others)
			{
				var lAgent = navigator.userAgent.toLowerCase();
				var lIndex = lAgent.indexOf("msie"); 
				if( lIndex != -1 && parseInt( lAgent.substring( lIndex + 5, lIndex + 6 ) ) >= 5  )
				{
					//this only works for IE 5.x (because of ActiveXObject and try-catch JS)
					//detects any flash plugin

					try
					{
						lPlugin = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
					}
					catch (e) //catching MS errors like 'Automation server can't create object'
					{
						void( lPlugin );
					}
					return lPlugin != null;
				}
				else
				{
					//for other browsers, just use HTML version
				    return false;
				}
			}
		}
	}


/**
	End of Module.
*/
