﻿<!-- // JavaScript Document

function hprmse_in(pr,ro) {
	cell = document.getElementById('pe' + ro);
	cell.style.backgroundColor = '#003399';
	cell.style.color = '#FFFFFF';
	cell = document.getElementById('ro' + pr);
	cell.style.backgroundColor = '#003399';
	cell.style.color = '#FFFFFF';
	for (x=1; x<=brojsoba; x++) {
		cell = document.getElementById('pr' + x + ro);
		cell.style.backgroundColor = '#DDDDDD';
	}
	for (y=1; y<=brcijena; y++) {
		cell = document.getElementById('pr' + pr + y);
		cell.style.backgroundColor = '#DDDDDD';
	}
	cell = document.getElementById('pr' + pr + ro);
	cell.style.backgroundColor = '#003399';
	cell.style.color = '#FFFFFF';
}

function hprmse_out(pr,ro) {
	cell = document.getElementById('pe' + ro);
	cell.style.backgroundColor = '';
	cell.style.color = '';
	cell = document.getElementById('ro' + pr);
	cell.style.backgroundColor = '';
	cell.style.color = '';
	for (x=1; x<=brojsoba; x++) {
		xc = document.getElementById('pr' + x + ro);
		xc.style.backgroundColor = '';
	}
	for (y=1; y<=brcijena; y++) {
		xc = document.getElementById('pr' + pr + y);
		xc.style.backgroundColor = '';
	}
	cell = document.getElementById('pr' + pr + ro);
	cell.style.backgroundColor = '';
	cell.style.color = '';
}

function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop;
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function animateHeight(id, size)
{
el = document.getElementById(id);
var h_size1 = el.offsetHeight;
if (h_size1 < size)
{
el.style.height = h_size1 + 1 + "px";
setTimeout("animateHeight('" + id + "','" + size + "')", 1);
}
}

function animateWidth(id, size)
{
el = document.getElementById(id);
var w_size1 = el.offsetWidth;
if (w_size1 < size)
{
el.style.width = w_size1 + 1 + "px";
setTimeout("animateWidth('" + id + "','" + size + "')", 1);
}
}

function showlogin(el) {
	var loginbox = document.getElementById('loginbox');
	var prijava = document.getElementById('prijava');
	if (loginbox.style.visibility == 'visible') {
		loginbox.style.visibility = 'hidden'
	} else {
		loginbox.style.left = findPosX(prijava) - 150 + 'px';
		loginbox.style.top = findPosY(prijava) + 10 + 'px';
		loginbox.style.height = '10px';
		loginbox.style.visibility = 'visible'
		animateHeight('loginbox', 160);
	}	
}

function preloadImages() {
  if(document.images) {
    if(!document.imageArray) document.imageArray = new Array();
    var i,j = document.imageArray.length, args = preloadImages.arguments;
    for(i=0; i<args.length; i++) {
      if (args[i].indexOf("#")!=0) {
        document.imageArray[j] = new Image;
        document.imageArray[j++].src = args[i];
      }
    }
  }
}

function new_window(url) {
	var oWin = window.open(url, '_blank'); 
	if (oWin) { 
	if (oWin.focus) oWin.focus(); 
		return false; 
	} 
	oWin = null; 
	return true; 
}

function ajaxFunction(page, el) {
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();  
	} catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
				alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById(el).innerHTML=xmlHttp.responseText;
		}
	}
	xmlHttp.open("GET",page.replace("&amp;","&"),true);
	xmlHttp.send(null);
	return true;
}

function FN(n, totalDigits) { 
	n = n.toString(); 
	var pd = ''; 
	if (totalDigits > n.length) {
		for (i=0; i < (totalDigits-n.length); i++) {
			pd += '0';
		};
	};
	return pd + n.toString();
}

function getSelectValue(el) {
	var value = el.options[el.options.selectedIndex].value;
	return value;
}

function getSelectValueById(id) {
	var el = document.getElementById(id);
	var value = el.options[el.options.selectedIndex].value;
	return value;
}

-->