/* popup za predogled tiskanja */
function printframe() {
  parent.frame_print_bottom.focus();
  parent.frame_print_bottom.print();
}

function printpreview(folderId, ContentId) {
	var strQueryString;
	strQueryString = '';
	var scrnwdth = 0;
	var scrnhght = 0;
	var wdth = 640;
	var hght = 480;
	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;
	var languagepath = location.pathname.substr(0,4)
	if(languagepath == '/en/') {
		prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + '&FolderId='+folderId + '&ContentId='+ContentId, '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,resizable=no');
	}
	else {
		prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + '&FolderId='+folderId + '&ContentId='+ContentId, '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,resizable=no');
	}
	if (prn.blur) prn.focus();
}
/* popup za predogled tiskanja */
function printpreviewsajt(folderId, ContentId) {
	if(ContentId == '')
	{
	ContentId = 0
	}
	var strQueryString;
	strQueryString = '';
	var scrnwdth = 0;
	var scrnhght = 0;
	var wdth = 660;
	var hght = 480;
	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;
	var languagepath = location.pathname.substr(0,4)
	
	if(languagepath == '/en/') {
		var  template = location.pathname.substr(4,3)
		if(template == '')
			{
			prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + languagepath + 'default.asp?FolderId='+folderId+'&ContentId='+ContentId+'&blnPrint=true', '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,resizable=no');
		
			}
		else
		{
		prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + languagepath + 'zzs.asp?FolderId='+folderId+'&ContentId='+ContentId+'&blnPrint=true', '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,resizable=no');
		}
	}

	else {
		var  template = location.pathname.substr(0,4)
		if(template == '/nw/')
		{
			prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + '/news.asp?FolderId='+folderId+'&ContentId='+ContentId+'&blnPrint=true', '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,resizable=no');
		}
		else
		{
			prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + '/zzs.asp?FolderId='+folderId+'&ContentId='+ContentId+'&blnPrint=true', '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,resizable=no');
		}
	}
	if (prn.blur) prn.focus();
}

function printpreviewkoledar(folderId, stevilo, opendiv) {
	var strQueryString;
	strQueryString = '';
	var scrnwdth = 0;
	var scrnhght = 0;
	var wdth = 640;
	var hght = 480;
	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;
	var languagepath = location.pathname.substr(0,4)
	if(languagepath == '/en/') {
		prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + '&FolderId='+folderId + '&ContentId='+ContentId, '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,resizable=no');
	}
	else {
		var link = ''
		for (i=0;i<stevilo;i++) {
			link = link + '&DivId'+i+'='+opendiv[i];
		}
		prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + location.pathname + '?blnPrint=true' + '&FolderId='+folderId  + link +'&stevilo='+stevilo, '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,resizable=no');
	}
	if (prn.blur) prn.focus();
}

function printcalendar(folderId, ContentId)
{
    div="#koledar"
    var childs = $(div).children();
    var opendiv = new Array();
    for (i=0;i < childs.length;i++)
    {
    
        id="#"+i;
        
        if ($(id).css('display') == "block")
        {opendiv[i] = "block";}
        else
        {opendiv[i] = "none";}
    }   
        printpreviewkoledar(folderId, childs.length, opendiv); 
}

/* preverjanje vnosnih polj */

function isEmpty(besedilo, msg)
{
	if (besedilo.value.length == 0)
	{
		alert(msg)
		besedilo.focus()
		return false
	} 
	return true
}

function isNumber(input, msg)
{
	if (isNaN(input.value))
	{
		alert(msg)
		input.focus()
		return false
	} 
	return true
}

function isNumber1(besedilo, msg)
{
	str = besedilo.value
	str = str.replace(/,/, ".")
	
  if (isNaN(str))
  {
	alert(msg)
	besedilo.select()
	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 isEmails(besedilo, msg)
{
	if(besedilo.value.length != 0)
	{
		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;
		}
	}
	else
	{
		return true;
	}
}

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
  }
}

/* prikazovanje in skrivanje divov */

function ShowHide(divId)
{
	var id = document.getElementById(divId);
	if (id.style.display == "none")
	{
		eval("id.style.display = 'block';");
	}
	else
	{
		eval("id.style.display = 'none';");
	}
}
function ShowHideKoledar(divId, imgId)
{
    
	var id = document.getElementById(divId);
	var idImg = document.getElementById(imgId);
	
	if (id.style.display == "none")
	{
	    
		eval("id.style.display = 'block';");
		eval("idImg.src = '/intra/library/images/minus.gif'");
	}
	else
	{
		eval("id.style.display = 'none';");
		eval("idImg.src = '/intra/library/images/plus.gif'");
	}
}
/* funkcija za prikaz sheme in tabele */
function showDiv(div)
{
	var divDisplay = document.getElementById(div);
	if (document.frmForm.Company.checked == true)
	{
		divDisplay.style.display = 'block';
	}
	else
	{
		divDisplay.style.display = 'none';
	}
}

/* ---------------- sport ----------------- */

function popup(url)
{
  var scrnwdth = 0;
  var scrnhght = 0;
  var wdth = 488;
  var hght = 488;
  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 loginSwitch() {
	document.getElementById("login1").innerHTML = '<a href="#"><img src="library/images/gumb_prijava.gif" alt="Prijava" width="63" height="17" border="0"></a>';
	document.getElementById("login2").innerHTML = '<span class="link"><a href="#">Registracija</a></span>';
}

function validEmail(eml){
	return (eml.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}
function changeInputType(
  oldElm, // a reference to the input element
  iType, // value of the type property: 'text' or 'password'
  iValue, // the default value, set to 'password' in the demo
  blankValue, // true if the value should be empty, false otherwise
  noFocus) {  // set to true if the element should not be given focus
  if(!oldElm || !oldElm.parentNode || (iType.length<4) || 
    !document.getElementById || !document.createElement) return;
  var isMSIE=/*@cc_on!@*/false; //http://dean.edwards.name/weblog/2007/03/sniff/
  if(!isMSIE){
    var newElm=document.createElement('input');
    newElm.type=iType;
  } else {
    var newElm=document.createElement('span');
    newElm.innerHTML='<input type="'+iType+'" name="'+oldElm.name+'">';
    newElm=newElm.firstChild;
  }
  var props=['name','id','className','size','tabIndex','accessKey'];
  for(var i=0,l=props.length;i<l;i++){
    if(oldElm[props[i]]) newElm[props[i]]=oldElm[props[i]];
  }
  newElm.onfocus=function(){return function(){
    if(this.hasFocus) return;
    var newElm=changeInputType(this,'password',iValue,
      (this.value.toLowerCase()==iValue.toLowerCase())?true:false);
    if(newElm) newElm.hasFocus=true;
  }}();
  newElm.onblur=function(){return function(){
    if(this.hasFocus)
    if(this.value=='' || (this.value.toLowerCase()==iValue.toLowerCase())) {
      changeInputType(this,'text',iValue,false,true);
    }
  }}();
 // hasFocus is to prevent a loop where onfocus is triggered over and over again
  newElm.hasFocus=false;
  // some browsers need the value set before the element is added to the page
  // while others need it set after
  if(!blankValue) newElm.value=iValue;
  oldElm.parentNode.replaceChild(newElm,oldElm);
  if(!isMSIE && !blankValue) newElm.value=iValue;
  if(!noFocus || typeof(noFocus)=='undefined') {
    window.tempElm=newElm;
    setTimeout("tempElm.hasFocus=true;tempElm.focus();",1);
  }
  return newElm;
}