$(document).ready(function(){  
	$("#tabs").tabs({ fxFade: true, fxSpeed: 'fast' });
	$("#news_tabs").tabs({ fxFade: true, fxSpeed: 'fast' });

    function sift()  
     {  
         if (index<(thumbs.length-1)){index+=1 ; }  
         else {index=0}  
         show (index);  
     }  
   
     function show(num)  
     {  
         images.fadeOut(400);  
         $(".image-"+num).stop().fadeIn(400);  
         var scrollPos = (num+1)*imgHeight;  
         $("#thumbs").stop().animate({scrollTop: scrollPos}, 400);  
     }
	
	 var index = 0;  
     var images = $("#gallery img");  
     var thumbs = $("#thumbs img");
	 var thumblinks = $("#thumbs a");
     var imgHeight = thumbs.attr("height");  
     thumblinks.slice(0,3).clone().appendTo("#thumbs");  
     for (i=0; i<thumblinks.length; i++)  
     {  
         $(thumbs[i]).addClass("thumb-"+i);  
         $(images[i]).addClass("image-"+i);  
     }  
   
     $("#next").click(sift);  
     show(index);  
     setInterval(sift, 8000);  
   
 
});

function submitenter(myfield,e){
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
	   {
	   myfield.form.submit();
	   return false;
	   }
	else
	   return true;
}

