window.onload=whenload;
function whenload() {
//checkinvitation();
//initLightbox();
}
var newwindow = '';
function popitup(url,width,height,options)
{
if (!newwindow.closed && newwindow.location)
{
newwindow.location.href = url;
}
else
{
newwindow=window.open(url,'okencek','height='+height+options+',width='+width);
if (!newwindow.opener) newwindow.opener = self;
}
if (window.focus) {newwindow.focus()}
return false;
}
function searchpreveri() {
if (document.getElementById('isci').value.length<4) {
alert('Iskalni niz mora biti daljši od treh znakov!');
return false;
}
return true;
}
var globurl='http://skavt.net/';
var originalrate=new Array();
var donotcheckinvitation=false;
// ############### AJAX
function loadXML(url)
{
url='http://skavt.net/'+url;
// load xml file
// code for IE
if (window.ActiveXObject) {
xmlDoc = new ActiveXObject("Microsoft.XMLHTTP");
if (xmlDoc) {
xmlDoc.onreadystatechange = processXML;
xmlDoc.open("GET", url, true);
xmlDoc.send();
}
}
// code for Mozilla, etc.
else if (document.implementation && document.implementation.createDocument) {
xmlDoc = new XMLHttpRequest();
xmlDoc.onreadystatechange = processXML;
xmlDoc.open("GET", url, true);
xmlDoc.send(null);
}
else {
alert('Error - you are using browser, that doesn\'t support XML. Please, download the newest version of Mozilla Firefox or Internet Explorer.');
}
}
function processXML()
{
// if xmlDoc is complete
if (xmlDoc.readyState == 4) {
try {
// is doc status OK
if (xmlDoc.status == 200) {
xmlResponse = xmlDoc.responseXML.documentElement;
if (xmlResponse.getElementsByTagName('function').length>0) {
xmlFunction = xmlResponse.getElementsByTagName('function')[0].firstChild.data;
eval(xmlFunction + '()');
}
else {
alert("Internal error in XML.");
}
}
else {
alert("There was a problem retrieving the XML data:\n" + xmlDoc.statusText);
}
}
catch(error) {
// alert(error);
}
}
}
// ################# GLASOVANJE
function previewrate(string,id,ismini) {
img='img/cevelj';
//store info for later
originalrate[string]=new Array();
for (i=1;i<=5;i++) {
originalrate[string][i]=document.getElementById(string+i).src;
}
for (i=1;i<=5;i++) {
document.getElementById(string+i).src=globurl+img+'_blank.gif';
}
for (i=1;i<=id;i++) {
document.getElementById(string+i).src=globurl+img+'_full.gif';
}
}
function clearpreviewrate(string,id) {
for (i=1;i<=5;i++) {
document.getElementById(string+i).src=originalrate[string][i];
}
}
function rate(mid, rate, contentid) {
loadXML('?contenttype=none&s=skavtopis&a=xml-oceni&id=' + mid + '&contentid=' + contentid + '&rate=' + rate);
document.getElementById(contentid).innerHTML='Trenutek, prosim...';
}
function rateimage(imid, rate, contentid) {
loadXML('?contenttype=none&s=skavtopis&a=xml-oceni&id=' + imid + '&contentid=' + contentid + '&rate=' + rate);
document.getElementById(contentid).innerHTML='Trenutek, prosim...';
}
function ratefeedback() {
result = xmlResponse.getElementsByTagName('result')[0].firstChild.data;
contentid = xmlResponse.getElementsByTagName('contentid')[0].firstChild.data;
if (result==1) {
document.getElementById(contentid).innerHTML='Hvala! Rezultati niso vidni takoj!';
//zablokirajmo
for (i=1;i<=5;i++) {
document.getElementById('ratelink-'+i).onclick=function() {
document.getElementById('ratefeedback').innerHTML='Žal lahko glasuješ samo enkrat!';
return false;
};
}
}
else {
error = xmlResponse.getElementsByTagName('error')[0].firstChild.data;
document.getElementById(contentid).innerHTML='' + error + '';
}
}
// ############## CHAT
function openchat() {
mainchatwindow=window.open('http://skavt.net/klepet','chatwindow','height=380,scrollbars=false,width=560');
}
function whenchatquit() {
loadXML('?contenttype=none&s=klepet&a=process&quit=true');
}
function whenchatquited() {
//do nothing
}
function checkinvitation() {
if (!donotcheckinvitation) {
loadXML('?contenttype=none&s=klepet&a=xml-checkinvited');
}
}
function checkinvitationdone() {
vrednost = xmlResponse.getElementsByTagName('vrednost')[0].firstChild.data;
if (vrednost==1) {
donotcheckinvitation=true;
title=xmlResponse.getElementsByTagName('title')[0].firstChild.data;
fromuuniqid=xmlResponse.getElementsByTagName('fromuniqid')[0].firstChild.data;
invitationid=xmlResponse.getElementsByTagName('invitationid')[0].firstChild.data;
msg=title+' te vabi, da se ji/mu pridružiš pri SkavtKLEPETU';
feedback1="replyinvitation('" + invitationid + "'); openchat(); return false;";
feedback2="replyinvitation('" + invitationid + "'); return false;";
opentranscreen(msg,'SPREJMI',feedback1,'ZAVRNI',feedback2);
}
setTimeout("checkinvitation()", 5000);
}
function replyinvitation(id) {
loadXML('?contenttype=none&s=klepet&a=xml-checkinvited&clear='+id);
var dialogw = '