// JavaScript Document
function ajaxLink(hrefObj,element_id){
	var element = document.getElementById(element_id);
	//element.innerHTML = '<img src="img/loading-big-red-white.gif" style="position:absolute;" />'+element.innerHTML;
	oldBackgroundImage=element.style.backgroundImage;  
	oldBackgroundPosition=element.style.backgroundPosition;  
	oldBackgroundRepeat=element.style.backgroundRepeat;  
	oldBackgroundColor=element.style.backgroundColor;  
 	
	element.style.backgroundImage="url(img/loading-big.gif)";  
	element.style.backgroundPosition="top right ";  
	element.style.backgroundRepeat="no-repeat";  
	element.style.backgroundColor="#FFFFFF";  
 
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest()
	}else if (window.ActiveXObject){
		// code for IE
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	xmlhttp.open("GET", fragment_url);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			element.style.backgroundImage=oldBackgroundImage;  
			element.style.backgroundPosition=oldBackgroundPosition;  
			element.style.backgroundRepeat=oldBackgroundRepeat;  
			element.style.backgroundColor=oldBackgroundColor;  
			element.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}
function loadFragmentInToElement(fragment_url, element_id) {
	if(fragment_url.href)fragment_url=fragment_url.href;
	var element = document.getElementById(element_id);
	//element.innerHTML = '<img src="img/loading-big-red-white.gif" style="position:absolute;" />'+element.innerHTML;
	oldBackgroundImage=element.style.backgroundImage;  
	oldBackgroundPosition=element.style.backgroundPosition;  
	oldBackgroundRepeat=element.style.backgroundRepeat;  
	oldBackgroundColor=element.style.backgroundColor;  
 	
	element.style.backgroundImage="url(img/loading-big.gif)";  
	element.style.backgroundPosition="top right ";  
	element.style.backgroundRepeat="no-repeat";  
	element.style.backgroundColor="#FFFFFF";  
 
	if (window.XMLHttpRequest){
		xmlhttp=new XMLHttpRequest()
	}else if (window.ActiveXObject){
		// code for IE
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	xmlhttp.open("GET", fragment_url);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			element.style.backgroundImage=oldBackgroundImage;  
			element.style.backgroundPosition=oldBackgroundPosition;  
			element.style.backgroundRepeat=oldBackgroundRepeat;  
			element.style.backgroundColor=oldBackgroundColor;  
			response=xmlhttp.responseText;
			/*
				per simulare gli a href normali
				regexText='^.*?<div[^>]*'+element_id+'.*?>(.*?)</div>.*?$';
				regexText='.*<!-- maincontent -->(.+)$';
				alert(regexText+'= '+response.search(regexText));
				r=new RegExp(regexText, 'i');
				after=r.exec(response);
				alert(after[1]);
				
				if(responseContent[1]) response=responseContent[1];
			*/
			element.innerHTML = response;
		}
	}
	xmlhttp.send(null);
	return false;
}



function ajaxPopup(obj,type){
	/*caption=document.getElementById("highslideCaption");
	if(!caption){
			alert("missing caption");
			return;
	}*/
	if(type=='small'){
			option_objectWidth=250;
			option_objectHeight=250;
		
	}else{
			option_objectWidth=380;
			option_objectHeight=380;
	}
	//caption.style.display="block"; 
	return hs.htmlExpand(obj, { contentId: 'highslideCaption',  objectType: 'ajax', preserveContent: true,objectWidth:option_objectWidth,objectHeight:option_objectHeight} )
	//caption.style.display="block";
	//return false; 
}
function iframePopup(obj){
	/*return hs.htmlExpand(obj, { contentId: 'highslideCaption', objectType: 'iframe',		objectWidth: 700, objectHeight: 900} )
	
	caption=document.getElementById("highslideCaption");
	if(!caption){
			alert("missing caption");
			return;
	}
	caption.style.display="block"; */
	return  hs.htmlExpand(obj, { contentId: 'highslideCaption', objectType: 'iframe',		objectWidth: 400, objectHeight: 380} )
	//caption.style.display="block";
	return false; 
}
function closePopup(id){
		alert(  'closing ' +id);
		hs.close(id);
	}
	
function printEmail(user,domain,anchorText){
	e=user+'@'+domain;
	t=t+'<a href="mai';
	t=t+'lto:'+e;
	t=t+'" title="'+ e +'">';
	if(anchorText){
		t=t+anchorText;
	}else{
		t=t+e;
	}
	t=t+'</a>';
	document.write(t);
}