﻿$(document).ready(function() {

	$("a").each(function() {
		if (this.href.indexOf(".pdf") > -1)
			$(this).attr("rel", "popup");
	});

	$("a[rel=popup]").click(function() {
		var sUrl = this.href;

		if (sUrl.indexOf("javascript") < 0)
			window.open(sUrl);
		else
			setTimeout(sUrl.replace("javascript:", ""), 0);

		return false;
	});

	$("a[rel=popup]").bind("onkeydown", function() {
		if (sUrl.indexOf("javascript") < 0)
			window.open(sUrl);
		else
			setTimeout(sUrl, 0);

		return false;
	});

	$("img").each(function() {
		if ($(this).attr("alt") == " ") $(this).attr("alt", "");
		if ($(this).attr("align").toLowerCase() == "left") $(this).css("float", "left");
		if ($(this).attr("align").toLowerCase() == "right") $(this).css("float", "right");
	});

});

/* controllo validazione email */
function isEmail(string) {
	if (string == "")
		return false;
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}

