function InfoSearch(val)
{
	if (val=='1')
		document.getElementById("keyinfo").innerText = 'Entrez votre recherche :';
	else if (val=='2' || val=='3')
		document.getElementById("keyinfo").innerText = 'Entrez son pseudo :';
	else if (val=='4')
		document.getElementById("keyinfo").innerText = 'Entrez la trace :';	
	else if (val=='5')
		document.getElementById("keyinfo").innerText = 'Entrez le nom du pays :';	
	document.getElementById("search").focus();								
}
function OnSearch(ths)
{
	if (ths.search.value.length<4) 
	{ 
		alert('Il faut saisir plus de lettres dans la recherche\n(au moins 4 lettres).'); 
		return false;
	}
	document.getElementById("type").value = document.getElementById("seltype").value;
	return true;	
}

function NotConnected()
{
	alert("[Fonction réservé aux membres]\nVous n'êtes pas connecté !");
	document.getElementById('Login').focus();
}

function CloseShadow(myParent)
{
	var isShadowBox = myParent.Shadowbox || 0;

	if(isShadowBox == 0) 
		window.close();
	else
		myParent.Shadowbox.close();
}

function ShowProfile(User)
{
	var path = "../forum_capvert/user.php?UserID=";
	var win;
	path += User;
	win = window.open(path,'Profil','width=560,height=460,resizable=no,status=no');
	win.focus();
}

function ShowProfileIdx(User)
{
	var path = "v6/forum_capvert/user.php?UserID=";
	var win;
	path += User;
	win = window.open(path,'Profil','width=560,height=510,resizable=no,status=no');
	win.focus();
}

function OpenWindow(URL)
{
	var w;
	w = window.open(URL,'Message_Perso','width=550,height=400,resizable=yes,status=no');
	w.focus();
}

function OpenChat(light)
{
	var w;
	if (light)
		w=window.open("../chat/chatsas.php?light","oscarlechat","width=400,height=220,resizable=yes,status=no");
	else
		w=window.open("http://www.oscarlesite.com/v6/chat/chatsas.php","oscarlechatlg","width=640,height=480,resizable=yes,status=no");	
	w.focus();
}  

function PlayMusic(fichier)
{
	var so = new SWFObject("../common/dewplayer.swf?mp3="+fichier+"&amp;autostart=1&amp;showtime=1&amp;volume=0", 'Clip', '200', '20', '7', '#000000');
	so.write("swfplayer");
}

function PlayRadio(fichier)
{
	var htmlcode ="<OBJECT id='oPlayer' width='100%' height='140' type=application/x-oleobject standby='Chargement...Veuillez patienter' classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95";
	htmlcode+="codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701>";
	htmlcode+="<PARAM NAME='FileName' VALUE='"+fichier+">";
	htmlcode+="<PARAM NAME='ShowControls' VALUE='1'>";
	htmlcode+="<PARAM NAME='ShowStatusBar' VALUE='1'>";
	htmlcode+="<PARAM NAME='autostart' VALUE='1'>";
	htmlcode+="<PARAM NAME='autoload' VALUE='0'>";
	htmlcode+="<PARAM NAME='ShowGoToBar' VALUE='0'>";
	htmlcode+="<embed type='application/x-mplayer2'"; 
	htmlcode+="SRC='"+fichier+"'";
	htmlcode+="pluginspage='http://www.microsoft.com/Windows/MediaPlayer/download/default.asp' ShowControls=1 ShowDisplay=0 ShowStatusBar=0 ShowGoToBar=0 width=100% height=140> </embed>";
	htmlcode+="</OBJECT>";
	document.getElementById('radioplayer').innerHTML = htmlcode;
}
function DetachPlayer()
{
//	document.getElementById('mplayer').style.display='block';
//	document.getElementById('oPlayer').controls.stop();
//	document.getElementById('mplayer').style.display='none';
	var w;
	w = window.open('v6/musique_cap-vert/radio_online.php','oscarlaradio','width=492,height=290,resizable=no,status=no');
	w.focus();	
}
function AfficherMail(LinkName)
{
	var m2="@";
	var m1="oscar";
	var m3="lesite.";
	var m4="com";
	var mail;

	mail=m1;
	mail+=m2;
	mail+=m1;
	mail+=m3;
	mail+=m4;
	
	if (!LinkName)
		LinkName=mail;
	document.write("<a href='mailto:"+mail+"'>"+LinkName+"</a>");
}

var canPublish = 1;
function DisplayForm()
{
	if (canPublish)
	{
		document.getElementById('msgreponse').style.display='none';
		document.getElementById('newform').style.display='block';
	}
	else
	{
		alert("Vous devez attendre quelques minutes avant de pouvoir\n à nouveau participer à cette discussion.");
	}
}

function changer_jjs(dos) 
{
	if (minute < 10)
		minute = "0"+Math.round(minute);
	else if(minute >= 60)
	{
		minute = "00";
		heure++;
	}
	if (heure < 10)
		heure = "0"+Math.round(heure);
	else if(heure >= 24)
	{
		heure = "00";
	}
	heure = heure+" ";minute = minute+" "
	heur1=heure.charAt(0);
	heur2=heure.charAt(1);
	min1=minute.charAt(0);
	min2=minute.charAt(1);
   document.im1.src = dos+heur1+".gif";
   document.im2.src = dos+heur2+".gif";
   document.im3.src = dos+min1+".gif";
   document.im4.src = dos+min2+".gif";	
   minute++;			   
   setTimeout("changer_jjs('"+dos+"')", 60000);
}

function OpenVideo(VideoIdType, VideoName, TypeVideo)
{
	var VideoSrc;
	var codeHTML;
	var Type;
	Type = VideoIdType.substr(0,1);
	var VideoId = VideoIdType.substr(1, VideoIdType.length-1);
	codeHTML = "";
	if (Type=="G")
		VideoSrc = "http://video.google.com/googleplayer.swf?docId="+ VideoId+ "&autoplay=1";
	else if (Type=="D")
		VideoSrc = "http://www.dailymotion.com/swf/"+ VideoId+ "&autoplay=1";
	else if (Type=="Y")
	{
		VideoSrc = "http://www.youtube.com/v/"+ VideoId + "&autoplay=1";
	}
	var so = new SWFObject(VideoSrc, 'Clip', '100%', '490', '9', '#000000');
	so.addParam("wmode", "opaque");
	so.addParam("autostart", "1");
	so.addParam("allowFullScreen","true");
	so.write("swfplayer");	
	document.getElementById('link').innerHTML="<p>http://www.oscarlesite.com/v6/musique/clip.php?id" + TypeVideo + "=" + VideoIdType + "</p>";	
	document.getElementById('clipname').innerHTML="<h1>"+VideoName+"</h1></span>";
	document.location="#right";
}
var LastPic = 0;
function ShowPic(path, id)
{
	if (LastPic>0)
	{
		zoomWnd = document.getElementById('zoom'+LastPic);
		zoomWnd.innerHTML = "";	
	}	
	if (path!="")
	{

		LastPic = id;
		path = path.replace("photo_","gallery/");
		path = path.replace("_","/");
		path = path.replace("_","/");
		path = path + ".jpg";
		zoomWnd = document.getElementById('zoom'+id)
		//zoomWnd.style.display = 'block';
		//document.getElementById('imgsrc').src = path;
		zoomWnd.innerHTML = "<h1>Cliquer sur la photo pour fermer</h1><blockquote onclick='javascript:ShowPic(\"\"," +id+")' style='background:#000000 url("+path+") no-repeat center center'><img src='../forum_capvert/pics/calque.gif'></blockquote>";
	}
}

function ShowPromo(id)
{
	if (LastPic>0)
	{
		zoomWnd = document.getElementById('zoom');
		zoomWnd.innerHTML = "";	
	}
	if (id>0)
	{
		LastPic = id;
		path = "v5/promo/_promo" + id + ".jpg";
		zoomWnd = document.getElementById('zoom')
		zoomWnd.innerHTML = "<blockquote onclick='javascript:ShowPromo(-1)'><img src='"+path+"'></blockquote>";
	}
}

var nbSmiley=0;
var chatCumul = 0;
function Smiley(text) 
{
	var txtarea = document.getElementById('Message')
	text = ' ' + text + ' ';
	if (nbSmiley>4)
		alert("Trop de smileys tue le smiley!!!");	
	if (nbSmiley>7)
		return;
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
	nbSmiley++;
}

var chatNoHide = 0;
var chatBeat = 30000;
var chatTimer = 0;
var chatCumul = 0;
var chatDisabled = 0;
function ResizeChat(nSize)
{
	var chatbox = document.getElementById('chatbox');
	chatCumul = 0;
	if (nSize == 1)
	{
		chatbox.style.width='400px';
		chatbox.style.height='350px';
		document.getElementById('bt1').className = "btsel";
		document.getElementById('bt2').className = "btnosel";
		document.getElementById('bt3').className = "btnosel";
		document.getElementById('bt5').className = "btnosel";
	}
	else if (nSize == 2)
	{
		chatbox.style.width='300px';
		chatbox.style.height='250px';
		document.getElementById('bt1').className = "btnosel";
		document.getElementById('bt2').className = "btsel";
		document.getElementById('bt3').className = "btnosel";
		document.getElementById('bt5').className = "btnosel";
	}
	else if (nSize == 3)
	{
		chatbox.style.width='300px';
		chatbox.style.height='152px';
		document.getElementById('bt1').className = "btnosel";
		document.getElementById('bt2').className = "btnosel";
		document.getElementById('bt3').className = "btsel";	
		document.getElementById('bt5').className = "btnosel";
	}
	else if (nSize == 5)
	{
		window.clearTimeout(chatTimer);	
		chatDisabled = 1;
		document.getElementById('bt1').className = "btnosel";
		document.getElementById('bt2').className = "btnosel";
		document.getElementById('bt3').className = "btnosel";
		document.getElementById('bt5').className = "btsel";
		chatbox.style.display = 'none';		
		return;		
	}	
	else if (nSize == 4)
	{
		chatNoHide = 1-chatNoHide;
		if (chatNoHide)
		{
			document.getElementById('bt4').className = "btsel";
			if (chatDisabled)
				return;
		}
		else
		{
			chatDisabled = 0;
			chatBeat = 20000;
			document.getElementById('bt4').className = "btnosel";	
			return;	
		}
	}
	chatDisabled = 0;
	window.clearTimeout(chatTimer);
	chatTimer = window.setTimeout( getMessages, chatBeat );		
	chatbox.style.display = 'block';
	chatbox.scrollTop=chatbox.scrollHeight;	
}
