function EcrireCookie(nom, valeur) {
	var argv = EcrireCookie.arguments;
	var argc = EcrireCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = nom + "=" + escape(valeur)
			+ ((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
			+ ((path == null) ? "" : ("; path=" + path))
			+ ((domain == null) ? "" : ("; domain=" + domain))
			+ ((secure == true) ? "; secure" : "");
}

function getCookieVal(offset) {
	var endstr = document.cookie.indexOf(";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function LireCookie(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 getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0)
			break;

	}
	return null;
}

if (LireCookie("status") != "ok") {
	var uagent = navigator.userAgent.toLowerCase();
	if(uagent.search("googlebot") > -1)
	{
		EcrireCookie("status", "ok");
	}
	else
	{
		document.write('<div bgcolor="#eFa6b1" class="overlay_background" id="disclaimer2" style="display: none;top: 0px; left: 0px; position: fixed;width:100%;height: 100%;background-color: #000000;z-index: 99;">\
			</div>\
			<div style="display: none; top: 60px; margin-left: -400px;left: 50%;position: absolute;width: 800px;z-index: 999999999;" id="disclaimer">\
			<img src="images/logosvxgrand.png" alt="Streaming video x title image" /><br/>\
			<a style="font-weight: bold;font-size: 14px;color: red;" href="http://www.streamingvideox.com/Porn%20Video%20Streaming.apk">Download the "Porn Video Streaming" app for android/Nexus One/HTC hero/HTC Legend/HTC Desire etc..</a><br/>\
			<a style="font-weight: bold;font-size: 14px;color: red;" href="http://www.streamingvideox.com/Porn%20Video%20Streaming.apk">Telechargez l\'application "Porn Video Streaming" pour android/Nexus One/HTC hero/HTC Legend/HTC Desire etc..</a><br/>\
			<font size="-2" face="Verdana">\
			<b>streamingvideox.com - Adulte Disclaimer</b>\
			<br/><br/>\
			<p>\
			Attention ce site contient du contenu à caractère sexuel et pornographique pouvant choquer la sensibilité de certaines personnes.\
			Le contenu de ce site est exclusivement réserver a des personnes de + de 18 ans et en accord avec la majorité légale de leur pays.\
			</p>\
			<br/>\
			<a href="#" style="font-weight: bold;font-size: 14px;color: #ffffff;" onclick="confirmDisclaimer(1);return false;">Je suis majeur (+ de 18 ans) et j\'entre sur le site a contenu pornographique, CLIQUEZ ICI.</a>\
			<br/>\
			<a href="#" style="font-size: 10px;" onclick="confirmDisclaimer(0);return false;">Je suis mineur.</a>\
			<br/><br/><br/>\
			<div>\
			<form action="?y=i" method="POST">\
			<input type="submit" name="disclaimer" value="Enter / Entrer" style="color: #000000;margin-right: 30px;font-weight: bold;font-size: 18px;" />\
			<input type="submit" name="leave" value="Leave / Quitter" style="color: #000000;margin-left: 30px;font-weight: bold;font-size: 18px;" />\
			</form>\
			</div>\
			<br/><br/><br/>\
			<b>streamingvideox.com - Adulte Disclaimer - English version</b>\
			<br><br>\
			This site contains adult oriented material of a graphic and sexual nature, and may be objectionable\
			to some persons. This material is intended for persons over 18 years of age, and may be against the\
			law in some areas. If you are accessing this area from any location that deems this type of material\
			to be illegal, you must not proceed.\
			<br/>\
			<br/>\
			<a href="http://getiton.com/p/memsearch.cgi?pid=g1037067-pct.substreaming&ip=auto" style="font-weight: bold;font-size: 12px;color: red;">Pour voir des PHOTOS et VIDEOS de libertine amatrice cliquez ICI</a>\
			</div>');
		document.getElementById('disclaimer2').style.display = "block";
		document.getElementById('disclaimer').style.display = "block";
	}
}

function confirmDisclaimer(status) {
	if (status == 1) {
		EcrireCookie("status", "ok");
		document.getElementById('disclaimer').style.display = "none";
		document.getElementById('page').style.display = "block";
		document.getElementById('disclaimer2').style.display = "none";
	} else {
		window.location = "http://www.google.com/";
	}
}

function hideCat(force)
{
	if((screen.width <= 1324) || force)
		document.getElementById("slider").style.display = "none";
}

function initScript()
{
	hideCat(0);
	var uagent = navigator.userAgent.toLowerCase();
	if(uagent.search("googlebot") > -1)
		hideCat(1);
	if((uagent.search("android") > -1) || (uagent.search("googlebot") > -1))
		return;
	enableTooltips();
}

function file(fichier) {
	if (window.XMLHttpRequest) // FIREFOX
		xhr_object = new XMLHttpRequest();
	else if (window.ActiveXObject) // IE
	{
		try {
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(e)
		{
			xhr_object = new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	else
		return (false);
	xhr_object.open("GET", fichier, false);
	xhr_object.send(null);
	if (xhr_object.readyState == 4)
		return (xhr_object.responseText);
	else
		return (false);
}

function addtocart(num) {
	result = file("panier.php?addtocart=" + num);
}

playingVideo = 0;
playingDiv = 0;
playingStart = 0;
timer = 0;

function prevVideo(urlVideo,idDiv,thumb) {
	//document.getElementById(playingDiv).innerHTML = "loading...";
	var s1 = new SWFObject('/betaplayer.swf','player'+idDiv,'175','131','9','#ffffff');
	s1.addParam('allowfullscreen','false');
	s1.addParam('allowscriptaccess','always');
	s1.addParam('wmode','opaque');
	s1.addParam('flashvars','file='+urlVideo+'&controlbar=none&fullscreen=none&stretching=fill&autostart=false&repeat=always&type=video&mute=false&image=' + thumb /*&streamer=lighttpd&start='+playingStart+"&duration="+((playingStart*1)+10)*/);
	s1.write(idDiv);
	return true;
}

function prevVideoPlay(idDiv){
	if(playingVideo == idDiv)
		return false;
	if(playingVideo == 0 )
	{
		playingVideo = idDiv;
		timer = setTimeout("prevVideoPlay(0);",1000);
		return true;
	}
	document.getElementById('player'+playingVideo).sendEvent('play','true');
	return true;
}

function prevVideoStop(idDiv)
{
	clearInterval(timer);
	document.getElementById('player'+idDiv).sendEvent('stop');
	playingVideo = 0;
}

function prevVideoMuted(urlVideo,idDiv,thumb)
{
	var s1 = new SWFObject('/betaplayer.swf','player'+playingDiv,'175','131','9','#ffffff');
	  s1.addParam('allowfullscreen','false');
	  s1.addParam('allowscriptaccess','always');
	  s1.addParam('wmode','opaque');
	  s1.addParam('flashvars','file='+urlVideo+'&controlbar=none&smoothing=false&fullscreen=none&stretching=fill&autostart=true&repeat=always&type=video&mute=true');
	  s1.write(idDiv);
	  playingStart = "started" ;
	  return true;
}

function recoverImg(idDiv,urlImg,urlVideo) {
	clearTimeout(timer);
	playingVideo = 0;
	if((playingStart == "started") && (navigator.product == "Gecko"))
		document.getElementById(idDiv).innerHTML = "<a href='"+urlVideo+"' class='apornthumb' ><img class='pornthumb' src='"+urlImg+" /></a>";
	return true;
}

function thumbPreview(idImg,urlImg,start) {
	if(playingVideo == 0)
	{
		playingVideo = urlImg;
		playingDiv = idImg;
		timer = setInterval("thumbPreview(0,0,0)",1000);
		playingStart = start;
		return true;
	}
	document.getElementById(playingDiv).src = playingVideo[playingStart];
	playingStart++;
	if(playingStart >= playingVideo.length)
		playingStart = 0;
	return true;
}

function stopPreview()
{
	clearInterval(timer);
	if(playingDiv)
		document.getElementById(playingDiv).src = playingVideo[0];
	playingVideo = 0;
}

function getComs(id,start)
{
	result = file("ajax/com.php?id="+id+"&start="+start);
	document.getElementById("divcom").innerHTML = result;
}

function postCom()
{
	var text;
	var code;
	if(document.getElementById("textcom").disabled)
		return false;
	text = document.getElementById("textcom").value;
	if(encodeURIComponent)
		text = encodeURIComponent(text);
	else
		text = escape(text);
	code = document.getElementById("capcode");
	if(code)
		code = code.value;
	else
		code = "";
	result = file("ajax/com.php?add=ok"+document.getElementById("keycom").value+"&id="+escape(document.getElementById("idcom").value)+"&text="+text+"&code="+escape(code));
	if(result == "ERROR")
		document.getElementById("textcom").value = "Error, captcha mismatch.";
	else
		document.getElementById("textcom").value ="Ok";
	document.getElementById("textcom").disabled = true;
	document.getElementById("buttcom").disabled = true;
}
/*
if (LireCookie("status") != "ok") {
	document.getElementById('page').style.display = "none";
}

*/
