$(document).ready(function() {
	
/*function getCookie(name) {
	var search = name + '=';
	
	if (document.cookie.length > 0)
	{
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1)
			{
				end = document.cookie.length;
				return document.cookie.substring(offset, end)
			}
		}
	}
}
	
function setCookie (name, value, days) {
		
	var expires = '';
	
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		expires = "; expires="+date.toGMTString();
	}
	
	document.cookie = name+'='+value+expires+"; path=/;";
}

function removeCookie(name) {
	
	setCookie(name, "", -1);
	return false;
}

setCookie('ciao', 't=1&p=1&d=2&o=5&s=4', 2);
setCookie('prova2', 'ciao a tutti da me', 2);

alert(getCookie('ciao'));
removeCookie('ciao');
getCookie('prova2');*/
	
	// Visualizzazione ora
	/*view_ora();
	setInterval("view_ora()",60000);*/
	
	// Seleziono gli input nel form del prodotto
	$('#prodotto :input').focus( function() {
		$(this).select();
	});

	// Form inserimento utente
	$('#utente :input').focus( function() {
		$(this).select();
	});
	
	// Seleziono gli input nel form del prodotto
	$('#prodotto :input[@name=tipo]').change( function() {
		if($(this).attr('value') == '7')
			$('#eta').show();
		else
			$('#eta').hide();
	});
		
	// Seleziono gli input nel form del prodotto
	$('#prodotto :input[@id=tipo]').change( function() {
		if($(this).attr('value') == '7')
			$('#eta').show();
		else
			$('#eta').hide();
	});
	
	// Seleziono l'input della mailing list
	$('#mailing :input').focus( function() {
		$(this).select();
	});
	
	if($('#tipo').val() == '' && $('#annoprod').val() == '' && $('#provenienza').val() == '' && $('#prezzo').val() == '') {
		$('#submit_ricerca').attr('disabled', 'disabled');
		$('#submit_ricerca').addClass('no_selected');
	}
});
