jQuery(function() {
		var timeoutId;
                var i=0;
		
                jQuery('#tabview #tab-test').click(function(){
			           window.location = this.rel;
		   }); 
		            
	        jQuery('#tabview #tab-photo').click(function(){
			         window.location = this.rel;
                });

                jQuery('#tabview #tab-video').click(function(){
			         window.location = this.rel;
                });
		
		jQuery('#tabview').tabs({ fxFade: true, fxSpeed: 'normal' }).find('ul:eq(0)>li a').each(function(i) {
			jQuery(this)
				.bind('mouseover', function() {
				
					theTab = this;
					
					
					if(theTab.id == 'tab-events'){
						jQuery("#fragment-3").hide();
						jQuery("#fragment-4").hide();
						jQuery("#fragment-5").hide();
                                                jQuery("#fragment-6").hide();
						jQuery("#fragment-2").fadeIn(300);
						jQuery("#tab-fp").parent().removeClass("tabs-selected");
						jQuery("#tab-test").parent().removeClass("tabs-selected");
						jQuery("#tab-photo").parent().removeClass("tabs-selected");
						jQuery("#tab-events").parent().removeClass("tabs-selected");
						jQuery("#tab-events").parent().addClass("tabs-selected");
						return false;
					}
					if(theTab.id == 'tab-fp'){
						jQuery("#fragment-2").hide();
						jQuery("#fragment-4").hide();
						jQuery("#fragment-5").hide();
                                                jQuery("#fragment-6").hide();
						jQuery("#fragment-3").fadeIn(300);
						jQuery("#tab-events").parent().removeClass("tabs-selected");
						jQuery("#tab-test").parent().removeClass("tabs-selected");
						jQuery("#tab-photo").parent().removeClass("tabs-selected");
						jQuery("#tab-fp").parent().removeClass("tabs-selected");
						jQuery("#tab-fp").parent().addClass("tabs-selected");
						return false;
					}
					
          if(theTab.id == 'tab-photo'){
						
						return false;
					}
          if(theTab.id == 'tab-video'){

						return false;
					} 
					
          if(theTab.id == 'tab-test'){
						return false;
					}
					if (timeoutId) {
						clearTimeout(timeoutId);
						timeoutId = null;
					}
                                        
					jQuery('#tabview').triggerTab(i + 1);
				})
				.bind('mouseout', function() {
					timeoutId = setTimeout(function() {
						$('#tabview').triggerTab(1);
					}, 1000);
				});
		});

	});
