<!--
//popup brez scrollbarjev
var okno = null;
function popup(doc, w, h)
{
  	if (w == null) w = 500;
  	if (h == null) h = 400;
	if (okno==null || okno.closed) {
		okno=window.open(doc,"popup",'toolbar=no,width='+ w +',height='+ h +',resizable=no,scrollbars=no,directories=no,status=no,menubar=no,location=no');
		okno.creator = self;      
	}
	else {
		okno.location = doc;
		okno.focus();
	}
}

//popup s scrollbarji
var okno2 = null;
function popup2(doc, w, h)
{
  	if (w == null) w = 510;
  	if (h == null) h = 370;
	if (okno2==null || okno2.closed) {
		okno2=window.open(doc,"popup2",'toolbar=no,width='+ w +',height='+ h +',resizable=yes,scrollbars=yes,directories=no,status=no,menubar=no,location=no');
		okno2.creator = self;      
	}
	else {
		okno2.location = doc;
		okno2.focus();
	}
}

//popup za print
var oknoPrint = null;
function print_page(doc, w, h)
{
  	if (w == null) w = 670;
  	if (h == null) h = 590;
	if (oknoPrint==null || oknoPrint.closed) {
		oknoPrint = window.open(doc,"print",'toolbar=no,width='+ w +',height='+ h +',resizable=yes,scrollbars=yes,directories=no,status=no,menubar=yes,location=no');
		oknoPrint.creator = self;      
	}
	else {
		oknoPrint.location = doc;
		oknoPrint.focus();
	}
}

//********Funkcija, ki odpre v novem oknu slikco, tist okn se pa pol zna resajzat na velikost slike**********//
var oknoImage = null;
function slika(url,title) {
	url = "/popup-image.php?pic="+url+"&title="+title;
	oknoImage=window.open(url,'povecava','toolbar=no,width=600,height=600,directories=no,status=no,scrollbars=no,resize=no,menubar=no,location=no,copyhistory=no');
}

// popup za primere
var oknoCase = null;
function povecaj(url,title) {
	url = "/popup-case.php?pic="+url+"&title="+title;
	oknoCase = window.open(url,'case','toolbar=no,width=785,height=425,directories=no,status=no,scrollbars=no,resize=no,menubar=no,location=no,copyhistory=no');
}


//********Funkcija, ki skrije ikonco za print če ni podpore za javascript**********//
document.write ("<style>");
document.write ("#print {display:block;}");
document.write ("</style>");

//******** Funkcije za resajz teksta **********//
function textUp() {
	if (textSize < 1) { // 1 je najvisja stopnja
		textSize = textSize + 1;
		replaceCSS(textSize);
	}
}

function textDown() {
	if (textSize > -1) { // -1 je najnizja stopnja
		textSize = textSize - 1;
		replaceCSS(textSize);
	}
}

function replaceCSS(textSize) {
	var i, a;
	for (i = 0; (a = document.getElementsByTagName("link")[i]); i++) {
		if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") != -1 && a.getAttribute("title")) {
			a.disabled = true;
			if (textSize == -1 && a.getAttribute("title") == "small") a.disabled = false; // mali fonti
			else if (textSize == 1 && a.getAttribute("title") == "large") a.disabled = false; // veliki fonti
		}
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

// ko zapustimo stran, se zapiše v cookie izbrana velikost - ce je razlicna od default
window.onunload = function(e) {
	if (textSize != 0) createCookie("textSize", textSize, 365);
	else createCookie("textSize","",-1);
}

// preberemo cookie ko se stran louda in ce ni default velikost, zamenamo stylesheet
if (document.cookie.indexOf("textSize") != -1) { // preverimo, ce obstaja cookie
	textSize = parseInt(readCookie("textSize"));
	replaceCSS(textSize);
} else {
	var textSize = 0;
}


// funkcija za check vnosnih polj

function isEmail(a){
	var mail = /[a-zA-Z0-9\_\-\.]{1,}[@][a-zA-Z0-9\-\.]{1,}[.][a-zA-Z]{2,4}/;
	if ( !mail.test(a)) 
		return false;
	else
		return true;
}

// cekiranje form
function check(forma) {
	
	var err= false;
	
	for (i = 0 ; i<forma.length; i++) {
		
		
		// -- kontakt
		
		// ime
		if (forma[i].name == "name") {
			if (forma[i].value == "") {					alert("Vpišite vaše ime in priimek!"); err = true; }
		}
				
		// email
		else if (forma[i].name == "email") {
			if (forma[i].value == "") {					alert("Vpišite elektronski naslov!"); err = true; }
			else if (!isEmail(forma[i].value)) {		alert("Vpišite pravilen elektronski naslov!"); err=true; }
		}
				
		// sporočilo
		else if (forma[i].name == "msg") {
			if (forma[i].value == "") {					alert("Prosimo vas, da nam napišete vaše sporočilo!"); err = true; }
		}
				
		
		// -- search
		
		else if (forma[i].name == "key") {
			if (forma[i].value == "") {					alert("Vpišite besedo v iskalno polje!"); err = true; }
		}
		
		
		// ce je slo kej narobe :-)		
		if (err) {
			forma[i].focus();
			forma[i].select();
			break;
		}
	

	}
	return !err;
}

// konc check funkcije

// -->