function updateSlide(){
	var actual=$('#currentSlide').val();
	var total=$('#totalSlide').val();
	if(actual==total){
		var sig=1;
	}else{
		var sig=parseInt(actual)+1;
	}
	if($("#currentSlide").is('*')){
		document.getElementById("currentSlide").value=sig;
		$("#menu_"+sig+"").trigger('click');
	}
}
jQuery.fn.mailto = function() {
	return this.each(function(){
		var email = $(this).html().replace(/\s*\(.+\)\s*/, "@");
		$(this).before('<a href="mailto:' + email + '" rel="nofollow" title="Email ' + email + '">' + email + '</a>').remove();
	});
};
$(document).ready(function() {	

    $('.vertical').hover(function() {
        $('img.top', $(this)).stop().animate({top: '188px'}, 500);
    },function() {
        $('img.top', $(this)).stop().animate({top: '0'}, 500);
    });

	//Get the height of the first item
	$('#mask').css({'height':$('#panel-1').height()});	
	
	//Calculate the total width - sum of all sub-panels width
	//Width is generated according to the width of #mask * total of sub-panels
	$('#panel').width(parseInt($('#mask').width() * $('#panel div').length));
	
	//Set the sub-panel width according to the #mask width (width of #mask and sub-panel must be same)
//	$('#panel div').width($('#mask').width());
	
	//Get all the links with rel as panel
	$('a[rel=panel]').click(function () {
			
		//Get the height of the sub-panel
		var panelheight = $($(this).attr('href')).height();
		
		//Set class for the selected item
		$('a[rel=panel]').removeClass('selected');
		$(this).addClass('selected');
		
		//Resize the height
		$('#mask').animate({'height':panelheight},{queue:false, duration:500});			
		
		//Scroll to the correct panel, the panel id is grabbed from the href attribute of the anchor
		$('#mask').scrollTo($(this).attr('href'), 800);		
		
		//Discard the link default behavior
		return false;
	});
	
	$('.scroll-pane, .scroll-pane2, .scroll-pane3, .scroll-pane4').jScrollPane();
	
	$(".fancy").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic'
	});
	$(".fancy_email").fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'width'			:	520,
		'height'		: 	240,
		'padding'		:	0
	});
	$('.email').mailto();
	$("#formu").validationEngine({
		onValidationComplete: function(form, status){
			document.getElementById('emailconfirm').value=document.getElementById('email2').value;
			document.getElementById('email').value=document.getElementById('email2').value;
			var abcc=$('#abc').serialize();
			$.ajax({
				type: 'POST', 
				data: abcc, 
				url: '/lists/?p=subscribe&id=2', 
				success: function(msg){ 
					document.forms.frm.submit();
				}
			});
		}  
	});
	setInterval( "updateSlide()", 10000 );
});
