/* tiskanje dokumenta */
var t = 0
var Width;
var height;
var title;
var Slika = new Image();
function ShowFullImage(strUrl,width,height,title)
{
	Slika.src = strUrl;	
	var aLink = document.createElement('a');
	aLink.href = strUrl;
	aLink.rel='lightbox';
	//aLink.onClick = function(){}
	aLink.title = title;
	aLink.innerHTML = '<img src="'+strUrl+'">'

	myLightbox.start(aLink); 
	
	
}


var strQueryString;
strQueryString = '';
 
function printpreview()
{
	var scrnwdth = 0;
	var scrnhght = 0;
	var wdth = 640;
	var hght = 450;
	var lft;
	var tp;
	if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
	if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
	if(scrnhght != 0) tp = (scrnhght - hght)/2;
	var prn = null;
	prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + strQueryString, 'prnwnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes');
	if (prn.blur) prn.focus();
}

function printpreviewen()
{
	var scrnwdth = 0;
	var scrnhght = 0;
	var wdth = 640;
	var hght = 450;
	var lft;
	var tp;
	if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
	if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
	if(scrnhght != 0) tp = (scrnhght - hght)/2;
	var prn = null;
	prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + strQueryString, 'prnwnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes');
	if (prn.blur) prn.focus();
}

function printframe()
{
	parent.frame_print_bottom.focus();
	parent.frame_print_bottom.print();
}

/* tiskanje dokumenta */

/* preverjanje vnosnih polj */

function isEmpty(besedilo, msg)
{
	if (besedilo.value.length == 0)
	{
		alert(msg)
		//besedilo.focus()
		return false
	} 
	return true
}

function isEmail(besedilo, msg)
{
	if (besedilo.value.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
	{
		alert(msg);
		besedilo.focus();
		return false;
	}
}

function isSelected(radio, msg)
{
  blnOK = false
  for (var intIndex = 0; intIndex < radio.length; intIndex++)
  {
    if (radio[intIndex].checked)
    {
      blnOK = true
    }
  }
  if (blnOK)
  {
    return true
  }
  else
  {
    alert(msg)
    return false
  }
}

function isEqual(prvobesedilo, drugobesedilo, msg)
{
	if (prvobesedilo.value == drugobesedilo.value)
	{
		alert(msg)
		prvobesedilo.focus()
		return false
	} 
	return true
}

function isTwoInputsEmpty(prvobesedilo, drugobesedilo, msg)
{
	if (prvobesedilo.value.length == 0 && drugobesedilo.value.length == 0)
	{
		alert(msg)
		prvobesedilo.focus()
		return false
	} 
	return true
}

function isTwoInputsFull(prvobesedilo, drugobesedilo, msg)
{
	if (prvobesedilo.value.length != 0 && drugobesedilo.value.length != 0)
	{
		alert(msg)
		prvobesedilo.focus()
		return false
	} 
	return true
}

/* preverjanje vnosnih polj */

/* formatiranje številk v znesek */

function FormatMoney(input, decimal)
{
  var strMoney, strMoneyPare, strFormattedMoney, strMoneyDiv, strMoneyMod, strSto,intMoneyLength,strInteger;
	var Money,i,j,k;
	//alert(input.value)
	if(input.value == undefined) Money = input;
	else Money = input.value;


	if(input.value == 0) return false;
	

	intMoneyLength = Money.length;
  	strInteger = new String("");
  for (intIndex=0; intIndex<intMoneyLength; intIndex++)
  {
   
   if (Money.substring(intIndex,intIndex+1) == ",") Money = Money.replace(/,/,".");

  }
	
	Money = parseFloat(Money);
//alert(Money);
	
//alert(Money)	;
	Mio=Money/1000000;
	Mio = parseInt(Mio);
	Money = Money -Mio*1000000;
	Tisoc = parseInt(Money /1000);
	Money = Money -Tisoc*1000;
	Sto = parseInt(Money);
	Money-=Sto;
	Money*=100;
	Money=Math.round(Money);
	//Sto =Sto.slice(1,5)

strFormattedMoney = Mio+'+'+Tisoc+'+'+Sto;


if(Mio>0)
{
	
	if(Tisoc<100) 
	{
		strFormattedMoney = Mio+'.0'+Tisoc;
		if(Tisoc<10)
		{
			 strFormattedMoney = Mio+'.00'+Tisoc;
			 if(Tisoc == 0) strFormattedMoney = Mio+'.000';
		}
	}
	else strFormattedMoney = Mio+'.'+Tisoc;
	//alert(Sto);
	
	if (Sto < 100)
	{
		strSto = '.0'+Sto;
		if (Sto < 10) strSto = '.00'+Sto;
		{
			if(Sto < 1) strSto = '.000';
		}
	}
	else strSto = '.'+Sto
	strFormattedMoney += strSto;
}
if(Mio<1)
{
	if(Tisoc == 0) strFormattedMoney ='';
	else strFormattedMoney = Tisoc;

	if (Sto < 100 &&Tisoc >0)
	{
		strSto = '.0'+Sto;
		if (Sto < 10) strSto = '.00'+Sto;
		{
			if(Sto < 1) strSto = '.000';
		}
	}
	else
	{ 
	if (Tisoc == 0) strSto = Sto;
	else strSto = '.'+Sto;
	
	}
	strFormattedMoney += strSto;

}

if (decimal!=false){
if (Money ==0) strFormattedMoney = strFormattedMoney+',00';
else if (Money <10) strFormattedMoney = strFormattedMoney+',0'+Money;
else 
  strFormattedMoney = strFormattedMoney+','+Money;

}
  input.value = strFormattedMoney;
  return;
}

function MoneyToFloat(input)
{
  var strMoney, intMoneyLength, intIndex, strInteger;
	if(input==0) return input;

  strMoney = new String(input);
  
 // strMoney = strMoney.replace(/./,"a")
  
  //Money = parseFloat(Money);
//	alert(strMoney)
  
  
  
  intIndex = 0;
 // while (strMoney.substring(intIndex, intIndex+1) == '0') {intIndex++};

  intMoneyLength = strMoney.length;
  strMoney = strMoney.substring(intIndex, intMoneyLength);

  strInteger = new String("");
  for (intIndex=0; intIndex<intMoneyLength; intIndex++)
  {
    if (strMoney.substring(intIndex,intIndex+1) == ".") {continue};
//    if (strMoney.substring(intIndex,intIndex+1) == ",") {break};
    strInteger += strMoney.substring(intIndex,intIndex+1);
  }


//alert(strInteger);
	strMoney = strInteger.replace(/,/,".")




 /* if (strInteger.length == 0) {return 0};
  if (isNaN(strInteger))
  {
    return 0;
  }
  else
  {
    return parseInt(strInteger);
  }*/	

	return parseFloat(strMoney);
}

/* formatiranje številk v znesek */

/* iskanje v toolbaru */

function SearchSubmitSi()
{
	if (isEmpty(document.Query.strQuery, 'Vnesite poizvedbo!'))
	{
		document.Query.action = '/isci.asp';
		document.Query.submit();
	}
}

function SearchSubmitEn()
{
	if (isEmpty(document.Query.strQuery, 'Enter your search!'))
	{
		document.Query.action = '/en/search.asp';
		document.Query.submit();
	}
}

/* iskanje v toolbaru */

function ShowMap(id)
{
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = 400;
  var hght = 425;
  var lft;
  var tp;
  if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
  if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
  if(scrnhght != 0) tp = (scrnhght - hght)/2;
  var abanet = null;
  showmap = window.open('/frameset_print.asp?/orodja/poslovnamreza/map.asp?BranchId=' + id, 'playmap', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no');
  if (showmap.blur) showmap.focus();
}

function ShowPhoto(id)
{
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = 400;
  var hght = 320;
  var lft;
  var tp;
  if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
  if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
  if(scrnhght != 0) tp = (scrnhght - hght)/2;
  var abanet = null;
  showphoto = window.open('/frameset_print.asp?/orodja/poslovnamreza/photo.asp?BranchId=' + id, 'playphoto', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no');
  if (showphoto.blur) showphoto.focus();
}

function about(url)
{
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = 470;
  var hght = 390;
  var lft;
  var tp;
  if((window.screen) && (screen.width) && (screen.height)) {scrnwdth = screen.width; scrnhght = screen.height;}
  if(scrnwdth != 0) lft = (scrnwdth - wdth)/2;
  if(scrnhght != 0) tp = (scrnhght - hght)/2;
  var popupimage = null;
  popupimage = window.open(url, 'popupimagewnd', 'width=' + wdth + ',height=' + hght + ',left=' + lft + ',top=' + tp + ',screenX=' + lft + ',screenY=' + tp + ',menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes');  
  if (popupimage.blur) popupimage.focus();
}

function isNumber(besedilo, msg)
{
  if (isNaN(besedilo.value))
  {
	alert(msg)
	besedilo.select()
	return false
  } 
  return true
}

function isComboEmpty(besedilo, selected, msg)
{
	if (besedilo.selectedIndex == selected)
	{
		alert(msg)
		besedilo.focus()
		return false
	}
	else
	{
		return true
	}
}


// constants to define the title of the alert and button text.
var ALERT_TITLE = "Opozorilo";
var ALERT_BUTTON_TEXT = "Ok";

// over-ride the alert method only if this a newer browser.
// Older browser will see standard alerts
if(document.getElementById) {
	
	
	window.alert = function(txt) {

		createCustomAlert(txt);
	}
}

function createCustomAlert(txt) {
	
	
	
	// shortcut reference to the document object
	d = document;

	// if the modalContainer object already exists in the DOM, bail out.
	if(d.getElementById("modalContainer")) return;

	// create the modalContainer div as a child of the BODY element
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	mObj.style.height = document.documentElement.scrollHeight + "px";
	

	// create the DIV that will be the alert 
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	alertObj.style.top = bo()+by()/2-200;
	// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
	//if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	// center the alert box
	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";

	// create an H1 element as the title bar
	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(ALERT_TITLE));

	// create a paragraph element to contain the txt argument
	msg = alertObj.appendChild(d.createElement("p"));
	msg.innerHTML = ''+txt;

	msg1 = alertObj.appendChild(d.createElement("p"));
	msg1.id="btnCont";

	// create an anchor element to use as the confirmation button.
	btn = msg1.appendChild(d.createElement("button"));
	//btn.type = "button";
	//btn.value =ALERT_BUTTON_TEXT;
	//btn.id = "closeBtn";
	btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
	
	//btn.href = "#";
	// set up the onclick event to remove the alert when the anchor is clicked
	btn.onclick = function() { 
	removeCustomAlert();	
	//besedilo.focus();
	return false; }

bt();	
}

// removes the custom alert from the DOM
function removeCustomAlert() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
	clearTimeout(b);
}

//Custom confirm
var answer;

// constants to define the title of the alert and button text.
var CONFIRM_TITLE = "Opozorilo";
var CONFIRM_TITLE = "Ok";

// over-ride the alert method only if this a newer browser.
// Older browser will see standard alerts

/*if(document.getElementById) {
	window.confirm = function(txt) {
		createCustomConfirm(txt);
	}
}*/


function createCustomConfirm(txt, Opcije,Opcije_disable, IzbranaOprema, operacija ) { 
	// shortcut reference to the document object
	d = document;
	answer=false;
	// if the modalContainer object already exists in the DOM, bail out.
	if(d.getElementById("modalContainer")) return;

	// create the modalContainer div as a child of the BODY element
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	 // make sure its as tall as it needs to be to overlay all the content on the page
	mObj.style.height = document.documentElement.scrollHeight + "px";
	
	// create the DIV that will be the alert 
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	alertObj.style.top = bo()+by()/2-200;
	// MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
//	if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	// center the alert box
	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";

	// create an H1 element as the title bar
	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(ALERT_TITLE));

	// create a paragraph element to contain the txt argument
	msg = alertObj.appendChild(d.createElement("p"));
	msg.innerHTML = '<br>'+txt;

	msg1 = alertObj.appendChild(d.createElement("p"));
	msg1.id="btnCont";
	// create an anchor element to use as the confirmation button.
	
	btn = msg1.appendChild(d.createElement("button"));
	btn.appendChild(d.createTextNode("Da"));
	btn.name='btn'
	btn.onclick = function() 
	{ 
					
						if (operacija =='odstej') OdstejConfirmed(true, Opcije, IzbranaOprema );
						
						else if(operacija =='sestej')
						{
							if(Opcije.length == 1)
							{
						 	SestejConfirmed(true, Opcije[0],Opcije_disable, IzbranaOprema );
							}
							else
							{
						 	SestejConfirmed(true, Opcije[indexVrstica],Opcije_disable, IzbranaOprema );
							}

									
						}
						
						removeCustomConfirm();

	}		
				

	btn1 = msg1.appendChild(d.createElement("button"));
	btn1.appendChild(d.createTextNode("Ne"));
	btn1.onclick = function() { 
	
					if (operacija =='odstej') OdstejConfirmed(false, Opcije, IzbranaOprema );
					else if (operacija =='sestej') SestejConfirmed(false, Opcije,Opcije_disable, IzbranaOprema );
								
					removeCustomConfirm();
				}

	//btn.type = "button";
	//btn.value =ALERT_BUTTON_TEXT;
	//btn.id = "closeBtn";
	
	
	//btn.href = "#";
	// set up the onclick event to remove the alert when the anchor is clicked
	
	

bt();	
}

// removes the custom alert from the DOM
function Answer(response)
{
	
	
	removeCustomConfirm();


}

var b;

function removeCustomConfirm() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));	
	clearTimeout(b);
	return true;	
}

//premikanje opozorila




function by()
{

return screen.height;	
	
}

function bo()
{
	return (moz) ? window.pageYOffset : document.body.scrollTop;
}

function bt()
{
	with(document.getElementById('alertBox').style)
	{
		
		top = bo()+by()/2-200;
	}
		b = setTimeout('bt()',10);
}

var moz=(document.getElementById&&!document.all)?1:0;

//document.write('<div id="toppage" style="position:absolute"><a class="footer" style="cursor:'+((moz)?'pointer':'hand')+'" onclick="JavaScript:scrollTo(0,0)">'+b2th+'</a></div>');



