var time = new Date();
ordval1= (time.getTime());
ordval2= ordval1+1;

var timerID = null;
var timerRunning = false;

function switch_css() {
	if ((navigator.appVersion.indexOf("Mac") != -1)) {
		document.write("<LINK REL=stylesheet HREF=\"styles/mac.css\" TYPE=\"text/css\">");
	} else {
		document.write("<LINK REL=stylesheet HREF=\"styles/win.css\" TYPE=\"text/css\">");
	}
}

/*
function stopclock()
 {
  if (timerRunning) clearTimeout(timerID);
  timerRunning = false;
 }

//To avoid trouble with reloads, a running timer will be stopped first.
//Then the clock starts with showtime();

function startclock()
 {
  stopclock();
  showtime();
 }

function showtime()
 {
  //get system time and timezone offset.
  var now = new Date();
  var hours = now.getHours();
  var minutes = now.getMinutes();
  var seconds = now.getSeconds();
  var milli = now.getMilliseconds();
  var timezone = now.getTimezoneOffset();

  //convert time to milliseconds till midnight
  var timevalue= hours*3600000+minutes*60000+seconds*1000+milli;
  
  //correct the effect of timezone (Internettime is equal worldwide)
  timevalue=timevalue+timezone*60000+3600000;

  //correct timevalue to be from 0 to 86400000 (one day period)
  if (timevalue<0) timevalue+=86400000;
  if (timevalue>=86400000) timevalue-=86400000;

  //compute Internettime (1/1000 of a day=.beat 1/100 of a beat=.tip)
  timevalue= Math.floor(timevalue/864);
  
  //leading zeros (like in real life):
  var leadtips="";
  if (timevalue%100<10) leadtips="0";
  var leadbeats=""
  if (timevalue<10000) leadbeats="0";
  if (timevalue<1000) leadbeats="00";
  
  //convert time to a string
  timevalue= "@"+leadbeats+Math.floor(timevalue/100)+"://"+leadtips+timevalue%100;

  //show string
  document.clock.face.value = timevalue;

  //every 100 milliseconds
  timerID = setTimeout("showtime()",100);
  timerRunning = true;
}
*/

function display_banners() {
	document.write ('<IFRAME SRC="http://ad.fr.doubleclick.net/adi/www.lalettreV2.com/accueil;sz=468x60;ord=' + ordval1 + '?" width=468 height=60 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no>');
	document.write ('<A HREF="http://ad.fr.doubleclick.net/jump/www.lalettreV2.com/accueil;sz=468x60;abr=!ie4;abr=!ie5;ord=' + ordval1 + '?">');
	document.write ('<IMG SRC="http://ad.fr.doubleclick.net/ad/www.lalettreV2.com/accueil;sz=468x60;abr=!ie4;abr=!ie5;ord=' + ordval1 + '?" WIDTH=468 HEIGHT=60></A></IFRAME>');
 }
 
function popup(url) {
	window.open(url,'EditWindow','toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=430,height=560');
}

function getanswer(url) {
	if (confirm("Are you sure you want to delete this item?"))
	self.location=url;
}

var aw = ah = 200;
		var theEmulator = null;
		
		function fixDocument()
		{
			// Fudge text boxes in IE
			if (navigator.appVersion.indexOf("MSIE") >= 0)
			{
				if (document.forms["launcher"] != null)
				{
					document.forms["launcher"].elements["url"].size = 60;
					document.forms["searchDirectory"].elements["searchTerm"].size = 60;
				}
				
				if (document.forms["servicesubmit"] != null)
				{
					document.forms["servicesubmit"].elements["title"].size = 40;
					document.forms["servicesubmit"].elements["url"].size = 40;
				}
			}
			
			initializeWindow();
		}
		
		function getPhoneSize()
		{
			var selected = document.forms["launcher"].elements["skin"].selectedIndex;
			
			switch (selected)
			{
			case 0:	w = 148; h = 225; aw = 122; ah = 190; break; // Nokia Beheaded
			case 1: w = 267; h = 400; aw = 249; ah = 346; break; // Nokia Beheaded Zoomed 
			case 2:	w = 121; h = 117; aw = 100; ah = 85; break;  // YoPhone 2000 
			case 3: w = 219; h = 209; aw = 200; ah = 170; break; // YoPhone 2000 Zoomed
			case 4:	w = 200; h = 200; aw = 183; ah = 126; break; // YoPhone 2000 
			case 5: w = 385; h = 300; aw = 366; ah = 251; break; // YoPhone 2000 Zoomed	
			}
			
			return "width=" + w + ",height=" + h;
		}
		
		
		function le(url)
		{
			if (url.indexOf("http://") < 0)
				document.launcher.url.value = "http://" + url;
			else
				document.launcher.url.value =  url;
			
			launchEmulator(document.launcher);
		}
		
		
		function launchEmulator(f)
		{
			if (theEmulator == null)
			{
				theName = "phoneWindow"+document.forms["launcher"].elements["skin"].selectedIndex;
			    document.cookie = "skinIndex=" + document.forms["launcher"].elements["skin"].selectedIndex + ";path=/";	
				document.cookie = "phoneWindow=" + theName + ";path=/"; 

				
				theEmulator = window.open("/emulator.php", theName, "alwaysRaised,dependent=no,"+getPhoneSize());
			}
			else
			{
				if (navigator.appVersion.indexOf("Macintosh") >= 0)
				{
					theEmulator.close();
					theEmulator = null;
					launchEmulator(f);
				}
				else
				{
					if (theEmulator.theSkin != document.forms["launcher"].elements["skin"].value)
					{
						theEmulator.close();
						
						theEmulator = null;

						launchEmulator(f);
						return;
					}
				
					theEmulator.focus();
				
					theEmulator.theUrl = f.elements["url"].value;
					var applet = theEmulator.document.applets["spe"];
					
					if (applet != null)
						applet.go(f.elements["url"].value);
					else
						alert("The emulator appears not to be loaded properly.\nTry restarting your browser and start again");
				}
			}
		}
		
		function getCookie(s)
		{
			var allCookies = document.cookie;
			
			var pos = allCookies.indexOf(s);
			
			var value = null;
			
			if (pos >= 0)
			{
				var start = pos + s.length;	
				var end = allCookies.indexOf(";", start);
				
				if (end < 0)
				{
					end = allCookies.length;
				}
				
				value = allCookies.substring(start,end);
			}
			
			return value;
		
		}
	
		function clearCookie()
		{
			document.cookie = "phoneWindow=none;path=/";
		}
	
			
		function initializeWindow()
		{
			var phoneWin = getCookie("phoneWindow=");
	
			if (phoneWin != null)
			{
				if (phoneWin != "none" || phoneWin != "")
				{
					theEmulator = window.open("/phone.html", "phoneWindow"+document.forms["launcher"].elements["skin"].selectedIndex, "alwaysRaised,dependent=no,"+getPhoneSize());
				}
			}	
						
			var skinIndex = getCookie("skinIndex=");
			
			if (skinIndex != null)
				document.forms["launcher"].elements["skin"].selectedIndex = parseInt(skinIndex);
			else
				document.forms["launcher"].elements["skin"].selectedIndex = 0;		
		}
		
	