function isEmpty(input, message) {
	if (input.value.length == 0) {
		alert(message)
		input.focus()
		return false
	} 
	return true
}

function isNumber(besedilo, msg) {
    if (isNaN(besedilo.value)) {
        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 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 isChecked(checkbox, msg)
{
if ($(checkbox).is(':checked')) {
        return true
    } else {
        alert(msg)
    	return false
    }  

}
function verifyPassword(password, repeat, message) {
	if (password.value != repeat.value) {
		alert(message)
		repeat.select()
		return false
	} 
	return true
}

/* lightbox */
/*$(function() {
	$('.lightbox-image').lightBox({fixedNavigation:true});
});*/

/* drop-down menu */
var timeout    = 250;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open(id) {
	jsddm_canceltimer();
	jsddm_close();
	ddmenuitem = $('#menu').find('#' + id).css('display', 'block');
}

function jsddm_close() {
	if(ddmenuitem) ddmenuitem.css('display', 'none');
}

function jsddm_timer(id) {
	closetimer = window.setTimeout(jsddm_close, timeout);
}

function jsddm_canceltimer() {
	if(closetimer) {
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

/*$(document).ready(function() {
	$('#menu > ul > li').bind('mouseover', jsddm_open)
	$('#menu > ul > li').bind('mouseout',  jsddm_timer)
	$('.menu-flyout-absolute').bind('mouseover', jsddm_open)
   	$('.menu-flyout-absolute').bind('mouseout',  jsddm_timer)
});

document.onclick = jsddm_close;*/
/* popup za predogled tiskanja */
function printframe() {
  parent.frame_print_bottom.focus();
  parent.frame_print_bottom.print();
}

function printpreview(structureId, contentId, eventId, template) {
	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)
	
		prn = window.open('/frameset_print.asp?' + location.protocol + '//' + location.host + template +'?blnPrint=true' + '&StructureId='+structureId + '&ContentId='+contentId + '&EventId='+eventId, '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 printpreviewen(structureId, contentId, eventId, template) {
	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)
	
		prn = window.open('/en/frameset_print.asp?' + location.protocol + '//' + location.host + template +'?blnPrint=true' + '&StructureId='+structureId + '&ContentId='+contentId + '&EventId='+eventId, '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();
}
