//rDragCZ CMS source files
//For copyright and other info see cmsengine.php
//Automatic session refreshing, only for modern browsers
if(XMLHttpRequest)
{
window.setInterval(function()
{
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://www.rdrag.cz/extscripts/refresh_session.php");
xhr.onreadystatechange = function()
{
if(xhr.readyState == 4)
{
}
}
xhr.send(null);
}, 120000);
}
//Articles Add-To Bookmarks
function addToBookmarks()
{
switch(document.getElementById('article_addto').value)
{
case "Linkuj.cz":
window.open("http://linkuj.cz/?id=linkuj&url=" + encodeURIComponent(document.URL) + "&title=" + encodeURIComponent(document.title));
break;
case "Jagg.cz":
window.open("http://www.jagg.cz/bookmarks.php?action=add&address=" + encodeURIComponent(document.URL) + "&title=" + encodeURIComponent(document.title));
break;
case "Vybrali.sme.sk":
window.open("http://vybrali.sme.sk/submit.php?url=" + encodeURIComponent(document.URL));
break;
case "delicious.com":
window.open('http://delicious.com/save?v=5&noui&jump=close&url='+encodeURIComponent(document.URL)+'&title='+encodeURIComponent(document.title), 'delicious','toolbar=no,width=550,height=550');
break;
case "Digg.com":
var text = document.getElementById("article_perex").innerHTML;
if(text.length > 350)
{
text = text.substring(0, 345);
text = text + "...";
}
window.open("http://digg.com/submit?url=" + encodeURIComponent(document.URL) + "&title=" + encodeURIComponent(document.title) + "&bodytext=" + encodeURIComponent(text) + "&media=news&topic=tech_news");
break;
case "Zalozky":
if (document.all && !window.opera)
{
window.external.AddFavorite(document.URL, document.title);
}
else if (window.sidebar && window.sidebar.addPanel)
{
window.sidebar.addPanel(document.title, document.URL, '');
}
else
{
alert("Váš prohlížeč nepodporuje záložkování přes JS, po potvrzení tohoto dialogu tedy prosím stiskněte Ctrl+D.");
}
break;
case "GoogleBookmarks":
var a=window, b=document, c=encodeURIComponent, d=a.open("http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title), "bkmk_popup", "left="+((a.screenX||a.screenLeft)+10)+", top="+((a.screenY||a.screenTop)+10)+", height=420px, width=550px, resizable=1, alwaysRaised=1"); a.setTimeout(function(){d.focus()},300)
break;
}
}
//Polls
var voted = false;
var pollVoteAid = -1;
function writeJabberStatus(result)
{
switch(result)
{
case "online":
document.getElementById("jabberStatus").innerHTML = "On-Line";
document.getElementById("jabberStatus").style.color = "#5EFF40";
break;
case "offline":
document.getElementById("jabberStatus").innerHTML = "Off-Line";
document.getElementById("jabberStatus").style.color = "red";
break;
case "xa":
document.getElementById("jabberStatus").innerHTML = "N/A (nepřítomen)";
document.getElementById("jabberStatus").style.color = "#CCCCCC";
break;
case "away":
document.getElementById("jabberStatus").innerHTML = "Na chvíli pryč";
break;
case "dnd":
document.getElementById("jabberStatus").innerHTML = "Nerušit";
break;
default:
document.getElementById("jabberStatus").innerHTML = "?";
break;
}
}
function writeVoteResult(response)
{
var responseArray = response.split("\n");
if(responseArray[0] == "AlreadyVoted")
{
var pollId = responseArray[1];
$('pollId'+pollId+'Result').innerHTML = "Nelze hlasovat vícekrát.
";
}
else if(responseArray[0] == "InvalidPoll")
{
alert("Neplatná anketa.");
//$('pollId'+pollId+'Result').innerHTML = "Neplatná anketa.
";
}
else if(responseArray[0] == "VoteSuccess")
{
//get poll id
var pollId = responseArray[1];
$('pollId'+pollId+'Result').innerHTML = "Úspěšně odhlasováno.
";
//get bar width multiplier
var multip = parseFloat(document.getElementById("answerbar_width_multiplier_"+pollId).innerHTML);
for(var i = 3; i < responseArray.length; i++)
{
var answer = responseArray[i];
var answerArray = answer.split(":");
if(answerArray.length == 3 && !isNaN(answerArray[0]) && !isNaN(answerArray[1]) && !isNaN(answerArray[2]))
{
//calculate new bar width
var width = parseFloat(answerArray[2])*multip;
width = Math.round(width);
//set the width and votes count
document.getElementById("poll_votesbar_aid_"+answerArray[0]).style.width = width + "px";
document.getElementById("poll_votes_count_aid_"+answerArray[0]).innerHTML = answerArray[1];
}
}
//set total votes count
document.getElementById("poll"+pollId+"_total_votes_count").innerHTML = responseArray[2];
}
$('pollId'+pollId+'Result').style.display = "block";
setTimeout("$('" + ("pollId"+pollId+"Result") + "').style.display = 'none';", 3000);
var anchors = $('pollId'+pollId+'Container').getElements('a');
for(i = 0; i < anchors.length; i++)
{
if(anchors[i].style)
{
anchors[i].style.textDecoration = "none";
anchors[i].href = "javascript: return false;";
}
}
}
function pollVote(answerId)
{
if(voted == false)
{
var voteRequest = new Request({url: './extscripts/pollvote.php?answer_id='+answerId,
method: 'post',
onComplete: writeVoteResult
});
voteRequest.send();
voted = true;
pollVoteAid = answerId;
}
}
//Viewing gallery image
function turnExifView(turnOn)
{
if(turnOn == true)
{
document.getElementById("exifInfo").style.display = "block";
document.getElementById("exifSwitchLink").style.display = "none";
}
else
{
document.getElementById("exifInfo").style.display = "none";
document.getElementById("exifSwitchLink").style.display = "block";
}
}
//Search
function viewSearchSubCategory()
{
var categMenu = document.forms.searchForm.search_type.value;
document.getElementById("search_categories_articles").style.display="none";
document.getElementById("search_categories_downloads").style.display="none";
document.getElementById("search_categories_gallery").style.display="none";
if(categMenu == "articles")
{
document.getElementById("search_categories_articles").style.display="block";
}
else if(categMenu == "downloads")
{
document.getElementById("search_categories_downloads").style.display="block";
}
else if(categMenu == "gallery")
{
document.getElementById("search_categories_gallery").style.display="block";
}
}
function gotoSearch(where)
{
switch(where)
{
case "articles":
document.getElementById("search_type").value = "articles";
break;
case "gallery":
document.getElementById("search_type").value = "gallery";
break;
case "downloads":
document.getElementById("search_type").value = "downloads";
break;
}
document.getElementById("search_categories_articles").style.display="none";
document.getElementById("search_categories_downloads").style.display="none";
document.getElementById("search_categories_gallery").style.display="none";
document.forms.searchForm.submit();
}
//Articles Comments
function spamBotCheck()
{
if(document.getElementById("captcha_nojs") && document.getElementById("captcha") && document.getElementById("captcha_hash"))
{
document.getElementById("captcha_nojs").style.display="none";
document.getElementById("captcha").value = hex_sha256(document.getElementById("captcha_hash").value);
}
}
function addBBCodeMark(_mark)
{
document.getElementById("comment").focus();
switch(_mark)
{
case "url":
document.getElementById("comment").value += "[url=][/url]";
break;
break;
case "*":
document.getElementById("comment").value += "[*]";
break;
case "align":
document.getElementById("comment").value += "[align=][/align]";
break;
default:
document.getElementById("comment").value += "[" + _mark + "][/" + _mark + "]";
break;
}
}
function addSmiley(_smiley)
{
document.getElementById("comment").focus();
document.getElementById("comment").value += " "+_smiley+" ";
}
function quotePost(_postId)
{
var cnt = document.getElementById("comment_"+_postId+"_content").innerText;
if(cnt.length > 75)
{
cnt = cnt.substring(0, 72);
cnt += "...";
}
cnt = cnt.replace(/(\n|\r){2,}/g, "\n");
document.getElementById("comment").value += "[quote=" + document.getElementById("comment_id_"+_postId+"_author").innerHTML + "]";
document.getElementById("comment").value += cnt;
document.getElementById("comment").value += "[/quote]\n";
document.getElementById("comment").focus();
}