// Global Script File
var someWindow = null;
var webSiteUserID = null;
function OpenWindow(winPath, winName, w, h){
	if((w=="")||(w==null)||(w==0))
		w = 450;
	if((h=="")||(h==null)||(h==0))
		h = 350;
	var scrL, srcT;
	srcL = Math.round((screen.width/2)-(w/2));
	srcT = Math.round((screen.height/2)-(h/2));
	window.open(sitePath + "/" + winPath, winName, "left="+srcL+",top="+srcT+",width="+w+",height="+h+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0"); 	
}	

function OpenWin(winPath, winName, w, h){
	if((w=="")||(w==null)||(w==0))
		w = 450;
	if((h=="")||(h==null)||(h==0))
		h = 350;
	var scrL, srcT;
	srcL = Math.round((screen.width/2)-(w/2));
	srcT = Math.round((screen.height/2)-(h/2));
	return window.open(sitePath + winPath, winName, "left="+srcL+",top="+srcT+",width="+w+",height="+h+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0");
}

function OpenWinResize(winPath, winName, w, h) {
    if ((w == "") || (w == null) || (w == 0))
        w = 450;
    if ((h == "") || (h == null) || (h == 0))
        h = 350;
    var scrL, srcT;
    srcL = Math.round((screen.width / 2) - (w / 2));
    srcT = Math.round((screen.height / 2) - (h / 2));
    return window.open(sitePath + winPath, winName, "left=" + srcL + ",top=" + srcT + ",width=" + w + ",height=" + h + ",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=1");
}	

var shoutBoxWin = null;
function OpenShoutWin(w, h){
	if((w=="")||(w==null)||(w==0))
		w = 450;
	if((h=="")||(h==null)||(h==0))
		h = 350;
	var scrL, srcT;
	srcL = Math.round((screen.width/2)-(w/2));
	srcT = Math.round((screen.height/2)-(h/2));
	return window.open(sitePath + "/popupwindows/ShoutBox.aspx", "SHOUTBOX", "left="+srcL+",top="+srcT+",width="+w+",height="+h+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0");
}	

var userListWin = null;
function openUserList(userID){
    if(userListWin != null){
        userListWin.close();
    }
    userListWin = OpenWin("popupWindows/UserInfo.aspx?id="+userID, "USERINFO", 550, 380);
    userListWin.focus();
}

var registerWin = null;
function openRegister(userID){
    if(registerWin != null){
        registerWin.close();
    }
    registerWin = OpenWin("pages/Register.aspx", "REGISTER", 550, 380);
    registerWin.focus();
}

var userInfoWin = null;
function openUserInfo(){
    if(webSiteUserID != null){
        if(userInfoWin != null){
            userInfoWin.close();
        }
        userInfoWin = OpenWin("pages/user/Default.aspx?id=" +webSiteUserID, "USERINFO", 550, 420);
        userInfoWin.focus();
    }
}

var printWindow = null;
function PrintNyhed(novostID){
    if(printWindow != null){
        printWindow.close();
    }
    printWindow = OpenWinResize("print/News.aspx?id=" + novostID, "PRINT", 550, 420);
    printWindow.focus();
}

function goToPage(url){
    document.location.href = url;
}



var imgTitle = "";
var imgSrc ="";
var newWindowPic;

function openWinPic(){ 
		return window.open( sitePath +"customimages/sadrzaj/open_picture.htm", "Prikaz", "width=250,height=150,left=0,top=0,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0" ) ; 
} 
function gObj(what){
	return document.getElementById(what);
}		

function repl(s){
var reg = new RegExp('tn_');
	return s.replace(reg,'');
}

function openImg(fID){
	var f_img = gObj(fID);
	var s;
	s = f_img.src;
	imgSrc = repl(s);
	imgTitle = "Kafici";
	newWindowPic = openWinPic();
	newWindowPic.focus();
}

