	function jsDeleteGallery(gallery_id,url)
	{

		if (confirm('Naozaj si želáte zmazať túto galériu?'))
		{
			location.replace(url);
		}
		return;
	}
	function jsDeletePhoto(photo_id,url)
	{

		if (confirm('Naozaj si želáte zmazať túto fotku?'))
		{
			location.replace(url);
		}
		return;
	}
	function jsDeletePost(news_id,url)
	{

		if (confirm('Naozaj si želáte zmazať tento príspevok?'))
		{
			location.replace(url);
		}
		return;
	}

	function jsDeleteVideo(news_id,url)
	{

		if (confirm('Naozaj si želáte zmazať toto video?'))
		{
			location.replace(url);
		}
		return;
	}

	function jsShowPhoto(photo_id, gal_id, offset, width, height){
		window.open('scripts/photo.php?id=' + photo_id + '&gallery= ' + gal_id + '&offset=' + offset,'photoWindow', 'width=' + width +',height=' + height +',resizable=no,scrollbars=yes,location=no,status=no,toolbar=no,menubar=no');
		return;
	}

function jsToggle(x)
{
	//alert ("aaa");
	if (document.getElementById(x).style.display == "none")
		(document.getElementById(x).style.display = "block")
	else
		(document.getElementById(x).style.display = "none")
}
function clearAreaGuestbook(inputname,input,value){
	if (inputname == 'post_header'){
		if(input==value ){
				document.fpost.post_header.value='';
		}
	}
	if (inputname == 'post_mail'){
		if(input==value ){
				document.fpost.post_mail.value='';
		}
	}
}

function clearAreaGuestbook(inputname,input,value){
	if (inputname == 'post_header'){
		if(input==value ){
				document.fpost.post_header.value='';
		}
	}
	if (inputname == 'post_mail'){
		if(input==value ){
				document.fpost.post_mail.value='';
		}
	}
}

function jsShowBlock(x,val1,val2){
if (val1 == val2){
	document.getElementById(x).style.display = "block";
}
else{
	document.getElementById(x).style.display = "none";
}
return;
}

function jsOpenMailW(link, width, height,path){
	window.open(path + 'indexlink.php?l=link&' + link,'mailWindow', 'width=' + width +',height=' + height +',top=100, left=100, resizable=no,scrollbars=no,location=no,status=no,toolbar=no,menubar=no');
	return;
}

function makeRequest(url, parameters, alertFunction) {
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
       http_request = new XMLHttpRequest();
       if (http_request.overrideMimeType) {
          http_request.overrideMimeType('text/plain');
       }
    } else if (window.ActiveXObject) { // IE
       try {
          http_request = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             http_request = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (e) {}
       }
    }
    if (!http_request) {
       //alert('Cannot create XMLHTTP instance');
       return false;
    }
    http_request.onreadystatechange = alertFunction;
    http_request.open('GET', url + parameters, true);
    http_request.send(null);
 }

 function alertVideoRated() {
    if (http_request.readyState == 4) {
       if (http_request.status == 200) {
          var resp = http_request.responseText;
       } else {
          alert('There was a problem with the request.');
       }
       if (resp.substr(0,5) == "error"){
       	alert(resp.substr(6));
       }
       else if(resp.substr(0,4) == "rate"){
       	//alert(resp);
       	//var cid = document.getElementById('cid').value;
       	document.getElementById('content_rates').innerHTML = resp.substr(5);
       }
    }
    return;
 }

 function jsRateVideo(value,uid,cid)
{
	if (!uid){
		if(confirm('Hodnotiť môžu iba prihlásení užívatelia.\nChcete presmerovať na prihlasovaciu stránku?'))
			{
				location.href = "index.php?id=login";
			}
			return;
	}
	if (!confirm('Chcete priradiť hodnotu ' + value + '?'))
	{
		return;
	}

	//var cid = document.getElementById('cid').value;
	//alert('?action=rate&cid=' + cid + '&uid=' + uid + '&pvalue=' + value);
	makeRequest('./scripts/videoplayer.php', '?action=rate&cid=' + cid + '&uid=' + uid + '&pvalue=' + value, alertVideoRated);
}

function jsSendPost(page,act){
	document.gForm.action = page;
	var el = document.getElementById('save');
	el.value = '1';
	document.getElementById('gForm').submit();
}


