<!--


//    always to this code to add the site options!

var mysearch = location.search;
var mypath =  location.protocol + "//" + location.host + "/";
var found = 0;
var mycook =  unescape(document.cookie);


// ------------------ do CSS option 
var css = "";
if (mysearch.match(/css=off/) != null)
		{
		writecookie("css=off");	
		createCookie('css','off',365)
		css = 'off';
		}			
		
if (mysearch.match(/css=on/) != null)
		{
		writecookie("css=on");	
		createCookie('css','on',365)
		css = "on";
		}			


if (css == "")
	{
	if (mycook.match(/css=off/) != null) { css = 'off' }			
	if (mycook.match(/css=on/) != null)  { css = 'on' }			
	}
	
if (css == "") {css = 'on' }

if (css == 'on')
	{
	var myline = "<link rel='stylesheet' type='text/css' href='" + mypath + "basestyle.css' />";
	document.writeln(myline);
	//alert(myline);
	}



// ------------------- to text size ------


if ((mysearch.match(/text=1/) != null) & (css == 'on'))
		{
		document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "text1.css' />");  
		writecookie("text=1");	
		createCookie('text','1',365)
		found = 1;
		}								
if ((mysearch.match(/text=2/) != null) & (css == 'on'))
		{
		document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "text2.css' />");  
		writecookie("text=2");	
		createCookie('text','2',365)
		found = 2;
		}								
	
if ((mysearch.match(/text=3/) != null) & (css == 'on')) 
		{
		document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "text3.css' />");  
		writecookie("text=3");
		createCookie('text','3',365)
		found = 3;
		}								

if (found == 0)
	{
	if ((mycook.match(/text=1/) != null) & (css == 'on'))
			{
			//alert( "cook: 1");
			document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "text1.css' />");  	
			}								
	if  ((mycook.match(/text=2/) != null) & (css == 'on'))
			{
			//alert( "cook: 2");
			document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "text2.css' />");  
			}								
		
	if  ((mycook.match(/text=3/) != null) & (css == 'on'))
			{
			//alert( "cook: 3");
			document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "text3.css' />");  		
			}								
	}

//  if we have a value in a cookie then use that , other wise take from screen.
var width = '1';

var mywidth =  screen.availWidth;
if (isNaN(mywidth) == true) { mywidth = 999; }

if (mywidth > 1400) { width = '3'; }

else if (mywidth > 1200) { width = '2'; }
	
cookwidth = readCookie('width');	

if (cookwidth != null) width = cookwidth;

// ------ if we have the value in the URL save to cookie;

if (mysearch.match(/width=1/) != null)
		{		
		createCookie('width','1',365)
		width = '1'; 	
		}								
		
if (mysearch.match(/width=2/) != null)
		{		
		createCookie('width','2',365)
		width = '2'; 	
		}								
	
if (mysearch.match(/width=3/) != null) 
		{		
		createCookie('width','3',365)
		width = '3'; 	
		}								

if ((width == '3') & (css == 'on'))
	{
	document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "superwide.css' />");
	}

if ((width == '2') & (css == 'on'))
	{
	document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "wide.css' />");
	}
	


//  background -----
var water = 'c';
	
var cookwater = readCookie('water');	
if (cookwater != null) water = cookwater;	
	
// ------ if we have the value in the URL save to cookie;


if (mysearch.match(/water=lab/) != null)
		{	
		createCookie('water','lab',365)
		water = 'lab'; 	
		}								
		
if (mysearch.match(/water=none/) != null)
		{		
		createCookie('water','none',365)
		water = 'none'; 	
		}								
			
if (mysearch.match(/water=c/) != null)
		{		
		createCookie('water','c',365)
		water = 'c'; 	
		}				


if ((water == 'lab') & (css == 'on'))
	{
	document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "water-lab.css' />");
	}

if ((water == 'none') & (css == 'on'))
	{
	document.writeln("<link rel='stylesheet' type='text/css' href='" + mypath + "water-none.css' />");
	}
	

// ------- style --------------------------

var style = '1';
var cookstyle = readCookie('style');
if (cookstyle != null) style = cookstyle;
	
// ------ if we have the value in the URL save to cookie;


if (mysearch.match(/style=2/) != null)  { createCookie('style','2',365);	style = '2'; }								
if (mysearch.match(/style=3/) != null)  { createCookie('style','3',365);	style = '3'; }								
if (mysearch.match(/style=4/) != null)  { createCookie('style','4',365);	style = '4'; }								
if (mysearch.match(/style=5/) != null)  { createCookie('style','5',365);	style = '5'; }								
if (mysearch.match(/style=6/) != null)  { createCookie('style','6',365);	style = '6'; }								
if (mysearch.match(/style=7/) != null)  { createCookie('style','7',365);	style = '7'; }								
if (mysearch.match(/style=8/) != null)  { createCookie('style','8',365);	style = '8'; }								
if (mysearch.match(/style=9/) != null)  { createCookie('style','9',365);	style = '9'; }								
if (mysearch.match(/style=10/) != null)  { createCookie('style','10',365);	style = '10'; }								

style = '10';


if ((style != '1') & (css == 'on'))
	{
	var pathname = location.pathname;	
	//alert( pathname )
	if (pathname.match(/support/)  != null) 
		{
		var myline = "<link rel='stylesheet' type='text/css' href='" + mypath + "_style" + style  + "_support/style.css' />";
		document.writeln(myline);
		
		}
	else if (pathname.match(/info/)  != null) 
		{
		var myline = "<link rel='stylesheet' type='text/css' href='" + mypath + "_style" + style  + "_info/style.css' />";
		document.writeln(myline);
		}
	else if (pathname.match(/news/)  != null) 
		{
		var myline = "<link rel='stylesheet' type='text/css' href='" + mypath + "_style" + style  + "_news/style.css' />";
		document.writeln(myline);
		}
	else {
		var myline = "<link rel='stylesheet' type='text/css' href='" + mypath + "_style" + style  + "_/style.css' />";
		document.writeln(myline);
		
		}
	}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}


function writecookie(mycook)
  {
	return;  
   var mydate = new Date()
  	mydate.setFullYear( mydate.getFullYear() + 1 )      /* expire one year away */
  	oldcook =  unescape(document.cookie);
	alert(oldcook);
    newcook =  escape(mycook);
    newcook +=  "; domain=" + location.host; 
    newcook +=  "; version=" + escape(document.lastModfied);

	//   alert ( newcook );

    document.cookie = newcook + "; expires=" + mydate.toGMTString()
   
  }


function getelement(myelement)
   {
   //alert( myelement );
   if (parseInt(navigator.appVersion) > 4)
       {                                                        // all version 5+ browsers
       var myObject = document.getElementById(myelement);
       return myObject.style
       }
   else if (navigator.appName == "Microsoft Internet Explorer")
       {                                                       // Old Internet Explorer Browsers
        return document.all[myelement].style
       }
   else if(navigator.appName == "Netscape")
       {                                                       //  Old Nagivator Browsers
       return document.layers[myelement]
       }
   alert( "please use IE of Navigator")
   return "error"
   }


// when we have a dropdown menu as an option (in the video for example)
// the function below is called when the one of the drop down is selected
// the function then added the value on the URL and refreshed the page.
// in the page itself the new value is extracted from the whole URL


function addToUrl( myelement )
    {
		
	var sel = "error";
	for (var x = 0; x < myelement.length; x++ )
	   {
	   var myobject = myelement.options[x];
	   if (myobject.selected == true) 
	     { 
		 sel = myobject.value; 
		 location.href =  location.protocol + "//" + location.host + location.pathname  + "?" + sel;
		 }
	   }			
		
	}


function blendimage(divid, imageid, imagefile, millisec) 
	{ 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 




var first = 1;



function showmyclip()
   { 
   if (first != 1) {dopic();}
   first = 0; 
   setTimeout('showmyclip()',delaytime);
   }




function opacity(id, opacStart, opacEnd, millisec) 
	{ 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) 
	{ 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
	} 

//  -->
