$(document).mouseup(function(e) {
 var target = $(e.target);							 
   if(target.attr("class")!="inputBox" && target.attr("class")!="" && target.attr("class")!="submit") {
	$("ul.userLogin").slideUp('normal');
   }
});	

jQuery(document).ready(function() {
						
$('.uniform').find ('input, select').uniform ();

// anasayfa yuvavitirini için
$("#slider").easySlider({
	auto: true, 
	continuous: true,
	firstShow: false,
	lastShow: false		
});

						
								
MM_showHideLayers('ilListe','','hide');								
								
$('.toggle_div a.baslik').click(function(){ 
		$(this).next('.aciklama').toggle();
	});
								
								
initAccordionContent();
	
//$('.advancedSearchBox').hide();
$('.advanceBut').click(function() {
  $(this).toggleClass("selected");															
  if ($('#dahaFazlaHaber').css("display")=="none")
  $('#dahaFazlaHaber').show();
  else
  $('#dahaFazlaHaber').hide();  
  if ($('#dahaFazlaEtkinlik').css("display")=="none")  
  $('#dahaFazlaEtkinlik').show();  
  else
  $('#dahaFazlaEtkinlik').hide();    
  $('.advancedSearchBox').slideToggle('slow', function() {  });
});


								
for (i=1; i<13; i++){
	$('#sponsor-box'+i).hide();	
	$('#sp'+i).bt({
	  contentSelector: "$('#sponsor-box"+i+"')",  positions: ['top'], fill: '#F4F4F4', 
	  strokeStyle: '#666666', spikeLength: 10, spikeGirth: 10, width: 300
	});
}

jQuery('#mycarousel_ver').jcarousel({
	vertical: true
});

								
								
    /*jQuery('#activityCarousel').jcarousel();
    jQuery('#activityCarousel_mp').jcarousel();	*/

	
	$("#icerikEkle").click(function () {
		$("ul.subnav").slideDown('fast');
		return false;
	});
	
	$("ul.topnav").hover(function () {},
		function () { $("ul.subnav").slideUp('normal'); }
	);
	
	$("#uyeGirisi").click(function () {
		$("ul.userLogin").slideDown('fast');
		return false;
	});
		
	
	function megaHoverOver(){
		$(this).find(".subItem").stop().fadeTo('fast', 1).show();
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
		
		if ( $(this).find(".row").length > 0 ) { //If row exists...
			var biggestRow = 0;	
			$(this).find(".row").each(function() {							   
				$(this).calcSubWidth();
				if(rowWidth > biggestRow) {
					biggestRow = rowWidth;
				}
			});
			//Set width
			$(this).find(".subItem").css({'width' :biggestRow});
			$(this).find(".row:last").css({'margin':'0'});			
		} else { //If row does not exist...
			$(this).calcSubWidth();
			$(this).find(".subItem").css({'width' : rowWidth});
		}
	}
	function megaHoverOut(){ 
	  $(this).find(".subItem").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 100, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
	$("ul#navigation li .subItem").css({'opacity':'0'});
	$("ul#navigation li").hoverIntent(config);	
	

});




function showTab_article(activeNum){
	for (i=1; i<=5; i++){
	if (i!=activeNum){
	document.getElementById("catTab"+i).className="categoryItem";	
	document.getElementById("catContent"+i).style.display="none";				
	}else{
	document.getElementById("catTab"+i).className="current_categoryItem";		
	document.getElementById("catContent"+i).style.display="block";		
	}}
}

function showHide(activeObj, passiveObj){
	document.getElementById(activeObj).style.display="block";				
	document.getElementById(passiveObj).style.display="none";		
}

function GIIN(str) {
	document.getElementById(str).style.display = 'block';
}

function GIOUT(str) {
	document.getElementById(str).style.display = 'none';
}




function initAccordionContent() {
$('#accordionContent ul').hide();
$('#accordionContent ul:first').show();
$('#accordionContent li a').click(
	function() {
		var checkElement = $(this).next();
		if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
		return false;
		}
		if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
		$('#accordionContent ul:visible').slideUp('normal');
		checkElement.slideDown('normal');
		return false;
		}
	}
);
}



function MM_showHideLayers() { //v9.0
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3)
        with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) {
        v = args[i + 2];
        if (obj.style) { obj = obj.style; v = (v == 'show') ? 'block' : (v == 'hide') ? 'none' : v; }
        obj.display = v;
    }
}

function focusControl_se_input(param) { 
if (param=="in"){
	se=document.getElementById("se_input");
	se.style.backgroundImage="url(http://www.yuvabul.com/themed/kemal_first/img/bg_mp_yuvaSearchInput_over.gif)";
	document.getElementById("search_keyword").style.color="#0095cd";	
	se=document.getElementById("search_keyword");
	se.value='';
}else{
	se=document.getElementById("se_input");
	se.style.backgroundImage="url(http://www.yuvabul.com/themed/kemal_first/img/bg_mp_yuvaSearchInput.gif)";
	se=document.getElementById("search_keyword");
	document.getElementById("search_keyword").style.color="#b6b6b6";	
	if(se.value=='') se.value='anaokulunu veya semti giriniz';
}
}

function handleSliderChange(e, ui)
{
  var maxScroll = $("#content-scroll").attr("scrollWidth") -
                  $("#content-scroll").width();
  $("#content-scroll").animate({scrollLeft: ui.value *
     (maxScroll / 100) }, 1000);
}

function handleSliderSlide(e, ui)
{
  var maxScroll = $("#content-scroll").attr("scrollWidth") -
                  $("#content-scroll").width();
  $("#content-scroll").attr({scrollLeft: ui.value * (maxScroll / 100) });
}

/*$('#example4').bt({
  preShow: function() {
    $(this).data('origContent', $(this).html());
    $(this).html('hovering active');
  },
  postHide: function() {
    $(this).html($(this).data('origContent'));
  }
});*/
