
/*
Gestione di alternativa di target _blank hack non accettabile nel DTD XHTML e HTML 4

ogni class di un tag <a> deve avere come postfisso new_window

es:
 
 <a class="ancora"  href="www.q-web.it">testo link</a>

 diventa
 
 <a class="ancora new_window"  href="www.q-web.it">testo link</a>

*/
TBHack = window.TBHack || {}
TBHack.sKeyCode = [13, 32];
TBHack.Init = function() 
{
	$('a.new_window').each(function() 
	{
		this.title += '(Questo collegamento verrą aperto su una nuova finestra)';
		$(this).click(function(e) 
		{
			TBHack.Open(this.href);
			return e.preventDefault();
		});
	
		$(this).keypress(function(e) 
		{
			if (e.keyCode==13 || e.keyCode==32) 
			{
				TBHack.Open(this.href);
				return e.preventDefault();
			}
		});
	});
}

TBHack.Open = function(url) {
	window.open(url, 'TBH' + Math.round(10e10 * Math.random() + 0));
}

$().ready(function() {
	TBHack.Init();
});




