function get_date_time() {
	var months=new Array(13);
	months[1]="Jan";
	months[2]="Feb";
	months[3]="Mar";
	months[4]="Apr";
	months[5]="May";
	months[6]="June";
	months[7]="July";
	months[8]="Aug";
	months[9]="Sept";
	months[10]="Oct";
	months[11]="Nov";
	months[12]="Dec"; 
	
	// date
	time=new Date();
	lmonth=months[time.getMonth() + 1];
	date=time.getDate();
	year=time.getFullYear();
	year_str=year.toString();
	
	hours = time.getHours();
	minutes = time.getMinutes();
	
	// time
	time_value = "" + ((hours > 12) ? hours - 12 : hours);
	if (time_value == "0") {
		time_value = 12;
	}
	time_value += ((minutes < 10) ? ":0" : ":") + minutes;
	time_value += (hours >= 12) ? " pm" : " am";
	
	// concat
	return (date + " " +  lmonth + " " + year_str + ", " + time_value );
}


// transcript ctl button visibility
function togbut (t) {
	MM_swapImgRestore();
	// transcript buttons
	icf = document.getElementById("f");
	ice = document.getElementById("e");
	icn = document.getElementById("n");
	
	if (t == "f") {
		icf.style.visibility = "visible";
		ice.style.visibility = "hidden";
		icn.style.visibility = "hidden";
	}
	else if (t == "e") {
		icf.style.visibility = "hidden";
		ice.style.visibility = "visible";
		icn.style.visibility = "hidden";
	}
	else { // (t == "n")
		icf.style.visibility = "hidden";
		ice.style.visibility = "hidden";
		icn.style.visibility = "visible";
	}
	MM_swapImgRestore();
}


// parse searchargs
// http://www.cryer.co.uk/resources/javascript/script8.htm
function get_param(name) {
  var start=location.search.indexOf("?"+name+"=");
  if (start<0) start=location.search.indexOf("&"+name+"=");
  if (start<0) return '';
  start += name.length+2;
  var end=location.search.indexOf("&",start)-1;
  if (end<0)end=location.search.length;
  var result=location.search.substring(start,end);
  var result='';
  for(var i=start;i<=end;i++) {
    var c=location.search.charAt(i);
    result=result+(c=='+'?' ':c);
  }
return unescape(result);
// return CharacterEncodeString(unescape(result),'PARTIAL');
// return CharacterEncodeString(decodeURI(result),'PARTIAL');
}


// entify strings passed via searchargs
function CharacterEncodeString(inputStr, encodingDegree) {
	var htmlEncoded         = "";
	var fullHtmlEncoded     = "";
	
	for (var i=0; i<inputStr.length; ++i) {
		var chrAtI      = inputStr.charAt(i);
		var chr         = inputStr.charCodeAt(i);

		if (isNaN(chr)) {
			fullHtmlEncoded += chrAtI;
			htmlEncoded += charAtI;
		}
		else {
			fullHtmlEncoded += "&#" + chr + ";";
			if (chrAtI.match(/[\w\s]/)) {
				htmlEncoded += chrAtI;
			}
			else {
				htmlEncoded += "&#" + chr + ";";
			}
		}
	}
	return (encodingDegree.toUpperCase() == "PARTIAL" ? htmlEncoded : fullHtmlEncoded);
} 


// subject name
function get_iv(i) {
	switch (i) {
		case "au":
			return ('Aur&eacute;lien');
			break;
		case "bl":
			return ('Blake');
			break;
		case "cl":
			return ('Cl&eacute;ment');
			break;
		case "fr":
			return ('Franck');
			break;
		case "ka":
			return ('Karen');
			break;
		case "la":
			return ('Laila');
			break;
		case "jc":
			return ('Jean-Charles');
			break;
		case "st":
			return ('St&eacute;phanie');
			break;
		case "vi":
			return ('Virginie');
			break;
	}
}


// load includes
function load_inc(what) {
	document.write('<SCR' + 'IPT LANGUAGE="JavaScript1.2" SRC="' + what + '" TYPE="text/javascript"><\/SCR' + 'IPT>');
}   


// generate body tag w/chap str and relative img path
function body_tag(ch,rel) {
	s = "<body class=\"mai\" onLoad=\"MM_preloadImages('" + rel + "images/ti_" + ch + "_ro.gif','" + rel + "images/ti_fi_ro.gif','" + rel + "images/ti_tab_mp3_ro.gif','" + rel + "images/" + ch + "/th_01_ro.gif','" + rel + "images/" + ch + "/th_02_ro.gif','" + rel + "images/" + ch + "/th_03_ro.gif','" + rel + "images/" + ch + "/th_04_ro.gif','" + rel + "images/" + ch + "/th_05_ro.gif','" + rel + "images/" + ch + "/th_06_ro.gif','" + rel + "images/" + ch + "/th_07_ro.gif','" + rel + "images/" + ch + "/th_08_ro.gif','" + rel + "images/foot_copyright_ro.gif','" + rel + "images/foot_fyf_ro.gif','" + rel + "images/foot_ut_ro.gif','" + rel + "images/foot_home_ro.gif','" + rel + "images/foot_00_ro.gif','" + rel + "images/foot_01_ro.gif','" + rel + "images/foot_02_ro.gif','" + rel + "images/foot_03_ro.gif','" + rel + "images/foot_04_ro.gif','" + rel + "images/foot_05_ro.gif','" + rel + "images/foot_06_ro.gif','" + rel + "images/foot_07_ro.gif','" + rel + "images/foot_08_ro.gif','" + rel + "images/foot_09_ro.gif','" + rel + "images/foot_10_ro.gif','" + rel + "images/foot_11_ro.gif','" + rel + "images/foot_12_ro.gif','" + rel + "images/foot_13_ro.gif','" + rel + "images/foot_map_ro.gif','" + rel + "images/foot_mail_ro.gif')\">";
	return (s);
}


//thumbnails
function thumbs(ch,rel) {
	pix = new Array ;
	pix[0] = '1' ;
	pix[1] = '2' ;
	pix[2] = '3' ;
	pix[3] = '4' ;
	pix[4] = '5' ;
	pix[5] = '6' ;
	pix[6] = '7' ;
	pix[7] = '8' ;
	
	// shuffle
	pix.sort(function(){return Math.random() < 0.5 ? -1 : 1}) ;
	
	// thumbs
	ro_url = "javascript:open_second_win_cen('" + rel + "html/ec/','380','250','fyf','0','0')";
	s = '<table cellpadding=0 cellspacing=0 border=0>';
	for (i=0; i<pix.length; i++) {
		mostr  = "'th_0" + pix[i] + "','','" + rel + "images/" + ch + "/th_0" + pix[i] +"_ro.gif'";
		picstr = '<a href="' + ro_url + '" title="thumbnail, ch.' + ch + '" onMouseDown="MM_swapImgRestore()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('+ mostr +',1)"><img src="' + rel + 'images/'+ ch +'/th_0'+ pix[i] +'.jpg" width=80 height=60 border=0 alt="thumbnail, ch.'+ ch + '" name="th_0'+ pix[i] +'"></a>' ;
		s += '<tr><td align=left valign=top>' + picstr +'</td></tr><tr><td><img src="' + rel + 'images/transdot.gif" width=1 height=5 alt=""></td></tr>';
	}
	s += '</table>';
	return (s);
}

// confirm download
function confirm_dl (dl_type,ch,dl_size,dl_descrip) {
	what =  ((dl_descrip) ? dl_descrip : "mp3 archive");
	msg = "Do you want to download " + what + "\n(" + dl_type + ", ch:" + ch + ", " + dl_size + " MB) ?";
	res = confirm (msg);
	return ((res)?true:false);
}

function redirect_alert (the_url) {
	s =  '<span class="phd">Redirect alert!</span><br>';
	s += '<p class="tit">';
	s += 'This page has moved to <a href="' + the_url +'" title="new URL" class="red">' + the_url +'</a>.<br>';
	s += 'Please note and bookmark the new address.';
	s += '</p>';
	s += '<p class="reg">';
	s += 'You should be redirected to the new URL in 10 seconds.<br>';
	s += 'If not re-directed automatically, please access the new address by <a href="' + the_url +'" title="new URL" class="red">clicking here</a>.';
	s += '</p>';
	return (s);
}

function redirect_alert_temp (the_url) {
	s =  '<span class="phd">Temporary redirect alert!</span><br>';
	s += '<p class="tit">';
	s += 'This page is temporarily located at another address: <a href="' + the_url +'" title="temporary URL" class="red">' + the_url +'</a>.<br>';
	s += 'Please note and bookmark.';
	s += '</p>';
	s += '<p class="reg">';
	s += 'You should be redirected to the temporary URL in 10 seconds.<br>';
	s += 'If not re-directed automatically, please access the address by <a href="' + the_url +'" title="temporary URL" class="red">clicking here</a>.';
	s += '</p>';
	return (s);
}


// windows
function open_second_win(theURL,width,height,thewin,scroll,tool) {
	win2params = "titlebar=0,scrollbars=" + scroll + ",toolbar=" + tool + ",resizable=yes,left=0,top=0,width=" + width + ",height=" + height;
	win2 = open (theURL,thewin,win2params);
	win2.focus();
	if (win2.opener == null) {
		win2.opener = window;
	}
	win2.opener.name = "main_window";    
}

function open_second_win_cen(theURL,width,height,thewin,scroll,tool) {
	// default
    x = ((1024 - width)/2) - 50;
    y = ((768 - height)/2) - 50;
    
    if (screen) {
        y = ((screen.availHeight - height)/2) - 50;
        x = ((screen.availWidth - width)/2) - 50;
    }
    
	win2params = "titlebar=0,scrollbars=" + scroll + ",toolbar=" + tool + ",resizable=1,screenX=" + x + ",screenY=" + y +",left=" + x + ",top=" + y +",width=" + width + ",height=" + height;
	win2 = open (theURL,thewin,win2params);
	win2.focus();
	if (win2.opener == null) {
		win2.opener = window;
	}
	win2.opener.name = "main_window";    
}

function open_second_win_submit(the_url,width,height,the_win,scroll,tool,form_name) {
	// form name
	the_form = eval('document.forms.' + form_name);
	
	// win2
	win2_params = "titlebar=0,scrollbars=" + scroll + ",toolbar=" + tool + ",resizable=yes,left=0,top=0,width=" + width + ",height=" + height;
	win2 = open (the_url,the_win,win2_params);
	win2.focus();
	if (win2.opener == null) {
		win2.opener = window;
	}
	win2.opener.name = "main_window"; 
	
	// target, submit
	the_form.target=the_win;
	the_form.submit();
}

function openQTwin(the_url,width,height,thewin)   {
	win2params = "resizable=1,scrollbars=0,left=0,top=0,width="+width+",height="+height;
	win2 = open (the_url,thewin,win2params);
	win2.focus();
} 

function open_qt_win(the_url,width,height,thewin)   {
	win2params = "resizable=1,scrollbars=0,left=0,top=0,width="+width+",height="+height;
	win2 = open (the_url,thewin,win2params);
	win2.focus();
} 

function open_aud(base_url,at,ch,m,mt,ti,vs,width,height,thewin) {
	the_url = base_url + "?at=" + at + "&ch="+ ch + "&m=" + m + "&mt=" + mt + "&ti=" + escape(ti) + "&vs=" + escape(vs);
	win2params = "resizable=1,scrollbars=0,left=0,top=0,width="+width+",height="+height;
	win2 = open (the_url,thewin,win2params);
	win2.focus();
} 

function open_vid(base_url,ch,m,mt,ti,vs,width,height,thewin) {
	the_url = base_url + "?ch="+ ch + "&m=" + m + "&mt=" + mt + "&ti=" + escape(ti) + "&vs=" + escape(vs);
	win2params = "resizable=1,scrollbars=0,left=0,top=0,width="+width+",height="+height;
	win2 = open (the_url,thewin,win2params);
	win2.focus();
} 

function open_vidt(base_url,ch,ic,it,m,mt,ti,width,height,thewin) {
	the_url = base_url + "?ch="+ ch + "&ic=" + ic + "&it=" + it + "&m=" + m + "&mt=" + mt + "&ti=" + escape(ti);
	win2params = "resizable=1,scrollbars=0,left=0,top=0,width="+width+",height="+height;
	win2 = open (the_url,thewin,win2params);
	win2.focus();
} 

function jump(targ,selObj,restore) {
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}


// mm
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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];}
}

//reloads the window if Nav4 resized
function MM_reloadPage(init) {  
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);