// JavaScript Document

// Form Validation JavaScript
function EW_onError(form_object, input_object, object_type, error_message) {
	alert(error_message);									
	if (object_type == "RADIO" || object_type == "CHECKBOX") {
		if (input_object[0])
			input_object[0].focus();
		else
			input_object.focus();
	}	else if (!(document.all && document.all["_"+input_object.name+"_editor"])) { 
		input_object.focus();  
	}  
	if (object_type == "TEXT" || object_type == "PASSWORD" || object_type == "TEXTAREA" || object_type == "FILE") {
		if (!(document.all && document.all["_"+input_object.name+"_editor"]))
			input_object.select();
	}
	return false;	
}

function EW_hasValue(obj, obj_type) {
	if (obj_type == "TEXT" || obj_type == "PASSWORD" || obj_type == "TEXTAREA" || obj_type == "FILE")	{
		if (obj.value.length == 0) 
			return false;
		else if (document.all && document.all["_"+obj.name+"_editor"] && (obj.value == '<P>&nbsp;</P>'))
			return false;  
		else 
			return true;
	}	else if (obj_type == "SELECT") {
		if (obj.type != "select-multiple" && obj.selectedIndex == 0)
			return false;
		else if (obj.type == "select-multiple" && obj.selectedIndex == -1)
			return false;
		else
			return true;
	}	else if (obj_type == "RADIO" || obj_type == "CHECKBOX")	{
		if (obj[0]) {
			for (i=0; i < obj.length; i++) {
				if (obj[i].checked)
					return true;
			}
		} else {
			return (obj.checked);
		}
		return false;	
	}
}

function EW_checkemail(object_value) {
	if (object_value.length == 0)
		return true;
	
	if (!(object_value.indexOf("@") > -1 && object_value.indexOf(".") > -1))
		return false;    
	
	return true;
}


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];}
}



/*-----popUpImage---odpre sliko v novem oknu; okno se zapre tako, da se klikne kar na sliko------------------------------*/
var popUpWin=0;
function popUpImage(slika, winName, left, top, width, height, bgcolor, robColor, closeButton, x_scroll)
	{
	if(popUpWin)
	{
	  if(!popUpWin.closed) popUpWin.close();
	}
	width=width+20;
	height=height+20;
	popUpWin = open('', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+x_scroll+',resizable=yes,copyhistory=no, width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  	popUpWin.document.write('<html><head><title>'+winName+'</title></head>');
	popUpWin.document.write('<body leftmargin="9" topmargin="9" bgcolor="'+bgcolor+'" onload="KillMe();self.focus()">');
	popUpWin.document.write('<table width="100%" height="100%" cellspacing="0" cellpadding="0"><tr><td align="center" valign="middle"><a href="javascript:close();" title="'+closeButton+'">');
	popUpWin.document.write('<img style="border:1px solid '+robColor+'; padding:1px;" src="'+slika+'" border="none"></a></td></tr></table>');
	popUpWin.document.write('</body></html>');
	popUpWin.document.close();
}
/*-----END-popUpImage----------------------------------------------------------------------------------------------------*/

