/*
function button_hover(){
	jQuery('.button,button[type=submit],button,input[type=submit],input[type=button],input[type=reset]').hover(
		function() {
				jQuery(this).stop().animate({opacity:0.8},400);
			},
			function() {
				jQuery(this).stop().animate({opacity:1},400);
		});
}
*/
jQuery(document).ready(function() {
	/*
	if(!jQuery.browser.msie){
			button_hover()
	}
	*/

	// TOOLTIP
	// What is? See: http://flowplayer.org/tools/documentation/basics.html#document_ready
	/*
	jQuery("#search-button").tooltip({
		effect: 'slide',
		direction: 'down',
		position: 'bottom left'
	});
	jQuery("#direct-button").tooltip({
		effect: 'slide',
		direction: 'down',
		position: 'bottom left'
	});
	jQuery("#tools-button").tooltip({
		effect: 'slide',
		direction: 'down',
		position: 'bottom left'
	});
	*/

	//TABS SLIDESHOW BANNER
	$(".slidetabs").tabs(".banner > blockquote", {
		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: "slow",
		// start from the beginning after the last tab
		rotate: true
	// use the slideshow plugin. It accepts its own configuration
    }).slideshow({
		autoplay: true,
		interval: 4000
	});

    jQuery('#requestedForm').submit(function(e){
        e.preventDefault();
        
        var formObj = jQuery(this).parents('form');
        
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
        
        var inputVal = jQuery("#input-email").val();
        var fileName = jQuery("#input-fileName").val();

        if(inputVal=='' || !emailReg.test(inputVal)){
            alert('Invalid email/Email non valida!');
        }else{
            $.fancybox.close();
            $.fancybox.showActivity();
            jQuery.post('/sendrequest.php', formObj.serialize(),function(data){
                window.location = fileName;
            });
        }
    });

    jQuery(".modalInput").click(function (e){
        e.preventDefault();
        var linkAddress = $(this).attr("href");
        jQuery("#requestedForm input#input-fileName").val(linkAddress);
        $.fancybox(
            jQuery("#requestedForm"),
            {
                'padding'       : 0,
                'autoScale'     : false,
                'transitionIn'  : 'elastic',
                'transitionOut' : 'elastic',
                'width'         : 640,
                'height'        : 480,
                'overlayOpacity': 0.7
            }
        );
    });
});

