function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/**
 * opens a popup window in the center of the screen
 * @param (string)url 		- url to open in popup
 * @param (string)title		- title of the window
 * @param (int)width		- width of the window
 * @param (int)height		- height of the window
 * @param (boolean)scrollbas	- show scroolbars  (0|1)
 * @param (boolean)status	- show status (0|1)
 **/

function openPopup(url,naslov,width,height,scrollbar,status) {
	var m, h;
	var LeftPosition=(screen.width)?(screen.width-width)/2:100;
	var TopPosition=(screen.height)?(screen.height-height)/2:100;
	m =  window.open(url,"popupWin","toolbar=no,width=" + width + ",height=" + height + ",top=" + TopPosition + ",left=" + LeftPosition + ",location=no,directories=no,status="+ status +",menubar=no,resizable=no,scrollbars="+status+",target=_blank");
 	m.focus();
}

function odpri_okno(url,naslov,sirina,visina,drsnik,status) {
	var m, h;
	LeftPosition=(screen.width)?(screen.width-sirina)/2:100;
	TopPosition=(screen.height)?(screen.height-visina)/2:100;
	m =  window.open("","_blank","toolbar=no,height=" + visina + ",width=" + sirina + ",top=" + TopPosition + ",left=" + LeftPosition + ",location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,target=_blank");
	m.document.open();
 	h = m.document;
 	h.writeln("<html><head><title>" + naslov + "</title></head><body bgcolor=white leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>");
 	h.writeln("<a href='index.html' OnClick='javascript:window.close();'><img src=" + url + " border=0>");
 	h.writeln("</body></html>")
 	h.close()
 	m.focus()
}

function checkForm(formId){
	
	var form	= document.getElementById(formId);
	if(form == null) {
		alert("Can't submit form !!!");
		return;
	}
	
	var elements	= form.elements;
	var onError		= false;
	for(var i = 0; i < elements.length; i++){
		var el		= elements[i];
		if(el.id != "")
			if(el.value == ""){
				el.style.border='1px solid #800000';
				onError = true;
			} else el.style.border='1px solid black';
	}


	if(onError)	{
		return;
	}

	
	form.submit();
	
}

function checkOfferForm(formId){
	var form 		= document.getElementById(formId);
	if(form == null) {
		alert("Can't submit form !!!");
		return;
	}
	var onError		= false;
	var els			= form.elements;
	for(var i = 0; i < els.length;i++){
		var el 	= els[i];
		if((el.type =='checkbox')){
			if(el.checked == true){
				var name= el.name;
				var justName	= name.substring(name.indexOf('[')+1,name.indexOf(']'));
				//alert(justName);
				var subField	= document.getElementById(justName+'_opis');
				if(subField == null){
					alert("subField ["+justName+'_opis'+"] not found !" );
					return;
				}
				if(subField.value == ""){
					onError = true;
					subField.style.border = '1px solid #800000';
				}  else el.style.border='1px solid black';
			} else {
				clearSub(el);
			}
		}
		
		if(el.id != ""){
			if(el.id.indexOf('_opis')==-1){
				if(el.value == ""){
					el.style.border='1px solid #800000';
					onError = true;
				} else el.style.border='1px solid black';
			}
		}
	}
	if(onError) return;
	form.submit();
}

function clearSub(checkField){

	if(checkField == null) return;

	var name	= checkField.name;
	var justName	= name.substring(name.indexOf('[')+1,name.indexOf(']'));
	//alert(justName);
	var subField	= document.getElementById(justName+'_opis');
	if(subField == null){
		alert("subField ["+justName+'_opis'+"] not found !" );
		return;
	} 
	if(!checkField.checked) subField.value='';
}

function addToFavorites(urlAddress,pageName) { 
	if (window.external) { 
		window.external.AddFavorite(urlAddress,pageName) 
	} else 
	if (window.sidebar){
		window.sidebar.addPanel(pageName,urlAddress,  "");
	} else { 
		alert("Sorry! Your browser doesn't support this function."); 
	} 
} 


function submitMailForm(){
	var form	= document.getElementById('mailForm');
	if(form == null) return;
	if(emptyTextFields(form)) return;
	
	form.submit();
	
}

function submitRegisterForm(){
	var form	= document.getElementById('registerForm');
	if(form == null) return;
	if(emptyTextFields(form)) return;
	
	form.submit();
}

function emptyTextFields(form){
	var emptyFields	= false;
	if(form == null) return;
	for(var i = 0; i < form.elements.length; i++){
		var field	= form.elements[i];
		if(field.type == 'text'){
			if(field.value==''){
				field.style.border ='1px solid red';
				emptyFields = true;
			} else {
				field.style.border ='';
			}
		}
	}
	return emptyFields;
}


function submitForm(formId){    
	var form = document.getElementById(formId);    
	var field  = document.getElementById('fieldNaziv');    
	if(field==null) return;    
	if(field.value=="") {        
		alert('Vpišite ime podjetja oz. polno ime fizične osebe');        
		return;    
	}
	var field  = document.getElementById('fieldNaslov');    
	if(field==null) return;    
	if(field.value=="") {        
		alert('Vpišite polni naslov');        
		return;    
	}
	
	var field1  = document.getElementById('fieldZavezanec');    
	var field2  = document.getElementById('fieldNiZavezanec');
	var field3  = document.getElementById('fieldDavcna');
	if (field1.checked == true || field2.checked == true){
		if (field1.checked && field3.value==''){
			alert("Vpišite ID za DDV")
			return;
		}
	}
	else{
		alert("Označite ali ste zavezanec za DDV")
		return;
	}
	
	var field1  = document.getElementById('fieldNarocnik');    
	var field2  = document.getElementById('fieldNiNarocnik');
	/*if (!(field1.checked == true || field2.checked == true)){
			alert("Označite ali ste naročnik Revije DENAR")
			return;
	}*/
	
	var student_upokojenec = document.getElementById('student_upokojenec');
	var fizicna = document.getElementById('fizicna');
	var zaposlen_1 = document.getElementById('zaposlen_1');
	var zaposlen_2_10 = document.getElementById('zaposlen_2_10');
	var zaposlen_11_100 = document.getElementById('zaposlen_11_100');
	var zaposlen_vec_100 = document.getElementById('zaposlen_vec_100');
	if (!(	student_upokojenec.checked == true || 
			fizicna.checked == true ||
			zaposlen_1.checked == true ||
			zaposlen_2_10.checked == true ||
			zaposlen_11_100.checked == true ||
			zaposlen_vec_100.checked == true
			)){
		alert("Označite število zaposlenih")
		return;
	}
	
	
	var field  = document.getElementById('fieldIme');    
	if(field==null) return;    
	if(field.value=="") {        
		alert('Vpišite ime in priimek');        
		return;    
	}    
	var field  = document.getElementById('fieldTelefon');    
	if(field==null) return;    
	if(field.value=="") {        
		alert('Vpišite telefon');        
		return;    
	}    
	/*var field  = document.getElementById('fieldFax');    
	if(field==null) return;    
	if(field.value=="") {        
		alert('Vpišite fax');        
		return;    
	}*/   
	var field  = document.getElementById('fieldEmail');    
	if(field==null) return;    
	if(field.value=="") {        
		alert('Vpišite email');        
		return;    
	}    
	
	form.submit();
}

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 900;
defaultHeight = 800;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<a href="javascript:window.close();"><img border="0" name="George" src='+imageURL+' style="display:block"></a></body></html>');
close();		
}}



var RecaptchaOptions = {
	custom_translations : { 
		visual_challenge : "Dobi tekstovni iziv",
		audio_challenge : "Dobi zvočni iziv",
		refresh_btn : "Dobi nov iziv",
		instructions_visual : "Vnesi obe besedi:",
		audio_challenge : "Dobi zvočni iziv",
		instructions_audio : "Napiši kar slišiš:",
		help_btn : "Pomoč",
		play_again : "Ponovno predvajaj zvok",
		cant_hear_this : "Prenesi zvok kot MP3",
		incorrect_try_again : "Narobe. Poskusi ponovno."
	}
};


