// JScript File
jQuery(document).ready(function () {
    	jQuery.noConflict();
    
	jQuery('.lavaLampWithImage').lavaLamp({
		fx: 'backout',
		speed: 800,
	        click: function(event, menuItem) {
	            return true;
	        }
	});

	//gestione dei link nei testi dinamici
	jQuery.each(jQuery('#div_testo a'), function(index, value) { 
		var linkVal = new String(value);
		if ((linkVal.indexOf("surfnews.it") != -1) || (linkVal.indexOf("surfnews.com") != -1)) {
		    jQuery('#div_testo a')[index].setAttribute("target","_top");
		} else {
		    jQuery('#div_testo a')[index].setAttribute("target","_blank");
		}
	});

	jQuery('#txtRicerca').keypress(function(e) {
	    // Ho premuto il tasto enter
	    if(e.keyCode == '13') {
	      // Evito che l'evento continui
	      e.stopPropagation();
	      gotoRicerca();
	    } 
	});

});

//png fix
jQuery(function(){jQuery(document).pngFix();});

//ricerca
function gotoRicerca(){
    if (jQuery("#txtRicerca") != null) {
	var ric=jQuery("#txtRicerca").val();
	if (ric.length < 3) {
	    alert('Selezionare un testo di ricerca di almeno 3 caratteri');
	} else {
	    window.location.replace('ricerca.aspx?q=' + ric);
	}
    }
}

function checkEnterRicerca(obj) {
    jQuery('#txtRicerca').keypress();
    return false;
}