		function open_window(url,ww,hh,tit)
		{
			var NEW_WIN = null;
			var cont = "<html><head><title>"+tit+
			"</title></head><body topmargin="+0+" leftmargin="+0+
			" rightmargin=\"+0+\" bottommargin="+0+"><img src="+url+
			" width="+ww+" height="+hh+"></body></html>";
			NEW_WIN = window.open ("","",
			"toolbar=no,width="+ww+",height="+hh+",directories=yes,status=yes,scrollbars=yes,resize=yes,menubar=yes");
			NEW_WIN.document.write(cont);
			NEW_WIN.document.close();
		}
		
		function open_window1(url,ww,hh)
		{
			var NEW_WIN = null;
			NEW_WIN = window.open (url,"",
			"toolbar=no,width="+ww+",height="+hh+",directories=yes,status=yes,scrollbars=yes,resize=yes,menubar=yes");
		}

		function add1()
		{
			document.form1.imottype.value = document.form1.vidimot.value;
			document.form1.obiavatype.value = document.form1.vidobiava.value;
		}	
		function addcat()
		{ 
			document.form1.imottype.value = document.form1.vidimot.value;
			document.form1.obiavatype.value = document.form1.vidobiava.value;
			document.form1.sub.value = document.form1.mestopolojenie.value;
			document.form1.submit();
  		}
		function save()
		{
			document.form1.action.value = "publishsave";
		}
		function tarsene()
		{
			document.form1.action.value = "searchsave";
		}
		function addsub()
		{
			document.form2.obiavatype.value = document.form2.vidobiava.value;
		}
		function addsub1()
		{ 
			document.form2.obiavatype.value = document.form2.vidobiava.value;
			document.form2.sub.value = document.form2.mestopolojenie.value;
			document.form2.submit();
  		}
		function fsearch()
		{
			document.form2.action.value = "search";
		}	
		function submitViaEnter(evt,elem) {
		evt = (evt) ? evt : event;
    	var target = (evt.target) ? evt.target : evt.srcElement;
    	var form = target.form;
    	var charCode = (evt.charCode) ? evt.charCode :
        ((evt.which) ? evt.which : evt.keyCode);
    	if (charCode  == 13 || charCode == 3) {
            if (isNotEmpty(elem))
			{
				form.submit();
			}	
        	return false;
    	}
    	return true;
		}
		function isNotEmpty(elem) {
    		var str = elem.value;
    		if(str == null || str.length == 0) {
			alert("Items in red are required unless stated otherwise.");
        	return false;
    	} else {
        	return true;
    	}
		}


function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("Items in red are required unless stated otherwise")
return false
}
else
return true
}
