<!--

// *************************************************
// Copyright fluidstate 2001
// put your version numbers here in the form "x.xx"
var explorerMacVersion = "5.00";
var explorerPCVersion = "4.00";
var netscapeMacVersion = "4.70";
var netscapePCVersion = "4.00";
// put the URL here
var strRedirection = "upgradebrowser.html"
// *************************************************
function getNumber(strNum) {
var dblTotal=0;
var bolDecimal = false;
var dblMultiple = 1;	
	for (i=0; i<strNum.length; i++) {		
		if (strNum.charAt(i)>="0" && strNum.charAt(i)<="9") {			
			if (bolDecimal) {				
				dblMultiple = dblMultiple * 0.1;				
				dblTotal = (dblTotal) + (parseInt(strNum.charAt(i))*dblMultiple);			
			}			
			else {				
				dblTotal = (dblTotal * 10) + parseInt(strNum.charAt(i));			
			}		
		}		
		else {			
			if (strNum.charAt(i).indexOf(".")>=0) {				
				bolDecimal=true;			
			}		
		}	
	}	
	return dblTotal;
} 
//*** getNumber(strNum)
var intMoz;
var intMSIE;
var strUserAgent;
var strAppName;
var bolSwitch = true;
var bolIsNetscape = false;
var bolIsExplorer = false;

strAppName = window.navigator.appName;
strUserAgent = window.navigator.userAgent;
if (strAppName.indexOf("Netscape")>=0) {	
	bolIsNetscape = true;	
	intMoz = strUserAgent.indexOf("Mozilla/");	
	if (strUserAgent.indexOf("Win") >= 0) {		
		if (intMoz >= 0) {			
			if (getNumber(strUserAgent.substring(intMoz+8, intMoz+12)) >= getNumber(netscapePCVersion)) {				
				bolSwitch = false;			
			}		
		}	
	}	
	if (strUserAgent.indexOf("Mac") >= 0) {		
		if (intMoz >= 0) {			
			if (getNumber(strUserAgent.substring(intMoz+8, intMoz+12)) >= getNumber(netscapeMacVersion)) {				
				bolSwitch = false;			
			}		
		}	
	}
}
if (strAppName.indexOf("Explorer")>=0) {	
	bolIsExplorer = true;	
	intMSIE = strUserAgent.indexOf("MSIE");	
	if (strUserAgent.indexOf("Win") >= 0) {		
		if (intMSIE >= 0) {			
			if (getNumber(strUserAgent.substring(intMSIE+5, intMSIE+9)) >= getNumber(explorerPCVersion)) {				
				bolSwitch = false;			
			}		
		}	
	}	
	if (strUserAgent.indexOf("Mac") >= 0) {		
		if (intMSIE >= 0) {			
			if (getNumber(strUserAgent.substring(intMSIE+5, intMSIE+9)) >= getNumber(explorerMacVersion)) {				
			bolSwitch = false;			
			}		
		}	
	}
}
if (!bolIsExplorer && !bolIsNetscape) {	bolSwitch = false;}if (bolSwitch) {	
	// location = strRedirection;
}
// this code should remain in the head of the page

var cart = new Object;
var enquiryCart = new Object;
var d  = new Date();
var strCookie = '';
var expdate = new Date();
var str = '';
var intFullFrames = 0;
d++;
expdate.setFullYear(expdate.getFullYear() + (1)); // 1 year from now for cookie expiry


function Item(code, selected)
{
	this.code = code;
	this.selected = selected;
}

if ( GetCookie("fablightbox") ) {

	str = GetCookie("fablightbox");
	
	tmp = str.split("*");
	
	for ( i in tmp ) {
		cart[tmp[i]] = new Item(tmp[i],'true');
		
	}	
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function FixCookieDate (date) {
  var base = new Date(0);
  var skew = base.getTime(); // dawn of (Unix) time - should be 0
  if (skew > 0)  // Except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function SetCookie (name,value,expires,path,domain,secure) {

  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

function DeleteCookie (name,path,domain) {
  if (GetCookie(name)) {
	SetCookie( name, '', expdate );
    document.cookie = name + "=" +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function updateCookie (name) {
var i = 0;
var photo;
	str = '';
	
	
	for ( photo in cart ) {
		if (cart[photo].selected) {
			if (i) {
				str = str + '*';
			}
			str = str + cart[photo].code;
			i++;
		}
	}
	//alert(i + " " + str);
	//expdate.setSeconds(expdate.getSeconds() + 1);
	SetCookie( name, str, expdate );
}

//-->