iens6=document.all||document.getElementById;
ns4=document.layers;
var actionsArray = new Array;
var thename;
var theobj;
var thetext;
var winHeight;
var winWidth;
var boxPosition;
var timerID;
var seconds=0;
var x=0;
var y=0;
var xr=0;
var yr=0;
var offsetx = 2;
var offsety = 2;
var Browser;
// END GLOBAL VARIABLES
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
function checkIt(string)
{
place = detect.indexOf(string) + 1;
thestring = string;
return place;
}
if (checkIt('msie')) Browser = 'IE';
else Browser = 'Other';
if (Browser === 'IE') {document.onmousemove=GetPosition;}
if(ns4) {
document.captureEvents(Event.MOUSEMOVE);
}
if (iens6){
document.write("
");
}
if (ns4){
hideobj = eval("document.nsviewer");
hideobj.visibility="hidden";
}
function setObj(textelement,inwidth,inheight,boxpos,tfontcolor,bfontcolor, thetext) {
clearTimeout(timerID);
boxPosition=boxpos;
winWidth=inwidth;
winHeight=inheight;
if (boxPosition === "bottomR") {
if (Browser==='IE') {
x=x+offsetx;
y=y+offsety+5;
}
else {
// x=x;
y=y+12;
}
}
if (boxPosition === "right") {
if (Browser==='IE') {
x=x+offsetx+80;
// y=y;
}
else {
x=x+xr+2;
// y=y
}
}
if (boxPosition === "topR") {
if (Browser==='IE') {
x=x+offsetx+5;
y=y+offsety-winHeight-15;
}
else {
// x=x;
y=y-winHeight;
}
}
if (boxPosition === "topL") {
// x=x-(offsetx+2)-winWidth-1
// y=y+offsety-winHeight+1
x=x-winWidth-10;
y=y-winHeight+5;
}
if(iens6){
thename = "viewer";
theobj=document.getElementById? document.getElementById(thename):document.all.thename ;
theobj.style.width=winWidth + 'px';
theobj.style.height=winHeight + 'px';
theobj.style.left=x + 'px';
theobj.style.top=y + 'px';
if(iens6&&document.all) {
theobj.innerHTML = "";
theobj.insertAdjacentHTML("BeforeEnd",thetext);
}
if(iens6&&!document.all) {
theobj.innerHTML = "";
theobj.innerHTML='';
}
}
if(ns4){
thename = "nsviewer";
theobj = eval("document."+thename);
theobj.left=x;
theobj.top=y;
theobj.width=winWidth;
theobj.clip.width=winWidth;
theobj.height=winHeight;
theobj.clip.height=winHeight;
theobj.document.write("");
theobj.document.close();
}
viewIt();
}
function viewIt() {
if(iens6) {
theobj.style.visibility="visible";
}
if(ns4) {
theobj.visibility = "visible";
}
}
function stopIt() {
if(iens6) {
theobj.innerHTML = "";
theobj.style.visibility="hidden";
}
if(ns4) {
theobj.document.write("");
theobj.document.close();
theobj.visibility="hidden";
}
}
function timer(sec) {
seconds=parseInt(sec);
if(seconds>0) {
seconds--;
timerID=setTimeout("timer(seconds)",1000);
}else{
stopIt();
}
}
// Pametno pozicioniranje glede na DIV (in ne kurzor)
function GetPosition(e){
if (Browser === 'IE') { // IE je glup glup glup, ni pametnega pozicioniranja.
if (document.all) {
x=0;
y=0;
x=event.x;
y=event.y;
xr=x+120;
yr;
}
if (!document.all) {
x=0;
y=0;
x=e.pageX;
y=e.pageY;
xr=x+120;
yr;
}
}
else {
if (e===document){
x=e.body.scrollLeft;
y=e.body.scrollTop;
}
else if (e!==null){
var left=e.offsetLeft;
var top=e.offsetTop;
x=left;
y=top;
xr=e.offsetWidth;
yr=e.offsetHeight;
}
}
}
var sajax_debug_mode = false;
var sajax_request_type = "POST";
function sajax_debug(text) {
if (sajax_debug_mode) {
alert("RSD: " + text);
}
}
function sajax_init_object() {
sajax_debug("sajax_init_object() called..");
var A;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest !== "undefined") {
A = new XMLHttpRequest();
}
if (!A) {
sajax_debug("Could not create connection object.");
}
return A;
}
function sajax_do_call(func_name, args) {
var i, x, n;
var uri;
var post_data;
uri = "admin/direct.php";
if (sajax_request_type === "GET") {
if (uri.indexOf("?") === -1) {
uri = uri + "?rs=" + unescape (func_name);
}
else {
uri = uri + "&rs=" + unescape (func_name);
}
for (i = 0; i < args.length-1; i++) {
uri = uri + "&rsargs[]=" + args[i];
}
uri = uri + "&rsrnd=" + new Date().getTime();
post_data = null;
} else {
post_data = "rs=" + unescape (func_name);
for (i = 0; i < args.length-1; i++) {
// post_data = post_data + "&rsargs[]=" + escape(args[i]);
post_data = post_data + "&rsargs[]=" + args[i];
}
}
x = sajax_init_object();
x.open(sajax_request_type, uri, true);
if (sajax_request_type === "POST") {
x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
}
x.onreadystatechange = function() {
if (x.readyState !== 4) {
return;
}
sajax_debug("received " + x.responseText);
var status;
var data;
status = x.responseText.charAt(0);
data = x.responseText.substring(2);
if (status === "-") {
alert("Error: " + data);
}
else {
args[args.length-1](data);
}
};
x.send(post_data);
sajax_debug(func_name + " uri = " + uri + "/post = " + post_data);
sajax_debug(func_name + " waiting..");
delete x;
}
// wrapper for changeText
function x_changeText() {
sajax_do_call("changeText", x_changeText.arguments);
}
function textChanger_cb(result) {
var result_array=result.split("~~|~~");
var fwd = '';
CleanID = result_array[1].split (' ');
/*
RUBTTL- title of headlines on front page AND in sidelist AND in archive
TRUB- name of the column (news, faq, etc)
NAVUPA- level 1 menu
NAVUPB- level 2 menu
NAVLE- left menu (including menu inside content)
FORUM- forum
*/
if (!(result_array[1].indexOf("RUBTTL") === -1)) fwd = "" + result_array[0] + '
';
if (!(result_array[1].indexOf("TRUB") === -1)) fwd = "" + result_array[0] + '
';
if (!(result_array[1].indexOf("RUBCONT") === -1)) fwd = "" + result_array[0] + '
';
if (!(result_array[1].indexOf("TANK") === -1)) fwd = "" + result_array[0] + '
';
if (!(result_array[1].indexOf("FOOT") === -1)) fwd = "" + result_array[0] + '
';
if (!(result_array[1].indexOf("NAVUPA") === -1)) fwd = "" + result_array[0] + " ";
if (!(result_array[1].indexOf("NAVUPB") === -1)) fwd = "" + result_array[0] + " ";
if (!(result_array[1].indexOf("NAVLE") === -1)) fwd = "" + result_array[0] + " ";
if (!(result_array[1].indexOf("CONT") === -1)) fwd = "" + result_array[0] +"
";
if (!(result_array[1].indexOf("FORUM") === -1)) fwd = "" + result_array[0] + " ";
// if (fwd.indexOf("div") == -1) fwd = result_array[0];
document.getElementById(result_array[1]).innerHTML = fwd;
}
function parseForm(cellID, inputID) {
if (! document.getElementById(inputID).value) {
alert("This field cannot be empty");
return;
}
var st = document.getElementById(inputID).value + '~~|~~' + cellID;
document.getElementById(cellID).innerHTML = "Updating... ";
x_changeText(st, textChanger_cb);
//document.getElementById(cellID).style.border = 'none';
//document.getElementById(cellID).style.background = '#ffffff';
}
// uploader
function parseFormB(cellID, inputID) {
if (! document.getElementById(inputID).value) {
alert("This field cannot be empty");
return;
}
alert("SEM NOTER");
var st = document.getElementById(inputID).value + '~~|~~' + cellID;
document.getElementById(cellID).innerHTML = "Updating... ";
x_changeText(st, textChanger_cb);
document.getElementById(cellID).style.border = 'none';
document.getElementById(cellID).style.background = '#ffffff';
}
function editCell(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = "";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
document.getElementById(id).style.background = '#f3f3f3';
document.getElementById(id).style.border = '1px solid #ddd';
}
function editrttl(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = "";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
document.getElementById(id).style.background = '#f3f3f3';
document.getElementById(id).style.border = '1px solid #ddd';
}
function editBlock(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = "";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
document.getElementById(id).style.background = '#f3f3f3';
document.getElementById(id).style.border = '1px solid #ddd';
}
function editUpNav(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = " ";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
// document.getElementById(id).style.background = '#f3f3f3';
// document.getElementById(id).style.border = '1px solid #ddd';
document.getElementById(id).style.background = '#ffffff';
document.getElementById(id).style.border = 'none';
}
function editLeftNav(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = " ";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
document.getElementById(id).style.background = '#f3f3f3';
document.getElementById(id).style.border = '1px solid #ddd';
}
function editForum(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = " ";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
//document.getElementById(id).style.background = '#f3f3f3';
//document.getElementById(id).style.border = '1px solid #ddd';
}
function editEditor(id, cellSpan) {
var inputWidth = (document.getElementById(id).offsetWidth / 7);
var oldCellSpan = cellSpan.innerHTML;
document.getElementById(id).innerHTML = "" + " ";
document.getElementById(id+"input").value = oldCellSpan;
document.getElementById(id+"input").focus();
document.getElementById(id).style.background = '#f3f3f3';
document.getElementById(id).style.border = '1px solid #ddd';
}
function bgSwitch(ac, td) {
if (ac === 'on'){
td.style.background = '#a3a3a3';
td.style.border = '#ddd';
} else if (ac === 'off'){
td.style.background = '#ffffff';
td.style.border = 'none';
}
}
function bgSwitchplus(ac, td) {
if (ac === 'on'){
td.style.background = '#a3a3a3';
td.style.border = '#ddd';
} else if (ac === 'off'){
td.style.background = '#ffffff';
td.style.border = 'none';
}
}