function otworz(url, width, height, scrollbars) {
noweOkno = window.open(url, 'windowup', 'menubar=no, toolbar=no, location=no, scrollbars='+scrollbars+', resizable=no, status=no, width='+width+', height='+height+',top=100,left=300')
}

function update(){
if (window.XMLHttpRequest){
http_request = new XMLHttpRequest();
}else if(window.ActiveXObject){ 
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request.onreadystatechange = function() { check_and_retry(); };
http_request.open('GET', 'http://www.xxxplace.pl/func/online.func.php', true);
http_request.send(null);
}


function check_and_retry(){
if(http_request.readyState == 4){
if(http_request.status == 200){
setTimeout("update()", 30000);
}else{
update();
}}}


function report(comment_id, user_id){
if (window.XMLHttpRequest){
http_request = new XMLHttpRequest();
}else if(window.ActiveXObject){ 
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
http_request.onreadystatechange = function() { check_and_do(comment_id, user_id); };
if(confirm('Napewno chcesz zglosic ten komentarz do moderacji? (nieuzasadnione zglaszanie komentarzy, bedzie odpowiednio karane.)')){
http_request.open('GET', 'http://www.xxxplace.pl/report.php?comment_id='+comment_id+'&user_id='+user_id, true);
}
http_request.send(null);
}

function check_and_do(comment_id, user_id){
if(http_request.readyState == 4){
if(http_request.status == 200){
document.getElementById("c"+comment_id).innerHTML += '<br /><br /><span style="font-size:12px; color:#FF0000; font-weight:bold;">Dziekujemy! Komentarz zostal zgloszony do moderacji.</span>';
}else{
report(comment_id, user_id);
}}}



function connect(){
	if (window.XMLHttpRequest){
	http_request = new XMLHttpRequest();
}
else if(window.ActiveXObject){ 
	http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
}


function moderate(mode, comment_id, target_id, user_id, qst){
connect();

http_request.onreadystatechange = function(){ 	

if(http_request.readyState == 4){
		if(http_request.status == 200){
			
		switch(mode){
		
		case 'comment_delete':
			document.getElementById("c"+comment_id).innerHTML = '<span style="font-size:14px; color:#FF0000; font-weight:bold;">Komentarz zostal usuniety.</span>';
		break;
		
		case 'user_warning':
			document.getElementById("c"+comment_id).innerHTML += '<br /><br /><span style="font-size:12px; color:#FF0000; font-weight:bold;">Uzytkownik otrzymal ostrzezenie.</span>';
		break;
		
		case 'user_ban':
			document.getElementById("c"+comment_id).innerHTML += '<br /><br /><span style="font-size:12px; color:#FF0000; font-weight:bold;">Uzytkownik zostal zbanowany.</span>';
		break;
		
	}				
		}else{
		moderate(mode, comment_id, target_id, user_id, '0');
		}
								}

}
if(qst==1){
	if(confirm('Czy jestes pewien?')){
	http_request.open('GET', 'http://www.xxxplace.pl/modules/moderate.module.php?mode='+mode+'&comment_id='+comment_id+'&target_id='+target_id+'&user_id='+user_id, true);	
	http_request.send(null);
}} else {
	http_request.open('GET', 'http://www.xxxplace.pl/modules/moderate.module.php?mode='+mode+'&comment_id='+comment_id+'&target_id='+target_id+'&user_id='+user_id, true);	
	http_request.send(null);
}
}

function ChangeThumb(hash,i,y){
i++;
if(i>y) i=1;
document.getElementById("thumb"+hash).innerHTML='<img class="thumb" src="http://thumbs.xxxplace.pl/'+hash+'/thumb_'+i+'.jpg" />';
setTimeout(function() { document.getElementById("thumb"+hash).innerHTML='<img class="thumb" src="http://thumbs.xxxplace.pl/'+hash+'/thumb_'+i+'.jpg" onmouseover="javascript:ChangeThumb(\''+hash+'\',\''+i+'\',\''+y+'\');" />'; }, 1000);
}


function ChangePopVote(id){
	
	document.getElementById("PopVote").src = '/gfx/pop/'+id+'.png';
	
	switch(id){
		
		case '1':
        var info = 'Nie staje mi!';
		break;
		
		case '2':
        var info = 'Lekkie pobudzenie';
		break;
		
		case '3':
        var info = 'Pa'+String.fromCharCode(322)+'a stoi';
		break;
		
		case '4':
        var info = 'Gotowy do boju';
		break;
		
		case '5':
        var info = 'Orgazm!';
		break;
	}
	
	document.getElementById("PopInfo").innerHTML=info;

}

function adultCheck(check){
		if(check==0){
document.getElementById('mainDiv').innerHTML='<div style="width:475px; margin-left:auto; margin-right:auto; margin-top:150px; text-align:center; color:black;"><div style="background-image:url(\'/gfx/logo.jpg\'); background-repeat:no-repeat; height:80px; margin-top:50px; background-position:center;"></div><div style="background-color:#EF5674; margin:0px; margin-top:20px; padding:2px; padding-bottom:20px; color:#000000;"><font style="font-weight:bold; font-size:12px;">UWAGA!</font> Serwis <font style="font-weight:bold; font-size:18px; color:#ffffff;">XXXplace.pl</font> zawiera tre&#347;ci o tematyce erotycznej i jest przeznaczony <u>tylko i wy&#322;&#261;cznie</u> dla os&oacute;b powy&#380;ej <font style="font-weight:bold; color:#000000;">18 roku &#380;ycia</font>.<p style="border:1px #000000 dashed; background-color:#333333; color:#FFFFFF;">Je&#347;li nie uko&#324;czy&#322;e&#347; <font style="font-weight:bold;">18 roku &#380;ycia</font>, nie chcesz ogl&#261;da&#263; tego typu tre&#347;ci lub jest to niezgodne z prawem Twojego kraju, nie wolno Ci wchodzi&#263; dalej!</p><p style="margin-bottom:0px;">Wchodz&#261;c dalej <u>o&#347;wiadczasz</u>, &#380;e jeste&#347; osob&#261; pe&#322;noletni&#261;, chcesz ogl&#261;da&#263; tre&#347;ci o tematyce erotycznej z w&#322;asnej, nie przymuszonej woli oraz odbi&oacute;r tych tre&#347;ci nie zosta&#322; Ci w &#380;aden spos&oacute;b narzucony.</p></div><div style="height:30px; padding-top:15px; font-size:22px; font-weight:bold; clear:both;"><a href="?enter" style="color:#000000; border:1px solid #EF5674; padding-right:30px; padding-left:30px; padding-top:5px; padding-bottom:5px; background-color:#EF5674;">WCHODZ&#280;</a> <a href="http://pajacyk.pl" style="color:#EF5674; border:1px solid #EF5674; padding-right:30px; padding-left:30px; padding-top:5px; padding-bottom:5px; background-color:#333333;">NIE WCHODZ&#280;</a></div></div>';
}}

function vote(target_id, ayes){
	
	connect();
	
	http_request.onreadystatechange = function(){ 	

		if(http_request.readyState == 4){
			if(http_request.status == 200){
			
			document.getElementById("PopValue").innerHTML='';
			document.getElementById("PopInfo").innerHTML='Dzi'+String.fromCharCode(281)+'kujemy! G'+String.fromCharCode(322)+'os zosta'+String.fromCharCode(322)+' oddany.';	
		
			}else vote(target_id, ayes);			
		}}
	
	http_request.open('GET', 'http://www.xxxplace.pl/votePop.php?target_id='+target_id+'&ayes='+ayes, true);	
	http_request.send(null);

}

function add2favorites(target_id){
	
	connect();
	
	http_request.onreadystatechange = function(){ 	

		if(http_request.readyState == 4){
			if(http_request.status == 200){
			
			document.getElementById("AddFavorites").innerHTML='Film zostal dodany do Twojej listy ulubionych.';
		
			}else add2favorites(target_id);			
		}}
	
	http_request.open('GET', 'http://www.xxxplace.pl/add2favorites.php?target_id='+target_id, true);	
	http_request.send(null);

}

function url(order){
var gourl = order.options[order.selectedIndex].value; 
window.self.location.href=gourl;
}
