// ----- START drop down dhtml code END ----- //
// Custom code written by Media Temple, Inc. All rights reserved.
// Change these

var top = -126;
var bot = 30;
var x=new Array(1);
x[0] = 'ddmenu';
var speed = 3;

// Don't edit anything after here

var delay = 10;
var m;

// TEST

var nav = navigator.userAgent; 
var ie = (document.all) ? 1:0;
var ns7 = (document.getElementById) ? 1:0;
var ischrome = (nav.indexOf("Chrome") > -1) ? 1:0;
var isSafari = (nav.indexOf("Safari") > -1) ? 1:0;
var isSafari51 = (isSafari && (nav.indexOf("Version/5.1") > -1)) ? 1:0;

//alert(nav + '/' + ie + '/' + ns7 + '/' + ischrome + '/' + isSafari + '/' + isSafari51);

/*
if(ie)
	alert("IE dŽtectŽ");
else
	if(!ns7)
		alert("Netscape pre-7 detecte");
    else
        alert("Netscape 7 detecte");
*/

function over() /***** OVER *****/
{
	o='on';
	setTimeout("o='on'", delay);
}
function mop(l) /***** MOP *****/
{
	t=l;
	o='off';
	setTimeout('cup()', delay);
}

function goup() /***** GOUP *****/
{
	for (z=0;x[z];z++)
	{
		if(ie)
			test = document.all[x[z]].style.pixelTop > top; 
		else
			if(!ns7)
				test = document.layers[x[z]].top > top; 
			else
				test = parseInt(document.getElementById([x[z]]).style.top) > top; 
		if (test)
			upper(x[z]);
	}
}

function cup() /***** CUP *****/
{
	for (z=0;x[z];z++)
		if(x[z] == t && o=='off')
			upper(x[z]);
}

function downer(y) /***** DOWNER *****/
{
	clearTimeout(m);

	for (z=0;x[z];z++)
		if(x[z] != y)
			if(ie)
				document.all[x[z]].style.pixelTop = top;
			else
				if(!ns7)
					document.layers[x[z]].top = top;
				else
					document.getElementById([x[z]]).style.top = top;

	if(ie)
		test = document.all[y].style.pixelTop >= bot;
	else
		if(!ns7)
			test = document.layers[y].top >= bot;
		else
			test = parseInt(document.getElementById(y).style.top) >= bot;

	if (test)
	{
		clearTimeout(m);
		if(ie)
			document.all.dissimule.style.visibility = 'visible';
		else
			if(!ns7)
				document.layers.dissimule.visibility = 'visible';
			else
				document.getElementById('dissimule').style.visibility = 'visible';
		if(ie)
			document.all.dissimule2.style.visibility = 'visible';
		else
			if(!ns7)
				document.layers.dissimule2.visibility = 'visible';
			else
				document.getElementById('dissimule2').style.visibility = 'visible';
	}
	else
	{
		if(ie||isSafari)
			document.all[y].style.pixelTop += speed;
		else
			if(!ns7)
				document.layers[y].top += speed;
			else
				document.getElementById(y).style.top = parseInt(document.getElementById(y).style.top) + speed;
		m=setTimeout("downer('"+y+"')", delay);
	}
	//displayzzz();
}

function displayzzz() /***** DISPLAYZZZ *****/
{
	alert(document.getElementById('laya').style.top + " b " + document.getElementById('layb').style.top + " c " + document.getElementById('layc').style.top + " d " + document.getElementById('layd').style.top + " e " + document.getElementById('laye').style.top);
	alert(document.getElementById('laya').style.visibility + " b " + document.getElementById('layb').style.visibility + " c " + document.getElementById('layc').style.visibility + " d " + document.getElementById('layd').style.visibility + " e " + document.getElementById('laye').style.visibility);
}

function upper(y) {
	clearTimeout(m);
        
	if(ie)
		test = document.all[y].style.pixelTop <= top;
	else
		if(!ns7)
			test = document.layers[y].top <= top;
		else
			test = parseInt(document.getElementById(y).style.top) <= top;

	if (test)
	{
		clearTimeout(m);
		if(ie)
			document.all.dissimule.style.visibility = 'hidden';
		else
			if(!ns7)
				document.layers.dissimule.visibility = 'hidden';
			else
				document.getElementById('dissimule').style.visibility = 'hidden';
		if(ie)
			document.all.dissimule2.style.visibility = 'hidden';
		else
			if(!ns7)
				document.layers.dissimule2.visibility = 'hidden';
			else
				document.getElementById('dissimule2').style.visibility = 'hidden';
    }
    else
    {
		if(ie||isSafari)
			document.all[y].style.pixelTop -= speed;
		else
			if(!ns7)
				document.layers[y].top -= speed;
			else
				document.getElementById(y).style.top = parseInt(document.getElementById(y).style.top) - speed;
		m=setTimeout("upper('" + y + "')", delay);
	}
}

function show() /***** SHOW *****/
{
	for (z=0;x[z];z++)
		if(ie)
			document.all[x[z]].style.visibility = 'visible';
		else
			if(!ns7)
				document.layers[x[z]].visibility = 'visible';
			else
				document.getElementById([x[z]]).style.visibility = 'visible';
}
// ----- drop down dhtml code END ----- //

var myTime = new Date();
var myCookie;

	function setCookieNow()
	{
		var aDate = new Date();
		var base = new Date(0);
		var fix = base.getTime();
		if(fix > 0)  // Mac fix
			aDate.setTime(aDate.getTime() - fix);
		return aDate;
	}

	function getCookieValue(offset)
	{
		var endstr = document.cookie.indexOf(";", offset);
		if(endstr == -1)
			endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	}

	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 getCookieValue(j);
			i = document.cookie.indexOf(" ", i) + 1;
			if(i == 0)
				break; 
		}
		return null;
	}

	function setCookie(name,value,expires,path,domain,secure)
	{
		document.cookie = name + "=" + escape(value) +
			((expires) ? "; expires=" + expires.toGMTString() : "") +
			((path) ? "; path=" + path : "") +
			((domain) ? "; domain=" + domain : "") +
			((secure) ? "; secure" : "");
		return true;
	}

	function cookIt(theCookieName,theCookieValue)
	{
		var expdate = setCookieNow();
		expdate.setTime(expdate.getTime() + (24 * 60 * 60 * 365000)); // un an
		myCookie = theCookieValue;
		if(myCookie == null)
			myCookie = "basicCSS";
		setCookie(theCookieName, myCookie, expdate,'/');
		return true;
	}




function getAllSheets()
{
	if(!window.ScriptEngine && navigator.__ice_version)
	{
  		return document.styleSheets;
  	}
  	if(document.getElementsByTagName)
  	{
  		var Lt = document.getElementsByTagName('link');
  		var St = document.getElementsByTagName('style');
  	}
  	else
  		if(document.styleSheets && document.all)
  		{
  			var Lt = document.all.tags('LINK'), St = document.all.tags('STYLE');
  		}
  		else
  		{
  			return [];
  		}
	for(var x = 0, os = []; Lt[x]; x++)
	{
		if(Lt[x].rel)
		{
			var rel = Lt[x].rel;
		}
		else
			if(Lt[x].getAttribute)
			{
				var rel = Lt[x].getAttribute('rel');
			}
			else
			{
				var rel = '';
			}
		if(typeof(rel) == 'string' && rel.toLowerCase().indexOf('style') + 1)
		{
			os[os.length] = Lt[x];
		}
	}
	for(var x = 0; St[x]; x++)
	{
		os[os.length] = St[x];
	}
	return os;
}

function setActiveCSS()
{
	for(var x = 0, ss = getAllSheets(); ss[x]; x++)
	{
		if(ss[x].title)// || x == 0)
		{
			ss[x].disabled = true;
	    }
    	for(var y = 0; y < arguments.length; y++)
	    {
			if(ss[x].title == arguments[y])
			{
				ss[x].disabled = false;
			}
		}
 	}
 	if(!ss.length)
 	{
 		alert('Your browser cannot change stylesheets');
 	}
}



	function XXXsetActiveCSS(title)
	{
		var css, a, main;
		for(css = 0; (a = document.getElementsByTagName("link")[css]); css++)
		{
			if(a.getAttribute("rel").indexOf("style") != -1) // && a.getAttribute("title"))
			{
      			if(a.getAttribute("title"))
	      			if(a.getAttribute("title") == title)
    	  				a.disabled = false;
    	  			else
    	  				a.disabled = true;
    	  		else
    	  			a.disabled = true;
			}
		}
		return true;
	}

	function setCSS(theCSS)
	{
		cookIt('theme',theCSS);
		if(theCSS == 'persoCSS')
		{
			myCookie=getCookie("persoCSS");
			if(myCookie == null)
				myCookie = "file:///macnomodo.css";
			var myCSS = prompt("Indiquez l'url de la feuille de style (css) que vous voulez utiliser (laissez vide pour annuler) :",myCookie);
			if(myCSS != null)
			{
				cookIt('persoCSS',myCSS);
				document.location.assign(document.location.href);
			}
		}
		else
			if(isSafari51)
				document.location.assign(document.location.href);
			else
				setActiveCSS(theCSS);
		return true;
	}

	function iChatAuto(status)
	{
		cookIt('iTChatche',(status)?myTime.getTime()-1800000:'manuel');
		return true;
	}

	function dealWithShiftKey(evt,target)
	{
		if (evt.keyCode == 13)
			if (evt.shiftKey)
				MacNOMODOSearch = "https://eu.ixquick.com/do/metasearch.pl?host=http://macnomodo.frbb.net/&linkback_url=http://macnomodo.frbb.net/&linkback_sitename=MacNOMODO&language=francais&cat=web&query=";
			else
				MacNOMODOSearch = "http://www.google.com/search?domains=macnomodo.frbb.net&sitesearch=macnomodo.frbb.net&hl=fr&q=";
	}

myCookie=getCookie("theme");
if(myCookie == 'persoCSS')
{
	myCookie=getCookie("persoCSS");
	if(myCookie != null)
		document.write('<link rel="stylesheet" href="'+myCookie+'" type="text/css" title="persoCSS" />');
}

if(isSafari51)
{
	if(myCookie.indexOf("CSS"))
		document.write('<link rel="stylesheet" href="http://osmac.online.fr/stuff/' + myCookie.replace('CSS','') + '.css"	type="text/css" title="' + myCookie + '" />');
}
else
{
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/basic.css"	type="text/css" title="basicCSS" />');
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/cyan.css"		type="text/css" title="cyanCSS" />');
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/rose.css"		type="text/css" title="roseCSS" />');
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/vert.css"		type="text/css" title="vertCSS" />');
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/gold.css"		type="text/css" title="goldCSS" />');
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/desktop.css"	type="text/css" title="desktopCSS" />');
	document.write('<link rel="alternate stylesheet" href="http://osmac.online.fr/stuff/dark.css"		type="text/css" title="darkCSS" />');
}

document.write("<div id=dissimule2 style='Z-INDEX:9997; VISIBILITY:hidden; POSITION:absolute; LEFT:200px; WIDTH:400px; TOP:-40px;'></div>");
document.write("<div id=dissimule  style='Z-INDEX:9996; VISIBILITY:hidden; POSITION:absolute; LEFT:200px; WIDTH:400px; TOP:0px; height:130px;' onMouseOver=\"goup();\"></div>");
document.write("<div               style='Z-INDEX:9998; POSITION:absolute; LEFT:200px; TOP:0px; WIDTH:400px; HEIGHT:50px;' onMouseOver=\"downer('ddmenu');\"></div>");
document.write("<div id=ddmenu     style='Z-INDEX:9999; POSITION:absolute; LEFT:250px; top:15px;'>");
document.write("<table border=0 cellpadding=1 cellspacing=0>");
document.write("<tr><td nowrap class=gen>");

document.write("<B><a href='feed://macnomodo.frbb.net/feed/?type=atom&f=1'>RSS</a></B>");
document.write("&nbsp;-&nbsp;");
document.write("<B><a href='aim:GoChat?RoomName=MacNOMODO'>iTchatche</a></B> <input id=xChat type='checkbox' title='Cochez cette case pour automatiser votre pr&eacute;sence iTchatche...' onclick='iChatAuto(this.checked);' style='cursor:hand;cursor:pointer' />&nbsp;&nbsp;");
document.write("<font style='font-family:Arial; font-size:8px;'>");

document.write("<span onclick='setCSS(\"basicCSS\");' style='background-color:#FF9900;cursor:hand;cursor:pointer' title='default MacNOMODO theme'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"cyanCSS\");'  style='background-color:#0099FF;cursor:hand;cursor:pointer' title='eyes of blue'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"roseCSS\");'  style='background-color:#FFAAAA;cursor:hand;cursor:pointer' title='pinky'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"vertCSS\");'  style='background-color:#00BB99;cursor:hand;cursor:pointer' title='mint'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"goldCSS\");'  style='background-color:#EDED22;cursor:hand;cursor:pointer' title='gold'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"desktopCSS\");'  style='background-color:#000000;cursor:hand;cursor:pointer' title='classic monochrome'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"darkCSS\");'  style='background-color:#555555;cursor:hand;cursor:pointer' title='dark side'>&nbsp;&nbsp;</span>&nbsp;");
document.write("<span onclick='setCSS(\"persoCSS\");' style='background-color:#FAFAFA;cursor:hand;cursor:pointer' title='hidden personal theme'>&nbsp;&nbsp;</span>&nbsp;");
document.write("</font>");

var MacNOMODOSearch = "http://www.google.com/custom?domains=macnomodo.frbb.net&sitesearch=macnomodo.frbb.net&hl=fr&filter=0&q=";

document.write("<form name=searchMacNOMODO id=searchMacNOMODO onSubmit='document.location.href=MacNOMODOSearch+document.searchMacNOMODO.searchentry.value;return false;'>");
document.write("<input type=text name=searchentry id=searchentry value='Chercher...' onFocus='if (this.value==\"Chercher...\") this.value=\"\"' onBlur='if (this.value==\"\") this.value=\"Chercher...\"' onKeyPress='dealWithShiftKey(event,this);' title='Recherche avec :\n- Google (entr&eacute;e)\n- ixquick (maj-entr&eacute;e)' style='font-family:Arial;font-size:10;height:13px;width:100;'>");

var today = new Date();
var anniv = new Date();
var J;

anniv.setMonth(10);
anniv.setDate(18);
anniv.setFullYear(2009);

J = parseInt((anniv.getTime() - today.getTime())/1000/60/60/24);

if(J>0)
	document.write("<span class=gen> J - " + J + "</span>");

document.write("</form>");

document.write("</td></tr></table></div>");

myCookie = getCookie("theme");
if(myCookie != null)
	setActiveCSS(myCookie);
else
	setCSS('basicCSS');

myCookie = getCookie("iTChatche");
if(myCookie != null)
	if(myCookie != 'manuel')
	{
		document.getElementById('xChat').checked = true;
		if((myTime.getTime() - myCookie) > 1800000)
			document.write("&nbsp;<iframe src='aim:GoChat?RoomName=MacNOMODO' width=0 height=0></iframe>");
		cookIt('iTChatche',myTime.getTime());
	}

if(document.all.ddmenu.style)
	document.all.ddmenu.style.pixelTop = -130;
else
	if(document.layers.ddmenu)
		document.layers.ddmenu.top = -130;
	else
		document.getElementById('ddmenu').style.top = -130;

