﻿function GlobalsClass(){
	this.debug = false;
}
GlobalsClass.prototype.alert = function(aText){
	if (!this.debug) return;
	alert(aText);
}
GlobalsClass.prototype.disableSubmit = function disableSubmit(e){
	var characterCode;

	if(e && e.which){ 
		e = e;
		characterCode = e.which;
	}else{
		e = window.event;
		characterCode = e.keyCode;
	}
	if(characterCode == 13){
		e.cancelBubble = true;
		return false;
	}
	return true;
}
var Globals = new GlobalsClass();

function BrowserInfoClass(){
	this.CC_BROWSER_IE = 1;
	this.CC_BROWSER_GECKO = 2;
	this.CC_BROWSER_UNKNOWN = 0;
	this.BrowserType = this.CC_BROWSER_UNKNOWN;
	this.BrowserVersion = 0;
	
	function GetBrowserInfo(o){
		if (navigator.appName.indexOf('Microsoft') >= 0){
			o.BrowserType = o.CC_BROWSER_IE;
			return;
		}
		if (navigator.appName.indexOf('Netscape') >= 0){
			o.BrowserType = o.CC_BROWSER_GECKO;
			return;
		}
		if (navigator.appName.indexOf('Opera') >= 0){
			o.BrowserType = o.CC_BROWSER_GECKO;
			return;
		}
		o.BrowserType = o.CC_BROWSER_UNKNOWN;
	}
	GetBrowserInfo(this);
}

function CancelBubble(o,e){
	if (!e) var e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
}

function addBookmark(title, url)
{
	if (window.sidebar)
	{ // firefox
		window.sidebar.addPanel(title, url,"NO");
	}
	else if(document.all)
	{ //MSIE
		window.external.AddFavorite( url, title);
	}
	else
	{
		alert("Vaš brskljalnik ne podpira te možnosti.");
	}
}
function bookmarksite(title, url)
{
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "");
}
window.onload = function() {
    antispam_emails();
}

function antispam_emails() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        if ((email = anchor.getAttribute("href")) && anchor.getAttribute("type") == "antispam") {
			var vsebina = anchor.innerHTML;
            anchor.href = antispam_replace(email);
            anchor.innerHTML = antispam_replace(vsebina);
        }
    }
}

function antispam_replace(email) {
    var modified = email.replace(/%20/g, " "); // za IE
    modified = modified.replace(/ AFNA /g, "@");
    modified = modified.replace(/ PIKA /g, ".");
    return modified;
}

function OpenPopupGallery(URI) {
   var lH = screen.height - 60;
   var Settings = "scrollbars=yes,resizable=yes,";
   Settings = Settings + "width=770";
   Settings = Settings + ",height=" + lH; 
   theNewWin = window.open(URI, 'popup', Settings);
   theNewWin.focus();
}