$(document).ready(function() {

// ARAMA
$('.input, #haber_input, #s, .lInput')
		.focus(function(){
			if( $(this).attr('value') == $(this).attr('title') ) {
				$(this).attr({ 'value': '' });
			}
		})
		.blur(function(){
			if( $(this).attr('value') == '' ) {
				$(this).attr({ 'value': $(this).attr('title') })
			}
		});	


//	 top MENU
$('#topMenu ul li').hover(
	function () {
		//show its submenu
		//$('a', this).addClass('topActive'); 
		$('ul', this).fadeIn(200);

	}, 
	function () {
		//hide its submenu
		//$('a', this).removeClass('topActive'); 
		$('ul', this).fadeOut(200);			
	}
);

//	 kategori MENU
$('.listDernekler ul li a,').hover(
	function () {
		//show its submenu
		$(this).animate({marginLeft: "15"}, 300 );

	}, 
	function () {
		//hide its submenu
		$(this).animate({marginLeft: "0"}, 300 );			
	}
);


// alert
$('#alert').fadeIn().delay(3000).fadeOut();

// login ac
$('#lOpen, .loginAC').click(
	function () {
		//show its submenu
		$('#login').fadeIn();

	});

// login kapat
$('#lClose').click(
	function () {
		//show its submenu
		$('#login').fadeOut();

	});


// galeri
        $(".galeri img").hover(function() {
            // hover in
            $(this).css("z-index", 1);
            $(this).animate({
               height: "150",
               width: "150",
               marginLeft: "-=10",
               marginTop: "-=10"
            }, "fast");
        }, function() {
            // hover out
            $(this).css("z-index", 0);
            $(this).animate({
                height: "125",
                width: "125",
                marginLeft: "+=10",
                marginTop: "+=10"
            }, "fast");
        });
	
// validet kontrol haber input
  $(function() {
    $('.error').hide();
    $("#habersubmit").click(function() {
      // validate and process form here

      $('.error').hide();
  		var haber_input = $("#haber_input").val();
  		if (haber_input == "") {
        $("#name_error").show();
        $("#haber_input").focus();
        return false;
      }

    });
  });

//////// newsletter
  function newsKontrol(){
    
	var dirtyStrPassword= String(document.newsletter.haber_input.value);
	var len  = dirtyStrPassword.length;
        if (len == 0)
        {  
           alert("Lütfen e-posta adresinizi giriniz!");
           document.newsletter.haber_input.focus();
           return false;
        }
		
    	for (var i = 0; i < len; i++){
        var validChars = "@";
        var validCharsnokta = ".";
		var chr = dirtyStrPassword.charAt(i);
		if (validChars.indexOf(chr) != -1){
       		var atvar = 1
			}
		if (validCharsnokta.indexOf(chr) != -1){
       		var atvarnokta = 1
			}
	    }
        if (atvar != 1 || atvarnokta != 1) {
			alert("Lütfen Geçerli bir e-posta adresi giriniz @!!!!!!")
            return false
			}

			document.habersubmit.submit();	
return true;
} 	
	
});
