function popupImmagineP(elem) {
	hs.registerOverlay({
		html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
		position: 'top right',
		fade: 2 // fading the semi-transparent overlay looks bad in IE
	});
	hs.wrapperClassName = 'borderless';
	document.getElementById("rifThumb").style.left = 400  +'px';
	document.getElementById("rifThumb").style.top = 400  +'px';
	//document.getElementById("rifThumb").style.width = elem.firstChild.width +'px';
	//document.getElementById("rifThumb").style.height = elem.firstChild.height +'px';
	
	return hs.expand(elem, { thumbnailId: 'rifThumb' });
}

function popupImmagineGallery(elem) {
	hs.registerOverlay({
		html: '<div class="closebutton" onclick="return hs.close(this)" title="Close"></div>',
		position: 'top right',
		fade: 2 // fading the semi-transparent overlay looks bad in IE
	});
	hs.wrapperClassName = 'borderless';
	document.getElementById("rifThumb").style.left = 400  +'px';
	document.getElementById("rifThumb").style.top = 400  +'px';
	//document.getElementById("rifThumb").style.width = elem.firstChild.width +'px';
	//document.getElementById("rifThumb").style.height = elem.firstChild.height +'px';
	
	return hs.expand(elem, { thumbnailId: 'rifThumb' });
}


function popupIFrameP(elem) {
	//document.getElementById("rifThumb").style.left = 400  +'px';
	//document.getElementById("rifThumb").style.top = 400  +'px';
	//document.getElementById("rifThumb").style.width = elem.firstChild.width +'px';
	//document.getElementById("rifThumb").style.height = elem.firstChild.height +'px';
	
	return hs.htmlExpand(elem, { /*thumbnailId: 'rifThumb',*/ contentId: 'my-contents', objectType: 'iframe', objectWidth: 800, objectHeight: 680} );
}

function popupIFrame(el) {



var nuovaAnchor = document.createElement("a");
		nuovaAnchor.setAttribute("href", el.alt);
		nuovaAnchor.setAttribute("onclick", "return hs.htmlExpand\(this, { contentId: 'my-contents', objectType: 'iframe', objectWidth: 800, objectHeight: 600} \)");
		nuovaAnchor.setAttribute("class", "highslide");
		el.parentnode.appendChild(nuovaAnchor);
		nuovaAnchor.appendChild(el);

		
/*
	Lightview.show({
	href: el.alt,
	rel: 'iframe',
	title: '',
	//caption: el.title,
		options: {
			autosize: true,
			topclose: false,
			width: 800,
       		height: 600,
       		scrolling: false,
       		closeButton: 'small'
		}
	});
*/
}


function popupYouTube(elem) {
	Lightview.show({
	href: 'http://www.youtube.com/v/'+elem.alt,
	rel: 'iframe',
	title: '',
	caption: elem.title,
		options: {
			autosize: true,
			topclose: true
		}
	});
}


function popupYouTubeIE(video1) {

	var videoTitle = video1.alt;
	var video1 = video1.alt;
	
	var winl = (screen.width - 850) / 2;
	var wint = (screen.height - 500) / 2;
	
	if (w_2 != null && w_2.open) w_2.close();
	
	w_2 = window.open("", "popup", "width=850px,height=500px,top="+wint+",left="+winl+",resizable=0,scrollbars=no");
	d = w_2.document;
	d.writeln("<h"+"tml>");
	d.writeln("<h"+"ead>");
	d.writeln("<t"+"itle>" + videoTitle + "</t"+"itle>");
	d.writeln( "<scrip" + "t language='javascript' type='text/javascript'>function indirizzo() {location.href='http://www.youtube.com/v/"+video1+"';}</scrip" + "t>");
	d.writeln( "</h"+"ead>" );
	d.writeln( "<b"+"ody topmargin='0' leftmargin='0' scroll='no' style='margin:0;overflow: hidden' onload='indirizzo()'>" );
	d.writeln( "</b"+"ody>" );
	d.writeln( "</h"+"tml>" );
	d.close();
	w_2.focus();
}




function popupIFrameIE(video1) {

	var videoTitle = video1.alt;
	var video1 = video1.alt;
	
	var winl = (screen.width - 800) / 2;
	var wint = (screen.height - 600) / 2;
	
	if (w_2 != null && w_2.open) w_2.close();
	
	w_2 = window.open("", "popup", "width=800px,height=600px,top="+wint+",left="+winl+",resizable=0,scrollbars=no");
	d = w_2.document;
	d.writeln("<h"+"tml>");
	d.writeln("<h"+"ead>");
	d.writeln("<t"+"itle>" + videoTitle + "</t"+"itle>");
	d.writeln( "<scrip" + "t language='javascript' type='text/javascript'>function indirizzo() {location.href='"+video1+"';}</scrip" + "t>");
	d.writeln( "</h"+"ead>" );
	d.writeln( "<b"+"ody topmargin='0' leftmargin='0' scroll='no' style='margin:0;overflow: hidden' onload='indirizzo()'>" );
	d.writeln( "</b"+"ody>" );
	d.writeln( "</h"+"tml>" );
	d.close();
	w_2.focus();
}
