 // JEL - JavaSctipt eSUITE Libraries
 // by Enrico Sorcinelli

bName = navigator.appName;
bVer = parseInt(navigator.appVersion);
if ( bName == "Netscape" && bVer >= 3 )
	ver = "n3";
else if ( bName == "Microsoft Internet Explorer" && bVer >= 3 )
	ver = "e4";
else if (bName == "Netscape" && bVer == 2)
	ver = "n2";
else if (bName == "Microsoft Internet Explorer" && bVer >= 2)
	ver = "e3";

function ViewImage1(title, caption, img, options, card) {

	if ( ! img.match(/^https?:\/\//) ) {
		img = 'http://www.carnevaledifano.com/' + img;
	}

	def_options = 'height=570,width=530,scrollbars=1,resizable=1,dependent,top=50,left=50';
	if ( !options )
		options = def_options;
	if ( ver == "n3" || ver == "e4" ) {
		if ( !popup ) {
			var popup = window.open("","ImageWindow",options);
		}
		popup.document.writeln("<HTML><HEAD><TITLE>" + title + "</TITLE>");
		popup.document.writeln('<link rel="stylesheet" href="/cdf.css" type="text/css"></HEAD><BODY BGCOLOR=#FFFFFF>');
		popup.document.writeln("<CENTER><FONT SIZE=2 COLOR=#FF0000><B>" + caption + "</B></FONT><P>");
		popup.document.writeln("<P><TABLE BORDER='1' bgcolor='#FFFFFF' cellpadding='0' cellspacing='0'><TR><TD><IMG SRC=" + img + "></TABLE><a href='#' onClick='window.close()' class='txtb'>Chiudi</a> | ");
		popup.document.writeln('<a href="http://www.fanofunny.com/cgi-bin/esuite/allguest/allguest.cgi?gb=funnycards&l=0&act=cst&title=' + escape(title) + '&img=' + img + '" target="cards" class="txtb">Invia una cartolina con questa immagine!</a>');
		popup.document.writeln("</CENTER></BODY></HTML>");
		popup.document.close();
		popup.focus();
	}
	else if ( ver == "e4" ) {
		if ( popup )
			popup.self.close();
		var popup = window.open(img,"ImageWindow",options);
	}
}

function ViewImage2(img_id,img,frame_id) {
	if (!frame_id)
		eval("document." + img_id + ".src = '" + img  + "'");
	else
		eval("parent." + frame_id + ".document." + img_id + ".src = '" + img +"'");
}


function OpenDialog(title, caption, href, options) {
	def_options = 'height=350,width=380,scrollbars=1,resizable=1,dependent';
	if ( !options )
	options = def_options;
	var popup = window.open(href,caption,options);
	popup.focus();
	return popup;
}
