<!-- //			////Browserdetection ///////////////////////////////////////////////////////////////////

var is = new Is();

function Is() {
  	var agent = navigator.userAgent.toLowerCase();
  	this.major = parseInt(navigator.appVersion);
  	this.minor = parseFloat(navigator.appVersion);
  	this.ns = ((agent.indexOf('mozilla')!=-1) && 	((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == 	-1)));
  	this.ns2 = (this.ns && (this.major == 3));
  	this.ns3 = (this.ns && (this.major == 3));
  	this.ns4b = (this.ns && (this.minor < 4.04));
  	this.ns4 = (this.ns && (this.major == 4));
  	this.ns4up = (this.ns && (this.major >= 4));
  	this.ns5up = (this.ns && (this.major >= 5));
  	this.ie = (agent.indexOf("msie") != -1);
  	this.ie3 = (this.ie && (this.major == 2));
  	this.ie4 = (this.ie && (this.major >= 4));
  	this.ie4b = (agent.indexOf('msie 4')!=-1);
	this.ie5 = (agent.indexOf('msie 5')!=-1);
	this.ie55 = (agent.indexOf('msie 5.5')!=-1);
  	this.ie6 = (agent.indexOf('msie 6')!=-1);
  	this.op3 = (agent.indexOf("opera") != -1);
  	this.win = (agent.indexOf("win")!=-1);
  	this.mac = (agent.indexOf("mac")!=-1);
  	this.unix = (agent.indexOf("x11")!=-1);
 	}
	
////SCREENDIM
var scrh;
var scrw;
function scrdim() {
	if (is.ie4) {
		scrw = document.body.clientWidth;
		scrh = document.body.clientHeight; 
		}
	else if (is.ns4up) {
		scrw = window.innerWidth;
		scrh = window.innerHeight;
		}
		displayh = screen.height; 
		displayw = screen.width;
}


//Check browser
if(is.ns2){browser='ns2'};
if(is.ns3){browser='ns3'};
if(is.ns4){browser='ns4'};
if(is.ns4b){browser='ns4b'};
if(is.ns4up){browser='ns4up'};
if(is.ns5up){browser='ns6'};
if(is.ie3){browser='ie3'};
if(is.ie4){browser='ie4'};
if(is.ie4b){browser='ie4b'};
if(is.ie5){browser='ie5'};
if(is.ie55){browser='ie55'};
if(is.ie6){browser='ie6'};
if(is.op3){browser='opera'};
//document.write('browser is ' + browser +'<br/>');

//Check os
if(is.win){os='win'};
if(is.mac){os='mac'};
if(is.unix){os='unix'};
//document.write('platform is ' + os+ '<br/>');
//// end Browser detection /////////////////////////////////////////////////////////////////// 
 //-->

<!-- //				/////FLASHDETECTION /////////////////////////////////////////////////////


var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var flash7Installed = false; 
var maxVersion = 7;             // highest version we can actually detect
var actualVersion = 0;          // version the user really has
var jsVersion = 1.0;            // the version of javascript supported

// This is a js1.1 code block, so make note that js1.1 is supported.
jsVersion = 1.1;

// Write vbscript detection on ie win. IE on Windows doesn't support regular
// JavaScript plugins array detection.
if(is.ie && is.win){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}



function detectFlash() {  
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {
      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion >= 6;
    }
  }

  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) {
	    actualVersion = i;
	//    document.write('flash version is ' + actualVersion + '<br/>');
	    }
  }
  
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  
  

}




//Make compatible with browserdet.js's "is object"

  	is.flash2 = flash2Installed;
  	is.flash3 = flash3Installed;
  	is.flash4 = flash4Installed;
  	is.flash5 = flash5Installed || flash6Installed || flash7Installed;
  	is.flash6 = flash6Installed || flash7Installed;
  	is.flash7 = flash7Installed;

/////////// end flash detection //////////////////////////////////////////////////////
//-->

/* //////////////////// cookie script //////////////////////////////////
Script by RoBorg |||||||||||||| RoBorg@geniusbug.com |||||||||||||||| http://javascript.geniusbug.com
*/


//c.setValue('moo2', 'cow2');
 
 // examples ..............
//Get using parse
//c.parse();
//alert(moo);

//Get using getValue
//alert(c.getValue('moo'));

//Get using getCookieAsArray
//x = c.getCookieAsArray();
//for(var i in x) alert(i +'=='+ '\n' + x[i]);
// end examples ...........................


function Cookie()
{

	//Public properties
	this.isSet = (document.cookie.toString().length != 0);
	this.isEnabled = navigator.cookieEnabled;

	//Private properties
	this.expires = new Date();
	this.path = '';
	this.domain = '';
	this.isSecure = false;

	//Public methods
	this.getIsSet = function() { return (document.cookie != ""); }
	this.setExpires = function(date) { this.expires = date; }
	this.setPath = function(path) { this.path = path; }
	this.setDomain = function(domain) { this.domain = domain; }
	this.setSecure = function(secure) { this.isSecure = secure; }

	this.erase = function()
	{
		this.setExpires(new Date(new Date().getTime() - 1000000));
		var cArr = this.getCookieAsArray();
		for(var i in cArr) this.setValue(i, '');

		document.cookie = '';
	}

	this.parse = function()
	{
		var cValues = this.getCookieAsArray();
		for(var i in cValues) eval(i + ' = unescape("' + cValues[i] + '");');
	}

	this.getValue = function(name)
	{
		var cValues = this.getCookieAsArray();
		return cValues[name];
	}

	this.setValue = function(name, value) { document.cookie = name + '=' + escape(value) + '; ' + this.getCookieSettings(); }

	this.getCookieAsArray = function()
	{
		if(!document.cookie.toString().length) return new Array();

		cArr = document.cookie.toString().split('; ');
		var cookieArray = new Array();
		for(var x=0; x<cArr.length; x++)
		{
			if(!cArr[x].length) continue;
			cArr[x] = cArr[x].split("=");
			cookieArray[cArr[x][0].toString()] = unescape(cArr[x][1]);
		}

		return cookieArray;
	}

	//Private methods

	this.getCookieSettings = function()
	{
		var str = 'expires=' + this.expires.toGMTString() + '; ';
		if(this.domain.length) str += 'path=' + this.path + '; ';
		if(this.domain.length) str += 'domain=' + this.domain + '; ';
		if(this.isSecure) str += 'secure; ';
		return str;
	}
} 
 ////////////////////////////////////////////// end cookie script ///////////////////////////////////////////////////








c = new Cookie();
//var gotoHTMLcookie;
//c.erase();



var expDays = 365; // number of days the cookie should last
var expDate = new Date();
c.setExpires(new Date(expDate.getTime() +  (24 * 60 * 60 * 1000 * expDays))); 


// this is where the option to have a html or a flash site is stored in the cookie
if(c.getValue('htmlVersion') == null){ // if it doesn't exist default to false
	c.setValue('htmlVersion', 'false');
}









/*
// before testing for flash check to see if it wants to use the html version in the cookie.
if(c.getValue('htmlVersion') != 'true'){
	//gotoHTMLcookie = false;
	alert('if c.getValue test  != true');
	

	
}else{
	//document.write('htmlVersion is set to true <br/>');
	//document.write('>>' + c.getValue('htmlVersion'));
	// redirect the page to the html version..
	alert('if c.getValue test  == true ' );
	//gotoHTMLcookie = true;
	
}
*/

detectFlash(); 


function switchSite(n,pageId){
	if(n == 0){
		
		// go to html version of site
		// c is the cookie object declared in common.js on line 145
		c.setValue('htmlVersion', 'true');
		//gotoHTMLcookie = true;
		top.location.href = "index.php?id="+pageId;
	} else {
		// go to flash version of site
		c.setValue('htmlVersion', 'false');
		top.location.href = "flashindex.php?id="+pageId;


	}
}





////////////////////////////////// common.js ////////////////////////////////////////////////
//Function to change bg on divs in IE. Already works in Moz.
function changeBg(id,img,bgcol) {	
	if (document.getElementById && document.getElementById(id) && msie4){
		if(img!= null && img!="null"){
			document.getElementById(id).style.background = "url('" +  img + "')";
		}else if(bgcol!= null && bgcol!="null"){
			document.getElementById(id).style.background = bgcol;
		}else{
			document.getElementById(id).style.background = 'transparent';
		}
		return true;
	} else if (document.layers && document.layers[id]) {
		//document.layers[id].bgColor = color;
		return true;
	}
}
/////////////////////////////////////// end common .js /////////////////////////////
// 
		



