var ie4 = document.all&&navigator.userAgent.indexOf("Opera")==-1;
var ns6 = document.getElementById&&!document.all;
var ns4 = document.layers;
 
function show_hide(element_name, operation) {
	if(operation=="show"){
	document.getElementById(element_name).style.display = '';
	}
	else if(operation="hide"){
	document.getElementById(element_name).style.display = 'none';
	}
}
function findPosX(obj) {
            var curleft = 0;
            if (obj.offsetParent) {
                        while (obj.offsetParent) {
                                    curleft += obj.offsetLeft
                                    obj = obj.offsetParent;
                        }
            } else if(obj.x) {
                        curleft += obj.x;
            }
            
            return curleft;
}
 
function findPosY(obj) {
            var curtop = 0;
            if (obj.offsetParent) {
                        while (obj.offsetParent) {
                                    curtop += obj.offsetTop
                                    obj = obj.offsetParent;
                        }
            } else if(obj.y) {
                        curtop += obj.y;
            }
            
            return curtop;
}

var id_input1; 

function show_mapDiv(e,id_input) {         
            
			id_input1 = id_input;
		
			var offset_right = 33;
			var offset_top = -230;
			
			var theRoot = document.getElementById(id_input);
            var rootX = findPosX(theRoot);			// pozitia X a div-ului
            var rootY = findPosY(theRoot);			// pozitia Y a div-ului
            var rootWidth = theRoot.offsetWidth;	// latimea div-ului
            var rootHeight = theRoot.offsetHeight;	// inaltimea div-ului
            theRoot.style.top = rootY + rootHeight;
 			
			obj = document.getElementById('mapDiv');
			
			obj.style.top  = (rootY + rootHeight + offset_top) + 'px';
			obj.style.left = (rootX + rootWidth + offset_right) + 'px';
			
            show_hide('mapDiv', 'show');
}
function show_mapDiv1(e,id_input) {         
            
			id_input1 = id_input;
		
			var offset_right = 35;
			var offset_top = -12;
			
			var theRoot = document.getElementById(id_input);
            var rootX = findPosX(theRoot);			// pozitia X a div-ului
            var rootY = findPosY(theRoot);			// pozitia Y a div-ului
            var rootWidth = theRoot.offsetWidth;	// latimea div-ului
            var rootHeight = theRoot.offsetHeight;	// inaltimea div-ului
            theRoot.style.top = rootY + rootHeight;
 			
			obj = document.getElementById('mapDiv');
			
			obj.style.top  = (rootY + rootHeight + offset_top) + 'px';
			obj.style.left = (rootX + rootWidth + offset_right) + 'px';
			
            show_hide('mapDiv', 'show');
}
/*function set_link(val){
	for(var i=0;i<window.document.forms[0].<?=$_GET['field'];?>.length;i++){
		if(window.document.forms[0].<?=$_GET['field'];?>.options[i].value==val){
			window.document.forms[0].<?=$_GET['field'];?>.options[i].selected=true;
		}
	}
	//self.close();
}*/
function set_link(val){
	
	xx = document.getElementById(id_input1);
	for(var i=0;i<xx.length;i++){
		if(xx.options[i].value==val){
			xx.options[i].selected=true;
		}
	}
	//self.close();
	document.getElementById('mapDiv').style.display="none";
}