function init_menu(placeholder) {

	if (document.all && document.getElementsByTagName) {	//if IE
		navRoot = document.getElementById(placeholder);
		list_items = navRoot.getElementsByTagName("LI");
		str = "";
		for (i=0; i<list_items.length; i++ ) {
			node = list_items[i];
			if (node.className != "li_second") {
				//node.onmouseover = function() { if (!event.toElement || event.toElement.className != "a_second") { this.className+=" over"; if (obj = document.getElementById("hide_input")) obj.style.visibility="hidden"; } } 
				//node.onmouseout = function() { if (!event.toElement || event.toElement.className != "a_second") { this.className=this.className.replace(" over", ""); if (obj = document.getElementById("hide_input")) obj.style.visibility="visible"; } } 
				node.onmouseover=function() { if (!event.toElement || event.toElement.className != "a_second") this.className+=" over"; } 
				node.onmouseout=function() { if (!event.toElement || event.toElement.className != "a_second") this.className=this.className.replace(" over", ""); } 
			}
		}
	}
	
}


function toggle_mouseover(obj, file_ext) {
	var source = obj.src
	if (source.indexOf('_over.'+file_ext) > -1) {
		obj.src = source.replace('_over.'+file_ext, '.'+file_ext);
	} else {
		obj.src = source.replace('.'+file_ext, '_over.'+file_ext);
	}
}

// get screen center
function get_top_left(width, height){
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
	  		winW = window.innerWidth;
	  		winH = window.innerHeight;
	 		winL = window.screenX;
	 		winT = window.screenY;
	 	}else{
	 	//if (navigator.appName.indexOf("Microsoft")!=-1) {
	  		winW = document.body.offsetWidth;
	  		winH = document.body.offsetHeight;
	  		winL = window.screenLeft;
	  		winT = window.screenTop;
	 	}
	}
	
	var scroll = 0;
	var l = winL + winW/2 - width/2;
	var t = winT + winH/2 - height/2;
	
	
  	if(screen.width <= width){
  		width=screen.width;
  	}
  	if(screen.height <= height){
  		height=screen.height;
 	 	var t = 0;
  		var scroll = 1;
  	}
	return Array(t,l);
}



function show_popup(url, width, height) {
	pos = get_top_left(width,height);
	conf = 'toolbar=0,location=0,top='+pos[0]+',left='+pos[1]+',directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+width+',height='+height;
	hwnd = window.open(url, 'win', conf);
	return false;
}


function parse_search(strValue){
	items = strValue.replace(/ /g,'+and+');
	return items;
}

function process_form(frm){

	var checked_index = false;
	srchStr = frm.KEYWORDS.value;
	
	srchStr = srchStr.replace(/^\s*|\s*$/g,"");
	
	frmUrl = false;
		
//	for(i=0;i<frm.tip.length;i++){
//		if(frm.tip[i].checked){
//			checked_index = i+1;
//		}
//	}
//	
//	if(checked_index != false){
//		switch(checked_index){
//			case 1:
//					frmUrl = "index.php?sv_path=9,231&u=All&Submit=iskanje&leto=All&Submit=iskanje&KEYWORDS=" + srchStr;
//					break;
//			;
//			case 2:
					//frmUrl = "http://odlocitve.us-rs.si/usrs/us-odl.nsf/Search?SearchView&Query=" + parse_search(srchStr) + "+AND+([VODL]=1)+AND+([JEZIK]=1)+AND+([REPUB]=5)&iskanje=" + srchStr + "&SearchOrder=1&SearchFuzzy=0&start=1&count=25"; // isce samo po odlocitvah
					frmUrl = "http://odlocitve.us-rs.si/usrs/us-odl.nsf/Search?SearchView&Query=" + parse_search(srchStr) + "+AND+([JEZIK]=1)+AND+([REPUB]=5)&iskanje=" + srchStr + "&SearchOrder=1&SearchFuzzy=0&start=1&count=25";
					//frmUrl = "http://odlocitve.us-rs.si/usrs/us-odl.nsf/Search?SearchView&Query=" + parse_search(srchStr) + "+AND+([JEZIK]=1)+AND+([REPUB]=5)&iskanje=" + srchStr + "&SearchOrder=1&SearchFuzzy=0&start=1&count=25";
//					break;
//			;
//		}
//	}
	if(frmUrl != false && srchStr != '') location.href=frmUrl;
	
	return false;
}
function process_form_english(frm){

	var checked_index = false;
	srchStr = frm.KEYWORDS.value;
	
	srchStr = srchStr.replace(/^\s*|\s*$/g,"");
	
	frmUrl = false;
	//frmUrl = "http://odlocitve.us-rs.si/usrs/us-odl.nsf/SearchEng?SearchView&Query=" + parse_search(srchStr) + "+AND+([VODL]=1)+AND+([JEZIK]=2)+AND+([REPUB]=5)&iskanje=" + srchStr + "&SearchOrder=1&SearchFuzzy=0&start=1&count=25"; // isce samo po odlocitvah
	frmUrl = "http://odlocitve.us-rs.si/usrs/us-odl.nsf/SearchEng?SearchView&Query=" + parse_search(srchStr) + "+AND+([JEZIK]=2)+AND+([REPUB]=5)&iskanje=" + srchStr + "&SearchOrder=1&SearchFuzzy=0&start=1&count=25";
	if(frmUrl != false && srchStr != '') location.href=frmUrl;
	return false;
}		

// mini search

		function mini_search(){
			obj = document.getElementById('minisearchbox');
			uri = 'index.php?sv_path=9,231&KEYWORDS=' + obj.value + '&u=All&leto=All&Submit=iskanje';
			document.location.href= uri;
		}
	
		function clear_me(obj){
			if(obj.value == 'Search case law' || obj.value=='Vpi&#378;ite iskane besede'){
				obj.value='';
			}
		}

/* Open 3D view popup window */
		
function open_3Dview_window(myuri,flash_file) {
	var window_width = 581;
	var window_height = 292;
	var extra_param = '?flash_content='+flash_file;
	position = get_top_left(window_width, window_height);
	opts = 'toolbar=0,location=0,top='+position[0]+',left='+position[1]+',directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+window_width+',height='+window_height;
	var wnd = window.open((myuri+extra_param), 'gw', opts);
	return false;
}		
	
	

/* Open gallery popup window */
function open_gallery_window(myuri, window_width, window_height) {
	position = get_top_left(window_width, window_height);
	opts = 'toolbar=0,location=0,top='+position[0]+',left='+position[1]+',directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+window_width+',height='+window_height;
	var wnd = window.open(myuri, 'gw', opts);
	return false;
}


function open_nav_window_with_head(myuri, window_width, window_height) {
	position = get_top_left(window_width, window_height);
	opts = 'toolbar=0,location=0,top='+position[0]+',left='+position[1]+',directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width='+window_width+',height='+window_height;
	var wnd = window.open('popup.with_head.php?uri='+myuri, 'gw', opts);
	return false;
}

function set_popup(parent_element) {
	var elements = getElementsByClassName(document.getElementById(parent_element), "a", "popup");
	for (i=0; i<elements.length; i++) {
		elements[i].onclick = function() {
			return open_nav_window_with_head(this.href, 660, 500);
		}
	}
}

var myWindow;


function OpenIt(filename){
	Wwidth = 580;
	Wheight = 400;
	leftX = (screen.width/2) - (Wwidth/2);
	topY = (screen.height/2) - (Wheight/2);
	mywin = window.open(filename,"Search","width="+Wwidth+", height="+Wheight+", left="+leftX+", top="+topY);
	mywin.focus();
}

function mail(base,id,lang) {
	var start_uri = "";
	
	meWidth = 300;
	meHeight = 260;
	meLeft = (screen.width/2)-(meWidth/2);
	meTop = (screen.height/2)-(meHeight/2)-20;
	
	if ($.browser.msie) {
		start_uri = base;
	}
	mywindow = window.open(start_uri + "mailform.php?eid=" + id + "&lang=" + lang,"la","width="+meWidth+",height="+meHeight+",left="+meLeft+",top="+meTop+",resizable=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,titlebar=0");
	
	mywindow.focus();
	return void(0);
}