// F1 front-end/back-end toggle
	if (document.all) {
		document.onhelp = function() {
			location.href = 'admin/';
			return false;
		}
	} else {
		document.onkeydown = function (evt) {
			if (evt.keyCode == '112') {
				location.href = 'admin/';
				return false;
			}
		}
	}

function isEmail(strEmail){
    validRegExp = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    if (strEmail.search(validRegExp) == -1) {
      alert('Inserire un indirizzo e-mail valido');
      return false;
    }
    return true;
  }

function ctrlPrivacy(){
         var bConsenso;
         bConsenso = document.myForm.chkPrivacy.checked;
         if (bConsenso)
                 document.myForm.Submit.disabled = false;
         else
         {
                 document.myForm.Submit.disabled = true;
                 alert('Per continuare è necessario autorizzare al trattamento dei dati.')
         }
}

//jQuery
$(document).ready(function(){

	// SCROLLABLE CATALOGO PRODOTTI
		$(".scrollable").scrollable({
			size: 1
			, vertical: true
			, interval: 3000
			, loop: true
			, clickable: false
			, keyboard: false
			, easing: 'swing'
			, speed: 1500
 		});
	
	
	// PNG FIX
		$('img[src$=.png]').ifixpng();


	// FACEBOX
		$("a[rel*='facebox']").facebox();
	
	
	// COLSX ALTA COME CENTRALE
		$('#centrale').height() > $('#colSx').height() ? $('#colSx').height($('#centrale').height()) : $('#centrale').height($('#colSx').height())
	
	
	// TABS
		// BRANDING HOME
			$("#tabs").tabs({ event: 'mouseover' });
			$("#tabs").tabs('rotate', 6000);
			$("#tabs a").click(function(){ location.href = $(this).attr("rel"); });
	
	
	// LOGIN BAR
		$('a:contains("Login"), a:contains("login")')
			.css({ cursor: 'pointer'})
			.click(function(){
				$('#loginBar').slideToggle('slow')
			}
		)
	
	
	// NEWSLETTER HOME: accettazione privacy
		$("form[name='newsletter']")
			.submit(function(){
				if ( $(this).find("input[name='f_consenso']:checked").length == 0 )	{
					alert('E\' necessario accettare l\'informativa sulla privacy')
					return false;
				}
			})
			
		$("form[name='newsletter'] :text").focus(function(){
			if ( $(this).val() == 'inserisci la tua email...' ) {
				$(this).val("")
			}
		})
	
			
});
