	function openFloat (url) {
		var style = "top=10, left=100, width=800, height=640, status=no, menubar=no, toolbar=no scrollbar=no";
		window.open(url,'window1',style);
	}
	
	
	function copyToClipboard (id) {
		var tempval=document.getElementById(id);
		tempval.focus();
		tempval.select();
		if (document.all) {
			therange=tempval.createTextRange();
			therange.execCommand("Copy");
		}
	}

	
	function showFormMap (idCheck, idMap) {
		var check = document.getElementById(idCheck);
		var map = document.getElementById(idMap);
		
		if (check.checked == true) {	
			map.style.opacity = 1.00;
			map.style.filter = 'alpha(opacity=' + 100 + ')';
		}
		else {
			map.style.opacity = 0.30;
			map.style.filter = 'alpha(opacity=' + 30 + ')';
		}
	}
	

	function checkform (form) {
		clear = confirm ("Si desidera veramente proseguire?");
		return clear;
	}				
			
				
	function showAndHide (id, list) {
		/* spengo tutti gli id indicati in list */
		var arrayToHide = list.split(',');
		for (var i=0; i<arrayToHide.length; i++) {
			var keyToHide = arrayToHide[i];
			var toHide = document.getElementById(keyToHide);
			if (toHide) toHide.style.display = 'none';
		}
		
		/* ora accendo l'id che volevo */
		var toActivate = document.getElementById(id);
		toActivate.style.display = '';
		myOpacity = new fx.Opacity(toActivate, {duration: 400});
		myOpacity.hide();
		myOpacity.toggle();
	}
	
	
	function javaReset (formName) {
	var form = document.forms[''+formName+''];										
	for (var i=0;i<form.elements.length;i++)										
	switch (form.elements[i].type){
			case 'submit': break;
			case 'hidden': break;
			case 'reset': break;
			case 'javaReset': break;
			case 'button': break;
			case 'checkbox':
			case 'radio': form.elements[i].checked = false;	break;						
			case 'select-one':
			case 'select-multiple':{ limit = form.elements[i].options.length;
									 for (j=0;j<limit;j++)
										form.elements[i].options[j].selected = false;
									 break;
									} 
			case 'textarea':
			default: form.elements[i].value = '';
		}					  										
	}
	
	
	function textareaRemainChars (objectId, limit) {
		var textarea = document.getElementById(objectId);
		if (textarea.value.length > limit) textarea.value = textarea.value.substring(0, limit);
		else {
			var remainChars = 'remainChars' + objectId;
			document.getElementById(remainChars).value = limit - textarea.value.length;
		}
	}
	
	
	function fixFlashZindex () {
		var flashObjects = document.getElementsByTagName('object');
		if (flashObjects != '') {
			for (var i = 0; i < flashObjects.length; i++) {
				var flashNode = flashObjects[i];
				var new_elem = document.createElement('PARAM');
				new_elem.setAttribute("value", "transparent");
				new_elem.setAttribute("name", "wmode");
				flashNode.appendChild(new_elem);
				flashNode.style.position = 'relative';
				flashNode.style.zIndex = '1';
			}
		}
		
		var flashEmbed = document.getElementsByTagName('embed');
		if (flashEmbed != '') {
			for (var i = 0; i < flashEmbed.length; i++) {
				flashEmbed[i].setAttribute("wmode", "transparent");
				flashEmbed[i].style.position = 'relative';
				flashEmbed[i].style.zIndex = '1';
			}
		}
	}
	
	
	function showImageOnShadow (imageUrl, title, details) {
		var path = './library/hiveon/image.php';	
		var opt = {
			method: 'post',
			postBody: 'url=' + encodeURIComponent(imageUrl),
			onSuccess: function(t) {
				var data = t.responseText.split('||');
				popupOpen(data[0], data[1]);
				popupAddContent(data[2]);
			}
		}
		new Ajax.Request (path, opt);
	}
	
	
	function hideImageOnShadow () {
		popupClose();
	}
	
	
	// open Float Popup On Shadow
	function popupOpen (width, height, halign) {
		var f = document.getElementById('hvnWindowFloatShadow');
		var w = document.getElementById('hvnWindowFloat');
		
		if (!f) {
			var f = document.createElement('div');
			f.setAttribute('id', 'hvnWindowFloatShadow');
			f.innerHTML = "&nbsp;";
			document.getElementsByTagName('body')[0].appendChild(f);
		}
		f.style.display = 'block';
		
		if (!w) {
			// close button
			var steps = document.location.pathname.split('/').length;
			
			var preurl = '';
			for (i=3;i<steps;i++) preurl += '../';
			var cb = '<div id="hvnWindowFloatCloseButton" onClick="popupClose()">&nbsp;</div>';
			var w = document.createElement('div');
			w.setAttribute('id', 'hvnWindowFloat');
			w.innerHTML = cb;
			document.getElementsByTagName('body')[0].appendChild(w);
			
			// content
			var windowContent = document.createElement('div');
			windowContent.setAttribute('id', 'hvnWindowFloatContent');
			windowContent.innerHTML = '<div class="center">In caricamento..</div>';
			document.getElementById('hvnWindowFloat').appendChild(windowContent);
		}
		else {
			var windowContent = document.getElementById('hvnWindowFloatContent');
			windowContent.innerHTML = '<div class="center">In caricamento..</div>';
		}
		
		w.style.top = '50%';
		w.style.marginLeft =  '-' + ((width/2)+10) + 'px';
		w.style.marginTop =  '-' + ((height/2)+20) + 'px';
		windowContent.style.width = width + 'px';
		windowContent.style.height = height + 'px';
		
		if (halign) windowContent.style.textAlign = halign;
		else windowContent.style.textAlign = 'left';
		
		w.style.display = 'block';
		f.style.display = 'block';
		myOpacity = new fx.Opacity(w, {duration: 400});
		myOpacity.hide();
		myOpacity.toggle();
	}
	
	
	function popupClose () {	
		var f = document.getElementById('hvnWindowFloatShadow');
		var w = document.getElementById('hvnWindowFloat');
		
		if (f) {
			f.style.display = 'none';
			w.style.display = 'none';
		}
	}
	
	
	function popupAddTitle (title) {
		var cnt = document.getElementById('hvnWindowFloat');
		var wft = document.getElementById('hvnWindowFloatFooterTitle');
		var wt = document.getElementById('hvnWindowFloatTitle');
		var wc = document.getElementById('hvnWindowFloatContent');
		
		if (wft) cnt.removeChild(wft);
		
		if (!wt) {
			var nwt = document.createElement('div');
			nwt.setAttribute('id', 'hvnWindowFloatTitle');
			nwt.innerHTML = title;
			cnt.removeChild(wc);
			cnt.appendChild(nwt);
			cnt.appendChild(wc);
		}
		else wt.innerHTML = title;
	}
	
	
	function popupAddFooterTitle (title, details) {
		var cnt = document.getElementById('hvnWindowFloat');
		var wft = document.getElementById('hvnWindowFloatFooterTitle');
		var wt = document.getElementById('hvnWindowFloatTitle');
		if (wt) cnt.removeChild(wt);
		
		var wfd = title;
		if (details) wfd += '<div id="hvnWindowFloatFooterTitleDetails">' + details + '</div>';
		if (!wft) {
			var nwt = document.createElement('div');
			nwt.setAttribute('id', 'hvnWindowFloatFooterTitle');
			nwt.innerHTML = wfd;
			cnt.appendChild(nwt);
		}
		else wft.innerHTML = wfd;
	}
	
	
	function popupAddContent (content) {
		var wc = document.getElementById('hvnWindowFloatContent');
		wc.innerHTML = content;
	}
	
	
	function countdown(url, seconds) {
		setTimeout("document.location='" + url + "'", seconds);
	}
	
	
	function hvnFormSubmitPublic (objForm) {
		objForm.submit();
	}
