﻿	//--------------------------------------------------------------------------
	// Description:		Site wide functions
	// Copyright:		© 2001 Magdex Limited. All rights reserved
	// Author:			Glenn Jones
	// Date Created:		5 Dec 2001
	// Last Modified:		5 Dec 2001
	// Version:		1
	//--------------------------------------------------------------------------

	var menuimg
	var is
	


	//--------------------------------------------------------------------------
	// Based on Netscape JavaScript Client Sniffer OO, Version 3.0
	function Is () {
		var agt=navigator.userAgent.toLowerCase();
		this.major = parseInt(navigator.appVersion);
		this.minor = parseFloat(navigator.appVersion);
		this.nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
	                && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
	                && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
		this.nav2 = (this.nav && (this.major == 2));
		this.nav3 = (this.nav && (this.major == 3));
		this.nav4 = (this.nav && (this.major == 4));
		this.nav4up = (this.nav && (this.major >= 4));
		this.navonly      = (this.nav && ((agt.indexOf(";nav") != -1) ||
	                          (agt.indexOf("; nav") != -1)) );
		this.nav6 = (this.nav && (this.major == 5));
		this.nav6up = (this.nav && (this.major >= 5));
		this.gecko = (agt.indexOf('gecko') != -1);
		this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
		this.ie3    = (this.ie && (this.major < 4));
		this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5")==-1) );
		this.ie4up  = (this.ie  && (this.major >= 4));
		this.ie5    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
		this.ie5_5  = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5") !=-1));
		this.ie5up  = (this.ie  && !this.ie3 && !this.ie4);
		this.ie5_5up =(this.ie && !this.ie3 && !this.ie4 && !this.ie5);
		this.aol   = (agt.indexOf("aol") != -1);
		this.aol3  = (this.aol && this.ie3);
		this.aol4  = (this.aol && this.ie4);
		this.opera = (agt.indexOf("opera") != -1);
		this.opera4 = (agt.indexOf("opera 4") != -1);
		this.opera5 = (agt.indexOf("opera 5") != -1);
		this.opera5up = (this.opera && (this.major >=4));
		this.webtv = (agt.indexOf("webtv") != -1); 
		this.TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
		this.AOLTV = this.TVNavigator;
		this.hotjava = (agt.indexOf("hotjava") != -1);
		this.hotjava3 = (this.hotjava && (this.major == 3));
		this.hotjava3up = (this.hotjava && (this.major >= 3));
		this.win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
		this.win95 = ((agt.indexOf("win95")!=-1) || (agt.indexOf("windows 95")!=-1));
		this.win16 = ((agt.indexOf("win16")!=-1) || 
	               (agt.indexOf("16bit")!=-1) || (agt.indexOf("windows 3.1")!=-1) || 
	               (agt.indexOf("windows 16-bit")!=-1) );  
		this.win31 = ((agt.indexOf("windows 3.1")!=-1) || (agt.indexOf("win16")!=-1) ||
	                    (agt.indexOf("windows 16-bit")!=-1));
		this.win98 = ((agt.indexOf("win98")!=-1) || (agt.indexOf("windows 98")!=-1));
		this.winnt = ((agt.indexOf("winnt")!=-1) || (agt.indexOf("windows nt")!=-1));
		this.win32 = (this.win95 || this.winnt || this.win98 || 
	                    ((this.major >= 4) && (navigator.platform == "Win32")) ||
	                    (agt.indexOf("win32")!=-1) || (agt.indexOf("32bit")!=-1));
		this.mac    = (agt.indexOf("mac")!=-1);
		this.mac68k = (this.mac && ((agt.indexOf("68k")!=-1) || 
						(agt.indexOf("68000")!=-1)));
		this.macppc = (this.mac && ((agt.indexOf("ppc")!=-1) || 
						(agt.indexOf("powerpc")!=-1)));
		this.linux = (agt.indexOf("inux")!=-1);
		this.baseline = ((this.nav4up) || (this.ie4up)) 
	}
	var isIE3Mac = false;
	if ((navigator.appVersion.indexOf("Mac")!=-1) && (navigator.userAgent.indexOf("MSIE")!=-1) && (parseInt(navigator.appVersion)==3)) {
	    isIE3Mac = true;
	} else { 
	    is = new Is(); 
	}



	// Image functions
	//--------------------------------------------------------------------------
	homea = new Image();
	homea.src = "images/menu/home.gif"
	meetingsa = new Image();
	meetingsa.src = "images/Menu/meetings.gif"
	editoriala = new Image();
	editoriala.src = "images/Menu/editorial.gif"
	newmediaa = new Image();
	newmediaa.src = "images/Menu/newmedia.gif"
	traininga = new Image();
	traininga.src = "images/Menu/training.gif"
	cmea = new Image();
	cmea.src = "images/Menu/cme.gif"
	experta = new Image();
	experta.src = "images/Menu/expert.gif"
	factsheetsa = new Image();
	factsheetsa.src = "images/Menu/factsheets.gif"
	abouta = new Image();
	abouta.src = "images/Menu/about.gif"
	networkpartnersa = new Image();
	networkpartnersa.src = "images/Menu/networkpartners.gif"
	careersa = new Image();
	careersa.src = "images/Menu/careers.gif"
	extraneta = new Image();
	extraneta.src = "images/Menu/extranet.gif"
	contactusa = new Image();
	contactusa.src = "images/Menu/contactus.gif"
	facilicama = new Image();
	facilicama.src = "images/Menu/facilicam.gif"
	amazinga = new Image();
	amazinga.src = "images/Menu/amazing.gif"


	homeb = new Image();
	homeb.src = "images/Menu/home_on.gif"
	meetingsb = new Image();
	meetingsb.src = "images/Menu/meetings_on.gif"
	editorialb = new Image();
	editorialb.src = "images/Menu/editorial_on.gif"
	newmediab = new Image();
	newmediab.src = "images/Menu/newmedia_on.gif"
	trainingb = new Image();
	trainingb.src = "images/Menu/training_on.gif"
	cmeb = new Image();
	cmeb.src = "images/Menu/cme_on.gif"
	expertb = new Image();
	expertb.src = "images/Menu/expert_on.gif"
	factsheetsb = new Image();
	factsheetsb.src = "images/Menu/factsheets_on.gif"
	aboutb = new Image();
	aboutb.src = "images/Menu/about_on.gif"
	networkpartnersb = new Image();
	networkpartnersb.src = "images/Menu/networkpartners_on.gif"
	careersb = new Image();
	careersb.src = "images/Menu/careers_on.gif"
	extranetb = new Image();
	extranetb.src = "images/Menu/extranet_on.gif"
	contactusb = new Image();
	contactusb.src = "images/Menu/contactus_on.gif"
	facilicamb = new Image();
	facilicamb.src = "images/Menu/facilicam_on.gif"
	amazingb = new Image();
	amazingb.src = "images/Menu/amazing_on.gif"

	homec = new Image();
	homec.src = "images/Menu/home_over.gif"
	meetingsc = new Image();
	meetingsc.src = "images/Menu/meetings_over.gif"
	editorialc = new Image();
	editorialc.src = "images/Menu/editorial_over.gif"
	newmediac = new Image();
	newmediac.src = "images/Menu/newmedia_over.gif"
	trainingc = new Image();
	trainingc.src = "images/Menu/training_over.gif"
	cmec = new Image();
	cmec.src = "images/Menu/cme_over.gif"
	expertc = new Image();
	expertc.src = "images/Menu/expert_over.gif"
	factsheetsc = new Image();
	factsheetsc.src = "images/Menu/factsheets_over.gif"
	aboutc = new Image();
	aboutc.src = "images/Menu/about_over.gif"
	networkpartnersc = new Image();
	networkpartnersc.src = "images/Menu/networkpartners_over.gif"
	careersc = new Image();
	careersc.src = "images/Menu/careers_over.gif"
	extranetc = new Image();
	extranetc.src = "images/Menu/extranet_over.gif"
	contactusc = new Image();
	contactusc.src = "images/Menu/contactus_over.gif"
	facilicamc = new Image();
	facilicamc.src = "images/Menu/facilicam_over.gif"
	amazingc = new Image();
	amazingc.src = "images/Menu/amazing_over.gif"


	function imgOn(imgName) {
		if (document.images) {
			if(menuimg != imgName) {
				document[imgName].src = eval(imgName + "c.src");
			}
	    }
	}
	
	function imgSelected(imgName) {
	    if (document.images) {
	        document[imgName].src = eval(imgName + "b.src");
	    }
	}
	
	function imgOff(imgName) {
	    if (document.images) {
			if(menuimg == imgName) {
				document[imgName].src = eval(imgName + "b.src");
			} else{
				document[imgName].src = eval(imgName + "a.src");
			}
	    }
	}


	function OpenWin(strLocation,width,height,chrome) {
		var objWindow
		winleft = (screen.width - width) / 2
		wintop = (screen.height - height) / 2
		if (chrome == true){
			winprops = 'height=' +height + ',width=' + width + ',top=' + wintop + ',left=' + winleft + ',status=yes,toolbar=yes,menubar=yes,location=yes,status=yes,resizable=yes'
		}else{
			winprops = 'height=' +height + ',width=' + width + ',top=' + wintop + ',left=' + winleft + ''
		}
		objWindow = window.open(strLocation,"screenshots",winprops)
	}


	// Twisty Content Display
	//--------------------------------------------------------------------------
	
	function TwistCloseAll()
	{
		var ClassNameRef = "class";
		if(is.ie == true) 
		{
			ClassNameRef = "className";
		}
		if(document.getElementById)
		{
			var aParagraphs = document.getElementsByTagName("DIV");
			for (i = 0; i < aParagraphs.length; i++) 
			{
				if(aParagraphs[i].getAttribute(ClassNameRef) == "TwistBody")
				{
					aParagraphs[i].style.display = "none";
				}
			}
		}
	}
	
	function TwistOpen(id)
	{
	
		if(document.getElementById)
		{
			TwistCloseAll();
			var elt = document.getElementById(id);
			elt.style.display = "block";
		}
		
		window.location.hash=id;
	}
		
		
		//Image Timer
		//-------------------------------------------------------------------------
		
		function TimerSystem(id,imagename){
		this.id = id;
		this.items = new Array();
		this.timerID = null;
		this.timeOut = 1000;
		this.active = true;
		this.currentItem = -1;
		this.imagename = imagename;
		}

		TimerSystem.prototype.Add = function(timerItem){
			this.items[this.items.length] = timerItem
		}

		TimerSystem.prototype.Start = function(){
			this.active = true;
			Loop(this);
		}

		TimerSystem.prototype.Back = function(){
			this.Stop();
			if(this.currentItem > 0)
			{
				this.currentItem -= 1;
				if (document.images) {
					document[this.imagename].src = 'images/ImageWork/' + this.items[this.currentItem].imgId;
				}
			}
		}

		TimerSystem.prototype.Forward = function(){
			this.Stop();
			if(this.items.length >= this.currentItem+2)
			{
				this.currentItem += 1;
				if (document.images) {
					document[this.imagename].src = 'images/ImageWork/' + this.items[this.currentItem].imgId;
				}
			}
		}


		TimerSystem.prototype.Stop = function(){
			clearTimeout(this.timerID);
			this.active = false;
		}

		function TimerItem(id,imgId,timeOut){
			this.id = id;
			this.imgId = imgId;
			this.element = null;
			this.timeOut = timeOut;
		}

		function Loop(timerSystem)
		{
			if(timerSystem.active == true)
			{
				if (timerSystem.currentItem + 1 >= timerSystem.items.length)
				{
					timerSystem.currentItem = 0
				}
				else
				{
					timerSystem.currentItem += 1
				}
				if (document.images) {
					document[timerSystem.imagename].src = 'images/ImageWork/' + timerSystem.items[timerSystem.currentItem].imgId;
				}
				timerSystem.timerID = setTimeout("Loop(" + timerSystem.id + ")",timerSystem.items[timerSystem.currentItem].timeOut);
			}
		}
		
		
