/**********************************
* Dataspeed(R) Javascript File
*-------------------------------
* Filename:     dsmain.js
* Author:       Daniel Groom
* Date Created: 17-May-2002
* Description:  General functions used with website.
*
**********************************/

// Detect browser type and version.
var dsBrowser					= "";
var dsUserAgent				= navigator.userAgent;

if ( dsUserAgent.indexOf("MSIE") == -1 )
	{ dsBrowser = "IE"; }
else
	{ if ( navigator.appName == 'Netscape' ) 
			{ dsBrowser = "NS";	}
		else
			{	dsBrowser = "NA"; }
	}

/*********************************/

var iDLWindow		 				= 0;

/*----------------------*/

function jsPDFWin(r_FileName)
	{ // dg 21/07/04
		
		jsOpenWin(r_FileName, '', 800, 620);
		
	}

function jsOpenWin(r_Filename, r_WindowName, r_Width, r_Height, r_Scroll, r_Maximise)
  { // dg 17/05/2002
		var nLeft = 0;
    var nTop  = 0;
		var oNow  = new Date;
		
		if ( r_Filename != 'undefined' && r_Filename != "" )
	  	{ 
  			if ( r_WindowName == 'undefined' || r_WindowName == "" )
  		  	{ r_WindowName = "DS_WIN"+ oNow.getTime(); }
				
    		if ( r_Width == 'undefined' || r_Width == 0 )
    		  { r_Width = 100; }
    		
    		if ( r_Height == 'undefined' || r_Height == 0 )
    		  { height = 100; }
    		
    		if ( r_Scroll == 'undefined' || r_Scroll == false )
    		  { r_Scroll = "no"; }
    		else
  				{ r_Scroll = "yes"; }		  
        
				// Create and open window object.
    		oWin = window.open(r_Filename, r_WindowName,"toolbar=no,width="+r_Width+",height="+r_Height+",left="+nLeft+",top="+nTop+",status=no,scrollbars="+r_Scroll+",resize=no");
    		
  			if ( r_Maximise )
    		  {	
  					oWin.moveTo(0, 0);
  					
  					// Screen object is available ?
						if ( window.screen )
  						{	
  							oWin.resizeTo(screen.availWidth, screen.availHeight);
  						}
  					else
  						{ 
  							oWin.outerHeight = 600;
  							oWin.outerWidth = 600;
  						} 
  				}
  	  }
  }

/*----------------------*/

function jsStatusText(r_Text)
  { // dg 10/02/2003
		window.status = r_Text;
		return true;
  }

/*----------------------*/

function jsShowPage(r_Url)
  { // dg 15/01/2002
		sExt = '.php';
		
		top.main.location.href = sUrl + sExt;
  }

/*----------------------*/

function jsDownloadThingy(vPath, vFile, vSystem)
  { // dg 10/05/2002
		if ( confirm("Download '" + vSystem + "' update ?") )
      { top.location.href = vPath + vFile; }
  }

/*----------------------*/

function jsFrameCheck()
  { // dg 20/05/2002
		if ( top.location == self.location )
		  { top.location.href = "/index.php"; }
		
		WM_netscapeCssFixCheckIn();
  }

/*----------------------*/

/*********************************************************************************

Term And Conditions for code below:

  http://hotwired.lycos.com/webmonkey/reference/javascript_code_library/license/wpl.html

  This Code is subject to the terms, conditions, warranties, and disclaimers of the Webmonkey Public License, Version 1.0 located at http://www.hotwired.com/webmonkey/javascript/code_library/license/wpl.html. Original Code is (c) 1998 Wired Digital Inc. (and, if applicable, Modifications are (c) Date: _______________ Author: ________________; Author URL: ______________; Author Email:___________________). All Rights Reserved. This Code came from the Webmonkey Code Library located at http://www.hotwired.com/webmonkey/javascript/code_library/. Webmonkey is a registered trademark of Wired Ventures Inc.

*********************************************************************************/

function WM_netscapeCssFix() 
	{ /*
      Source: Webmonkey Code Library
      (http://www.hotwired.com/webmonkey/javascript/code_library/)
  		
      Author: Taylor
      Author Email: taylor@wired.com
      Author URL: http://www.taylor.org/
  		
    */
		  
    // This part was inspired by Matthew_Baird@wayfarer.com
    // It gets around another unfortunate bug whereby Netscape 
    // fires a resize event when the scrollbars pop up. This 
    // checks to make sure that the window's available size 
    // has actually changed.
    if (document.WM.WM_netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.WM_netscapeCssFix.initWindowHeight != window.innerHeight)
  		{
        document.location = document.location;
      }
  }

function WM_netscapeCssFixCheckIn() 
	{	// This function checks to make sure the version of Netscape 
    // in use contains the bug; if so, it records the window's 
    // width and height and sets all resize events to be handled 
    // by the WM_netscapeCssFix() function.
    if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) 
  		{
        if (typeof document.WM == 'undefined')
    			{
          	document.WM = new Object;
    	    }
        if (typeof document.WM.WM_scaleFont == 'undefined') 
    			{
            document.WM.WM_netscapeCssFix = new Object;
            document.WM.WM_netscapeCssFix.initWindowWidth = window.innerWidth;
            document.WM.WM_netscapeCssFix.initWindowHeight = window.innerHeight;
          }
        window.onresize = WM_netscapeCssFix;
      }
	}

function addDsFlash(pageName)
{
	var flashvars = {
		heading:pageName
	};
	var params = {
		menu: "false",
		scale: "noScale",
		allowFullscreen: "false",
		allowScriptAccess: "always",
		bgcolor: "#ffffff",
		wmode:"transparent"
	};
	var attributes = {
		id:"flashMenu"
	};
        swfobject.embedSWF("../shared/head_page.swf", "theMenu", "784", "128", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

function addDsFlashIndex()
{
	var flashvars = {
		heading:'INDEX'
	};
	var params = {
		menu: "false",
		scale: "noScale",
		allowFullscreen: "false",
		allowScriptAccess: "always",
		bgcolor: "#ffffff",
		wmode:"transparent"
	};
	var attributes = {
		id:"flashMenu"
	};
	swfobject.embedSWF("../shared/head_index.swf", "theMenu", "784", "192", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

