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://www.skavt.net/'; var originalrate=new Array(); var donotcheckinvitation=false; // ############### AJAX function loadXML(url) { url='http://www.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://www.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 = '
SkavtNET sporočilo'; dialogw = dialogw + '
Trenutek prosim ...
'; dialogw = dialogw + ''; dialogw = dialogw + '   '; dialogw = dialogw + '
'; //display it document.getElementById('transcreen').innerHTML=dialogw; } function replyinvitationdone() { closetranscreen(); donotcheckinvitation=false; } // ################ MESSAGE BOX function opentranscreen(msg,textok,feedbackok,textcancel,feedbackcancel) { if (!textok) { textok='V REDU'; } if (!feedbackok) { feedbackok='closetranscreen(); return false;'; } if (textcancel && !feedbackcancel) { feedbackcancel='closetranscreen(); return false;'; } document.body.className='transparent'; //resize shadow var htmlheight = document.body.parentNode.scrollHeight; var windowheight = window.innerHeight; if ( htmlheight < windowheight ) { document.getElementById('transcreen').style.height = windowheight + "px"; } else { document.getElementById('transcreen').style.height = htmlheight + "px"; } //create message field var dialogw = '
SkavtNET sporočilo'; //dialogw = dialogw + 'X'; dialogw = dialogw + '
' + msg + '
'; dialogw = dialogw + ''; if (textcancel) { dialogw = dialogw + '   '; } dialogw = dialogw + '
'; //display it document.getElementById('transcreen').className='transparent'; document.getElementById('transcreen').innerHTML=dialogw; //show screen document.getElementById('transcreen').style.display='block'; //focus on it document.location.hash = 'header'; } function openwarning(msg,bgcolor) { if (!bgcolor) { bgcolor='#ff8a00'; } document.body.className='transparent'; document.body.style.backgroundColor=bgcolor; //resize shadow var htmlheight = document.body.parentNode.scrollHeight; var windowheight = window.innerHeight; if ( htmlheight < windowheight ) { document.getElementById('transcreen').style.height = windowheight + "px"; } else { document.getElementById('transcreen').style.height = htmlheight + "px"; } //create warningbox warningbox=document.createElement('div'); warningbox.setAttribute('id','warningbox'); warningbox.setAttribute('class','dialogbox'); warningbox.setAttribute('name','warningbox'); warningbox.innerHTML=msg; document.getElementById('transcreen').appendChild(warningbox); document.getElementById('transcreen').className='transparent'; document.getElementById('transcreen').style.backgroundColor=bgcolor; document.getElementById('transcreen').style.display='block'; document.location.hash = 'header'; } function closetranscreen() { document.body.style.background='white'; document.getElementById('transcreen').style.display='none'; } // ####################### POŠTA function getObject(obj) { var theObj; if(document.all) { if(typeof obj=="string") { return document.all(obj); } else { return obj.style; } } if(document.getElementById) { if(typeof obj=="string") { return document.getElementById(obj); } else { return obj.style; } } return null; } //Contador de caracteres. function Contar(entrada,salida,texto,caracteres) { var entradaObj=getObject(entrada); var salidaObj=getObject(salida); var longitud=caracteres - entradaObj.value.length; if(longitud <= 0) { longitud=0; texto=' '+texto+' '; entradaObj.value=entradaObj.value.substr(0,caracteres); } salidaObj.innerHTML = texto.replace("{CHAR}",longitud); } // end of steve's code var countarray=0; var skavtnetusers = new Array(); var skavtnetuserslist = new Array(); function adduser(uid,name) { if (newwindow) { target=newwindow; } else { target=window; } if (countarray<20) { if (skavtnetusers[uid]) { target.alert(name + ' je že na seznamu prejemnikov, zato ga ne moreš dodati še enkrat!'); } else { cid=skavtnetuserslist.length; skavtnetuserslist[cid]=new Array(uid,name); skavtnetusers[uid]=cid; filluser(); if (countarray==20 && newwindow) { newwindow.close(); } else if (newwindow && !newwindow.confirm(name + ' uspešno dodan/a na seznam prejemnikov!\nAli želiš dodati še kakšnega prejemnika \n(po želji jih lahko poiščeš in dodaš še ' + (20 - countarray) + ') ?')) { newwindow.close(); } } } else { target.alert('Dodaš lahko največ 20 različnih prejemnikov!'); if (newwindow) { newwindow.close(); } } } function deluser(uid) { if (skavtnetusers[uid]) { skavtnetuserslist.splice(skavtnetusers[uid],1); skavtnetusers.splice(uid,1); filluser(); } } function filluser() { countarray=0; var content='