// CSS selector & cookie memory

// These are the variables - you can change these if you want
var expDays = 9999;  // How many days to remember the setting
var standardStyle = '1'; // This is the number of your standard style sheet; this will be used when the user did not do anything.
var nameOfCookie = 'switchstyle'; // This is the name of the cookie that is used.  
var urlToCSSDirectory = 'css/'; // This is the URL to your directory where your .css files are placed on your site.  For example: http://www.seniorennet.be/URL_TO_STYLESHEET_DIRECTORY_OF_YOUR_SITE/

// Now you can set here the names of your different .css files; exactly the name as set on your website
var ScreenCSS_1 = 'layout.css';
var ScreenCSS_2 = 'hicontrast.css';
var ScreenCSS_3 = 'largetext.css';
var ScreenCSS_4 = 'hilarge.css';
var ScreenCSS_5 = 'textonly.css';

function switchStyleOfUser(){
	var fontSize = GetCookie(nameOfCookie);
	if (fontSize == null) {
		fontSize = standardStyle;
	}
	
	if (fontSize == "1") { document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ' ' + ScreenCSS_1 + '" media="screen">'); }
	if (fontSize == "2") { document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_2 + '" media="screen">'); }
	if (fontSize == "3") { document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_3 + '" media="screen">'); }
	if (fontSize == "4") { document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_4 + '" media="screen">'); }
	if (fontSize == "5") { document.write('<link rel="stylesheet" type"text/css" href="' + urlToCSSDirectory + ScreenCSS_5 + '" media="screen">'); }

	var fontSize = "";
	return fontSize;
}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

// Function to get the settings of the user
function getCookieVal (offset) {  
	var endstr = document.cookie.indexOf (";", offset);  
	if (endstr == -1)    
	endstr = document.cookie.length;  
	return unescape(document.cookie.substring(offset, endstr));
}
	
// Function to get the settings of the user
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 to remember the settings
function SetCookie (name, value) {
	var argv = SetCookie.arguments;  
	var argc = SetCookie.arguments.length;  
	var expires = (argc > 2) ? argv[2] : null;  
	var path = (argc > 3) ? argv[3] : null;  
	var domain = (argc > 4) ? argv[4] : null;  
	var secure = (argc > 5) ? argv[5] : false;  
	document.cookie = name + "=" + escape (value) + 
	((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
	((path == null) ? "" : ("; path=" + path)) +  
	((domain == null) ? "" : ("; domain=" + domain)) +    
	((secure == true) ? "; secure" : "");
}

// Function to remove the settings
function DeleteCookie (name) {  
	var exp = new Date();  
	exp.setTime (exp.getTime() - 1);  
	var cval = GetCookie (name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

// This function refreshes the page
function doRefresh(){
	location.reload();
}

// This calls the main function
document.write(switchStyleOfUser());


// Date
function displayDate() {
  var now = new Date();
  var today = now.getDate();
  var month = now.getMonth();
    var monthName = new Array(12)
      monthName[0]="January ";
      monthName[1]="February ";
      monthName[2]="March ";
      monthName[3]="April ";
      monthName[4]="May ";
      monthName[5]="June ";
      monthName[6]="July ";
      monthName[7]="August ";
      monthName[8]="September ";
      monthName[9]="October ";
      monthName[10]="November ";
      monthName[11]="December ";
  var year = now.getFullYear();

  document.write(monthName[month]+today+ ", "+year);
}


// Equalising DIVs
function P7_colH(){
 var i,oh,hh,h=0,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=0;i<dA.length;i++){dA[i].style.height='auto';}for(i=0;i<dA.length;i++){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=0;i<dA.length;i++){if(an){
 dA[i].style.height=h+'px';}else{P7_eqA(dA[i].id,dA[i].offsetHeight,h);}}if(an){
 for(i=0;i<dA.length;i++){hh=dA[i].offsetHeight;if(hh>h){
 dA[i].style.height=(h-(hh-h))+'px';}}}else{document.p7eqa=1;}
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT(){
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){
 P7_colH();}
}
function P7_equalCols(){
 if(document.getElementById){document.p7eqc=new Array;for(var i=0;i<arguments.length;i++){
 document.p7eqc[i]=document.getElementById(arguments[i]);}setInterval("P7_eqT()",10);}
}
function P7_eqA(el,h,ht){
 var sp=10,inc=20,nh=h,g=document.getElementById(el),oh=g.offsetHeight,ch=parseInt(g.style.height);
 ch=(ch)?ch:h;var ad=oh-ch,adT=ht-ad;nh+=inc;nh=(nh>adT)?adT:nh;g.style.height=nh+'px';
 oh=g.offsetHeight;if(oh>ht){nh=(ht-(oh-ht));g.style.height=nh+'px';}
 if(nh<adT){setTimeout("P7_eqA('"+el+"',"+nh+","+ht+")",sp);}
}


// Dreamweaver behaviour for the jump menu - modified to allow target specification
function MM_jumpMenu(targ,selObj,restore){ //v3.0
	if(targ == "parent") { eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); }
	else if (targ == "blank") { window.open( "location="+selObj.options[selObj.selectedIndex].value ) };
}


// Flash activation script
function commitFlashObject(_obj, _container){
	_output=""
	_paramoutput=""
	_src=""
	_ver=""
	for(_cO in _obj){
		_output+=_cO+"=\""+_obj[_cO]+"\" "
		_paramoutput+="<param name="+_cO+" value=\""+_obj[_cO]+"\">";
		if(_cO=="movie")_src="src=\""+_obj[_cO]+"\"";
		if(_cO=="version")_ver=_obj[_cO];
	}
	if(_ver=="")_ver="8,0,0,0"
	ihtm="<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_ver+" "+_output+">\n"
	ihtm+=_paramoutput+"\n"
	ihtm+="<embed "+_src+" pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash "+_output+">\n";
	ihtm+="</embed>\n";
	ihtm+="</object>\n";
	document.getElementById(_container).innerHTML=ihtm	
}


// This is to expand the announcement window based on previous selection held in cookie
var announcement = GetCookie("nhc_announcement");

if (announcement == null) {	document.write("<link rel='stylesheet' type='text/css' href='an_show.css'>") };
if (announcement == "yes") { document.write("<link rel='stylesheet' type='text/css' href='an_show.css'>") };
if (announcement == "no") { document.write("<link rel='stylesheet' type='text/css' href='an_hide.css'>") };



// Function to show the announcement and change the cookie
function showannouncement() {
	SetCookie('nhc_announcement', 'no', exp);
	doRefresh();
}

// Function to hide announcement and change the cookie
function hideannouncement() {
	SetCookie('nhc_announcement', 'yes', exp);
	doRefresh();
}







/* This is the freely available Browser Detect script */

/* BrowserDetect.browser is the browser name */
/* BrowserDetect.version is the browser version */
/* BrowserDetect.OS is the client OS */

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

/* --------------------------------------------------------------------------------------------- */

// Print selected elements using www.printwhatyoulike.com

function printElements() {

	address = document.location.toString();
	url = "";

	for(k=0; k<address.length; k++) {
		if(address.substr(k,1) == " ") { url = url + "%2520" }
		else if(address.substr(k,1) == "%20") { url = url + "%2520" }
		else if(address.substr(k,1) == "/") { url = url + "%2F" }
		else if(address.substr(k,1) == "=") { url = url + "%3D" }
		else if(address.substr(k,1) == ":") { url = url + "%3A" }
		else if(address.substr(k,1) == "?") { url = url + "%3F" }
		else { url = url + address.substr(k,1) };
		temp = url.replace(" ","%2520");
		url = temp;
	}

	callAddress = "http://www.printwhatyoulike.com/print?url=" + url;
	window.open( callAddress );
}

/* --------------------------------------------------------------------------------------------- */

// Add video

function video(name,play) {
	myFlashObject=new Object
	myFlashObject.movie="FLVPlayer_Progressive.swf"
	myFlashObject.quality="high"
	myFlashObject.width=222
	myFlashObject.height=177
	myFlashObject.version="5,0,0,0"
	myFlashObject.flashvars="&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=video/"+name+"&autoPlay="+play+"&autoRewind=true"
	commitFlashObject(myFlashObject, "video")
}















































