function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function openWindowCenter(theURL,winName,winWidth,winHeight,features) {
	if (winName) {
		winName.close; 
	}
	if(screen.width) {
	  var winl = (screen.width-winWidth)/2;
	  var wint = (screen.height-winHeight)/2;
	}
	else {
	  winl = 0;wint =0;
	}
	if (winl < 0) winl = 0;
	if (wint < 0) wint = 0;
	var settings = 'height=' + winHeight + ',';
	settings += 'width=' + winWidth + ',';
	settings += 'top=' + wint + ',';
	settings += 'left=' + winl + ',';
	settings += features;
	win = window.open(theURL,winName,settings);
	win.window.focus();
}

function changeStatusBar(string) {
//alert("msg ="+string);
	window.status = string;
	//document.getElementById("slider").title.value=string;
}

//********** Workbook functions ***************
var wb_i = 0;
function workbook_periodic(elt) {
	if (wb_i>=elt.length) {
		wb_i=0;
	}
	var current = elt[wb_i];
	elt.each(function(el) {el.setStyle('display', 'none');});
	current.setStyle('display', 'block');
	wb_i++;
}
function launch_workbook(myId, myClass, delay) {
	$$('#'+myId+' .'+myClass).each(function (value, key) {
		if (key==0) {
			value.setStyle('display', 'block'); 
		} else {
			value.setStyle('display', 'none'); 
		}
		value.setStyle('background-color', '#FFFFFF'); 
		value.setStyle('position', 'absolute'); 
		value.setStyle('top',value.getParent().getStyle('top'));
	});
	(function(){
		workbook_periodic($$('#'+myId+' .'+myClass));
	}).periodical(delay*(wb_i+1));
}
//**********

// eMail Obfuscator Script 2.1 by Tim Williams - freeware
// Adapted by Jean-Marc Knake
function jsrwmail(coded,text,style,subject,body) {
	cipher = "aZbYcXdWeVfUgThSiRjQkPlOmNnMoLpKqJrIsHtGuFvEwDxCyBzA1234567890"
	shift=coded.length
	link=""
	for (i=0; i<coded.length; i++){
		if (cipher.indexOf(coded.charAt(i))==-1){
			ltr=coded.charAt(i)
			link+=(ltr)
		}
		else {     
			ltr = (cipher.indexOf(coded.charAt(i))-shift+cipher.length) % cipher.length
			link+=(cipher.charAt(ltr))
		}				
    }
	 document.write("<a href='mailto:"+link)
	 if (subject.length>0 && body.length>0) { document.write("?subject="+subject+"&body="+body) }
	 else if (body.length>0) { document.write("?body="+body) }
	 else if (subject.length>0) { document.write("?subject="+subject) }
	 document.write("'")
	 if (style.length>0) { document.write(" style='"+style+"'") }
	 if (text.length==0) { text=link; }
	 document.write(">"+text+"</a>")
}
