navigateur = navigator.appName;
navVersion = navigator.appVersion;   

function startTimer(time) {
	time = 100;
	timeOn = window.setTimeout("AWhideMenu()",time);
}

function startTimer2(time) {
	time2 = 100;
	timeOn2 = window.setTimeout("AWhideMenuAdmin()",time2);
}

function stopTimer() {	
	window.clearTimeout(timeOn);
	timeOn=null;
}

function stopTimer2() {	
	window.clearTimeout(timeOn2);
	timeOn2=null;
}

function MM_preloadImages() {
    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 fermer() {
	self.close();
}

var acompteur=0;
function anti_spam() {
	acompteur++;
	if (acompteur>1)
		return false;
}

function check(img) {
	disable(img);
	window.setTimeout("enable()",15000);
}

function disable(img) {
	document.getElementById("attentemess").innerHTML = "email en cours d'envoie...<br>";
	document.getElementById("valboutton").disabled = true;
}

function enable() {
	document.getElementById("attentemess").innerHTML = "";
	document.getElementById("valboutton").disabled = false;
}

function AWhpPlaySound() {
	sendToPage();
}

function PopupPhoto(img, titre) {
	w=open("",'photoimg','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+60); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function PopupPhotoAlbum(img, titre)  {
	w=open("",'photoimg','width=400,height=400,toolbar=no,scrollbars=no,resizable=yes');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+60); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' height='550' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

function awtv() {
	window.open('popup/awlive.php','awtv','toolbar=no,location=no,directory=no,menubar=no,scrollbars=no,status=no,resizable=no,height=400,width=650,left=75,top=60');
}

function InsertAWlive(live)
{
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="255" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n');
	document.write('<param name="bgcolor" value="#FFFFFF">\n');
	document.write('<param name="src" value="http://www.anakinweb.tv/frame/qt4_required.mov">\n');
	document.write('<param name="qtsrc" value="rtsp://www.anakinweb.tv:554/'+live+'">\n');
	document.write('<param name="autoplay" value="true">\n');
	document.write('<param name="controller" value="true">\n');
	document.write('<embed src="http://www.anakinweb.tv/frame/qt4_required.mov" qtsrc="rtsp://www.anakinweb.tv:554/'+live+'" width="320" height="255" target="myself" bgcolor="#FFFFFF" border="0" controller="true" autoplay="true" kioskmode="true" pluginspage="http://www.apple.com/fr/quicktime/download/"></embed>\n');
	document.write('</object>\n');
}

function InsertAWlivetest(live)
{
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="320" height="255" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n');
	document.write('<param name="bgcolor" value="#FFFFFF">\n');
	document.write('<param name="src" value="http://www.anakinweb.tv/frame/qt4_required.mov">\n');
	document.write('<param name="qtsrc" value="rtsp://stream.anakinweb.tv/'+live+'">\n');
	document.write('<param name="autoplay" value="true">\n');
	document.write('<param name="controller" value="true">\n');
	document.write('<embed src="http://www.anakinweb.tv/frame/qt4_required.mov" qtsrc="rtsp://stream.anakinweb.tv/'+live+'" width="320" height="255" target="myself" bgcolor="#FFFFFF" border="0" controller="true" autoplay="true" kioskmode="true" pluginspage="http://www.apple.com/fr/quicktime/download/"></embed>\n');
	document.write('</object>\n');
}

function InsertAWenlive(live)
{
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="640" height="495" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab">\n');
	document.write('<param name="bgcolor" value="#FFFFFF">\n');
	document.write('<param name="src" value="http://www.anakinweb.tv/frame/qt4_required.mov">\n');
	document.write('<param name="qtsrc" value="rtsp://www.anakinweb.tv:554/vod/enlive-'+live+'.mov">\n');
	document.write('<param name="autoplay" value="true">\n');
	document.write('<param name="controller" value="true">\n');
	document.write('<embed src="http://www.anakinweb.tv/frame/qt4_required.mov" qtsrc="rtsp://www.anakinweb.tv:554/vod/enlive-'+live+'.mov" width="640" height="495" target="myself" bgcolor="#FFFFFF" border="0" controller="true" autoplay="true" kioskmode="true" pluginspage="http://www.apple.com/fr/quicktime/download/"></embed>\n');
	document.write('</object>\n');
}

function HomeCHATapplet(colorbgchat, colorfgchat, colorbgtchat, chatusername)
{
	document.write('<applet name="EIRC" code="EIRC.class" width="100%" height="418">\n');
	document.write('<param name="archive" value="EIRC.jar,EIRC-cfg.jar" />\n');
	document.write('<param name="cabbase" value="EIRC.cab,EIRC-cfg.cab" />\n');
	document.write('<param name="port" value="6667" />\n');
	document.write('<param name="irc_pass" value="" />\n');
	document.write('<param name="font_name" value="Helvetica" />\n');
	document.write('<param name="font_size" value="12" />\n');
	document.write('<param name="language" value="" />\n');
	document.write('<param name="mainbg" value="#'+colorbgchat+'" />\n');
	document.write('<param name="mainfg" value="#'+colorfgchat+'" />\n');
	document.write('<param name="textbg" value="#'+colorbgtchat+'" />\n');
	document.write('<param name="textfg" value="#'+colorfgchat+'" />\n');
	document.write('<param name="selbg" value="#'+colorbgchat+'" />\n');
	document.write('<param name="selfg" value="#'+colorfgchat+'" />\n');
	document.write('<param name="join" value="#anakinweb" />\n');
	document.write('<param name="username" value="anakinweb" />\n');
	document.write('<param name="realname" value="AnakinWeb" />\n');
	document.write('<param name="nickname" value="'+chatusername+'" />\n');
	document.write('<param name="nickserv_pass" value="" />\n');
	document.write('<param name="login" value="1" />\n');
	document.write('<param name="asl" value="1" />\n');
	document.write('<param name="spawn_frame" value="0" />\n');
	document.write('<param name="width" value="100%" />\n');
	document.write('<param name="height" value="418" />\n');
	document.write('<param name="write_color" value="12" />\n');
	document.write('<param name="debug_traffic" value="0" />\n');
	document.write('<param name="boxmessage" value="Merci de patienter durant le chargement d\'AnakinWeb Home..." />\n');
	document.write('<param name="boxbgcolor" value="#'+colorbgchat+'" />\n');
	document.write('<param name="boxfgcolor" value="#'+colorfgchat+'" />\n');
	document.write('<param name="progressbar" value="true" />\n');
	document.write('<param name="progresscolor" value="red" />\n');
	document.write('<div align="center">Cette salle de chat nécessite le support de Java</div>\n');
	document.write('</applet>\n');
}

function showhide(pi_object)
{
	var the_element = document.getElementById(pi_object);
	if (the_element.style.display == "none")
	{
		the_element.style.display = "inline";
	}
	else
	{
		the_element.style.display = "none";
	}
}

function showhidehome(pi_object)
{
	var the_element = parent.document.getElementById(pi_object);
	if (the_element.style.display == "none")
	{
		the_element.style.display = "inline";
	}
	else
	{
		the_element.style.display = "none";
	}
}

function subdivopen(pi_object,pi_object0)
{
	var the_element = document.getElementById(pi_object);
	var the_element0 = document.getElementById(pi_object0);
	if (the_element.style.display == "none")
	{
		the_element.style.display = "inline";
		the_element0.style.display = "none";
	}
	else
	{
		the_element.style.display = "none";
		the_element0.style.display = "inline";
	}
}

i=0;
function colorsemail()
{
    if(document.getElementById("newemails"))
	{
		tabColoris = new Array ("#333333","#FFFFFF");
		if (i+1 == tabColoris.length) i=0;
		else i++;
		document.getElementById("newemails").setAttribute('color',tabColoris[i]);
		setTimeout("colorsemail()",700);
	}
}

function newsprint(a_id)
{ 	
	window.open('newsprint.php?awnid='+a_id,'awnewsprint','toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,copyhistory=0,menuBar=0,width=650,height=500,left=75,top=60');
}

function openAWHome(page) 
{
	window.open('http://home.anakinweb.com/'+page+'.php','home','toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,copyhistory=0,menuBar=0,width=990,height=600,left=75,top=60');
}

function SendNewPseudo(name,first,namenum,town) 
{
	var newusername = name.substr(0,3)+first.substr(0,2)+"-"+namenum.substr(0,2)+town.substr(0,3);
	document.forms["fform"].elements["username"].value = newusername.toLowerCase();
	verifpseudo(document.forms["fform"].elements["username"]);
	verifpseudo(document.forms["fform"].elements["username"]);
}


function setcountdown(theyear,themonth,theday,thehour,themin,thesec)
{
	yr=theyear;mo=themonth;da=theday;hr=thehour;min=themin;sec=thesec
}

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var crosscount=''

function start_countdown(textc,textl)
{
	if (document.layers)
		document.countdownnsmain.visibility="show"
	else if (document.all||document.getElementById)
		crosscount=document.getElementById&&!document.all?document.getElementById("countdownie") : countdownie
	textcount = textc;
	textlive = textl;
	countdown()
}

function countdown()
{
	var today=new Date()
	var todayy=today.getYear()
	if (todayy < 1000)
		todayy+=1900
	var todaym=today.getMonth()
	var todayd=today.getDate()
	var todayh=today.getHours()
	var todaymin=today.getMinutes()
	var todaysec=today.getSeconds()
	var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec
	futurestring=montharray[mo-1]+" "+da+", "+yr+" "+hr+":"+min+":"+sec
	dd=Date.parse(futurestring)-Date.parse(todaystring)
	dday=Math.floor(dd/(60*60*1000*24)*1)
	dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1)
	dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1)
	dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1)
	//if on day of occasion
	if(dday<=0&&dhour<=0&&dmin<=0&&dsec<=1&&todayd==da)
	{
		if (document.layers)
		{
			document.countdownnsmain.document.countdownnssub.document.write(textlive)
			document.countdownnsmain.document.countdownnssub.document.close()
		}
		else if (document.all||document.getElementById)
			crosscount.innerHTML=textlive
		return
	}
	//if passed day of occasion
	else if (dday<=-1)
	{
		if (document.layers)
		{
			document.countdownnsmain.document.countdownnssub.document.write("")
			document.countdownnsmain.document.countdownnssub.document.close()
		}
		else if (document.all||document.getElementById)
			crosscount.innerHTML=""
		return
	}
	//else, if not yet
	else{
		if (document.layers)
		{
			if(dday==0)
				document.countdownnsmain.document.countdownnssub.document.write(textcount+" dans "+dhour+" heures "+dmin+" minutes et "+dsec+" secondes...")
			else
				document.countdownnsmain.document.countdownnssub.document.write(textcount+" dans "+dday+ " jours, "+dhour+" heures "+dmin+" minutes et "+dsec+" secondes...")
			document.countdownnsmain.document.countdownnssub.document.close()
		}
		else if (document.all||document.getElementById)
		{
			if(dday==0)
				crosscount.innerHTML=textcount+" dans "+dhour+" heures "+dmin+" minutes et "+dsec+" secondes..."
			else
				crosscount.innerHTML=textcount+" dans "+dday+ " jours, "+dhour+" heures "+dmin+" minutes et "+dsec+" secondes..."
		}
	}
	setTimeout("countdown()",1000)
}

function AWsetDefaultAccordion(val)
{
	WriteCookiedate=new Date;
	WriteCookiedate.setFullYear(WriteCookiedate.getFullYear()+10);

	document.cookie = "AWpluginOpened=" + escape(val) + "; expires=" + WriteCookiedate.toGMTString() + "; path=/; domain=.anakinweb.com;";
}

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

function AWgetCookie(nom)
{
	var arg=nom+"=";
	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 AWgetCookieVal(j);
	i=document.cookie.indexOf(" ",i)+1;
	if (i==0) break;
	
	}
	return null;
}


var addthis_config = {
     ui_language: "fr"
}
