


function slideShow() {
	$('#slideshow a').css({opacity: 0.0});
	$('#slideshow .caption a').css('z-index','100000');
	$('#slideshow a:first').css({opacity: 1.0});
	$('#slideshow .caption').css({opacity: 0.7});
	$('#slideshow .caption').css('height','40px');
	if($('#slideshow a:first').find('img').attr('rel') == null) {
	  return false;
	} else {
	  $('#slideshow .content').html($('#slideshow a:first').find('img').attr('rel')).animate({opacity: 0.85}, 400);
	}
	$('#slideshow').hover(function(){  
	  $("#slideshow .caption").animate({height:'100px'},{queue:false,duration:300});  
    }, function() {  
	  $("#slideshow .caption").animate({height:'40px'},{queue:false,duration:300});  
    });
	setInterval('gallery()',6000);
}

function gallery() {	
	var current = ($('#slideshow a.show') ? $('#slideshow a.show') : $('#slideshow a:first'));
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#slideshow a:first') :current.next()) : $('#slideshow a:first'));	
	var caption = next.find('img').attr('rel');	
	next.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	current.animate({opacity: 0.0}, 1000).removeClass('show');
	$('#slideshow .content').html(caption);	
}

(function ($) {
$.fn.hint = function (blurClass) {
  if (!blurClass) { blurClass = 'blur';} 
  
  return this.each(function () {
    var $input = $(this),
      title = $input.attr('title'),
      $form = $(this.form),
      $win = $(window);
	  var inputFocus = {'border' : '1px solid #000','font-style' : 'normal','color' : '#000'};
	  var inputBlur = {'border' : '1px solid #575757','font-style' : 'italic','color' : '#575757'}

    function remove() {
      if ($input.val() === title && $input.hasClass(blurClass)) {
        $input.val('').removeClass(blurClass).css(inputFocus);
      }
    }
    if (title) { 
      $input.blur(function () {
        if (this.value === '') {
		  if($input.hasClass('error')) {
            $input.val(title).addClass(blurClass);
			$input.focus(function(){
				$input.css(inputFocus);
				$input.removeClass('error');
				$input.addClass(blurClass);
			});
		  } else {
		    $input.val(title).addClass(blurClass);
		    $input.css(inputBlur);
		  }
        }
      }).focus(remove).blur();
	  
      $form.submit(remove);
      $win.unload(remove);
    }
  });
};

})(jQuery);

$(document).ready(function(){
   
  /*if(typeof sIFR == "function"){
	sIFR.replaceElement(named({
	  sSelector:"h1", 
	  sFlashSrc:"http://sppc.org.pt/site/files/klavika_sifr.swf", 
	  sColor:"#000000", 
	  sCase: "upper", 
	  sWmode:"opaque",
	  sFlashVars:"textalign=left&offsetTop=5offsetBottom=5"
	}));
  };*/
  
  if($.browser.safari) { 
	$(function () { 
	  $(".header-left #menu li, .header-center #menu li").css({'margin-bottom':'7px', 'line-height':'11px'});
	  $("#contact-mail-page1 input#edit-submit").css('padding','2px');$("textarea#edit-message, textarea#edit-comment, textarea#edit-submitted-texto").css('resize','none');
	  $("#header-left-menu a").css('background-position','left 11px');
	}); 
  }
  
  $(".vertical-tabs h6.tab:first").addClass("active");
  $(".vertical-tabs .tab-content:not(:first)").hide();
  $(".vertical-tabs h6.tab").click(function(){
	  $(this).next(".tab-content").slideToggle("fast")
	  .siblings(".tab-content:visible").slideUp("fast");
	  $(this).toggleClass("active");
	  $(this).siblings("h6").removeClass("active");
  });
  
  $('input#edit-name').removeAttr('value');
  $('input#edit-submitted-nome').attr('title','Nome').removeAttr('value');
  $('input#edit-submitted-email').attr('title','Email').removeAttr('value');
  
  var inputBlur = {'border' : '1px solid #575757','font-style' : 'italic','color' : '#575757'}
  var inputFocus = {'border' : '1px solid #000','font-style' : 'normal','color' : '#000'};
  var inputFocusTxt = {'border' : '1px solid #000','font-style' : 'normal','color' : '#000'};
  
  $('textarea#edit-submitted-texto, textarea#edit-message, textarea#edit-comment').focus(function() { $(this).css(inputFocus)});
  $('textarea#edit-submitted-texto, textarea#edit-message, textarea#edit-comment').blur(function() { $(this).css(inputBlur)});
  
  if ($('select#edit-submitted-inscricoes').hasClass('error')) {
	$('select#edit-submitted-inscricoes').focus(function(){$(this).removeClass('error').css(inputBlur)});
	$('select#edit-submitted-inscricoes').change(function(){
	  $(this).css(inputFocusTxt);
	});
  } else {
	$('select#edit-submitted-inscricoes').css(inputBlur);
	$('select#edit-submitted-inscricoes').change(function(){
	  $(this).css(inputFocusTxt);
	});
  }
  $(function(){ 
	$('input[title!=""]').hint();
  });
  
  $('.small-thumb-img, .fifty-thumb-box-img').hover(function(){
	  $(".mime-duration", this).stop().animate({top:'60px'},{queue:false,duration:250});
  }, function() {
	 $(".mime-duration", this).stop().animate({top:'80px'},{queue:false,duration:250});
  });
  
  $('.medium-thumb-img').hover(function(){
	  $(".mime-duration-medium", this).stop().animate({top:'79px'},{queue:false,duration:200});
  }, function() {
	 $(".mime-duration-medium", this).stop().animate({top:'100px'},{queue:false,duration:200});
  });
  
  
  slideShow();	
  
 
});



