// Created by Tendure Interactive
// Developer by MGC
$.fn.tendure_nav = function(options) {
    
  options = $.extend({speed: 50}, options || {});
  
  this.each(function() {
    
    var root = this, zIndex = 1000;
    
    function getSubnav(ele) {
      if (ele.nodeName.toLowerCase() == 'li') {
        var subnav = $('> ul', ele);
        return subnav.length ? subnav[0] : null;
      } else {
        return ele;
      }
    }
    
    function getActuator(ele) {
      if (ele.nodeName.toLowerCase() == 'ul') {
        return $(ele).parents('li')[0];
      } else {
        return ele;
      }
    }
    
    function hide() {
      var subnav = getSubnav(this);
      if (!subnav) return;
      $.data(subnav, 'cancelHide', false);
      setTimeout(function() {
        if (!$.data(subnav, 'cancelHide')) {
          $(subnav).slideUp(options.speed);
        }
      }, 100);
    }
	
  
    function show() {
      var subnav = getSubnav(this);
      if (!subnav) return;
      $.data(subnav, 'cancelHide', true);
      $(subnav).css({zIndex: zIndex++}).slideDown(options.speed);
      if (this.nodeName.toLowerCase() == 'ul') {
        var li = getActuator(this);
        $(li).addClass('hover');
        $('> a', li).addClass('hover');
      }
    }
    
    $('ul, li', this).hover(show, hide);
    $('li', this).hover(
      function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); },
      function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover');  }
    );
    
  });
  
};

$(document).ready(function() {
	$('.fh').hide();
	$('#sfn1').show("fast");
	b = "sfn1";
	$('#fn1').addClass("active");
	
	counter = 1;
	
	$('#flshno> li> a').mouseover(function() {
		$('#flshno> li> a').removeClass("active");
		$(this).addClass("active");
		a = "s" + $(this).attr("id");
		if(a != b){
			$("#flshnews> li").hide();
			$('#'+a).show();
		}
		b= a;
	});
	
	var rotation = setInterval(function()	{
     	$('#flshno> li> a').removeClass("active");
		createid = "#fn" + counter ;
		$(createid).addClass("active");
		a = "s" + $(createid).attr("id");
		if(a != b){
			$("#flshnews> li").hide();
			$('#'+a).show();
		}
		b= a;
		if(counter>5){
			counter=1;
		}else{
			counter++;	
		}
    }, 5000);

	
	$(function() {
		$('#nav').tendure_nav();
	});
	$("a[rel^='prettyPhoto']").prettyPhoto();
	
});

function showpretty(){
	//$.prettyPhoto.open("anketistek.php?iframe=true&width=660&height=500","3 Cevap 3 Kitap","");	
	$.prettyPhoto.open("images/kongre.jpg","Kongre","");	
}
