$(document).ready(function(){  
	
	$('.topmenu').corner("top");
	$('.footer').corner("bottom");
	$('.boxtop').corner("top");
	
	$.fn.timeout = function(t,f)
		{
		 this.each(function(){setTimeout(f,t); }); 
		 return this; 
		};
	
	$("a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
	$('.yeah').click(alarma);
	
        $.get(
            'count.php',
            {},
            function(ajaxCevap){
                $('.signaturesbox_in').html(ajaxCevap) 
            }
        );
		
	function alarma(){

		if($('.name').attr('value') == 'isim' || $('.name').attr('value') == null || $('.name').attr('value') == 0) {
			alert("Lutfen isminizi yaziniz");
			$('.name').focus();
			return false;
			}
			
		apos=$('.email').attr('value').indexOf("@");
		dotpos=$('.email').attr('value').lastIndexOf(".");
		if (apos<1||dotpos-apos<2) {
			alert("Lutfen gecerli bir e-posta adresi yaziniz.");
			$('.email').focus();
			return false;		
			}
		
		if($('.job').attr('value') == 'meslek' || $('.job').attr('value') == null || $('.job').attr('value') == 0) {
			alert("Lutfen mesleginizi yaziniz");
			$('.job').focus();
			return false;
			}
		
		if($('.city').attr('value') == 'sehir' || $('.city').attr('value') == null || $('.city').attr('value') == 0) {
			alert("Lutfen sehir yaziniz");
			$('.city').focus();
			return false;
			}
		
		$(".contform").ajaxStart(function(){
			$(this).html('<br><br><br><br><br><center><img src="images/loading.gif" width="200px" /></center>');
		});
		
		jQuery.ajax({
			type: 'POST',//Bu kisim POST ve GET degerlerinden birini alabilir
			url: 'imzala.php',//Verinin g�nderilecegi sayfa
			data: $('.form').serialize(),
			error:function(){ $('.contform').html("Bir hata algilandi."); }, //Hata alinirsa ekrana bastirilacak veri
			success: function(veri) { $('.contform').html(veri); }//Basarili olursa ekrana bastirilacak veri
		}); 
		$('.cizik').animate({marginTop:"100px"},2500);
		
        $.get(
            'count.php',
            {},
            function(ajaxCevap){
                $('.signaturesbox_in').html(ajaxCevap) 
            }
        );
		window.open('http://www.facebook.com/sharer.php?u=http://www.hasankeyf.dogadernegi.org/#&t=HASANKEYF YOK OLMASIN KAMPANYASI','','width=600,height=300');
		return false;
	}
	
	$('.alt').mouseover(function() {
		$('.alt').animate({height:'266px'},1000);
		$('.minibanner').animate({bottom:'266px'},1000);
		$('.maskot').animate({bottom:'243px'},1000);
		$('.dogalogo').animate({bottom:'273px'},1000);
		$('.x').animate({bottom:'266px'},1000);
		$(this).timeout(1000,function(){ $('.x').css('z-index','99'); });
	});
	
	$('.minibanner').mouseover(function() {
		$('.alt').animate({height:'266px'},1000);
		$('.minibanner').animate({bottom:'266px'},1000);
		$('.maskot').animate({bottom:'243px'},1000);
		$('.dogalogo').animate({bottom:'273px'},1000);
		$('.x').animate({bottom:'266px'},1000);
		$(this).timeout(1000,function(){ $('.x').css('z-index','99'); });
	});
	
	$('.x').click(function() {
		location.href = 'http://hasankeyf.dogadernegi.org';
	});
	
	/*
	$('.x').click(function() {
		$('.alt').animate({height:'113px'},1000);
		$('.minibanner').animate({bottom:'0'},1000);
		$('.maskot').animate({bottom:'90px'},1000);
		$('.dogalogo').animate({bottom:'120px'},1000);
		$('.x').animate({bottom:'0'},1000);
	});
	$('#hasankeyf').click(function() 
					{ var data1 = $('.x_hasankeyf').html(); $('.box1').html(data1); $('#maxpane').jScrollPane(); stop(); });
	$('#raporlar').click(function() 
					{ var data1 = $('.x_raporlar').html(); $('.box1').html(data1); $('#maxpane').jScrollPane(); stop(); });
	
	$('#neyapabilirim').click(function() 
					{ var data2 = $('.x_neyapabilirim').html(); $('.box2').html(data2); $('#maxpane2').jScrollPane(); stop(); });
	$('#fotograflar').click(function() 
					{ var data2 = $('.x_fotograflar').html(); $('.box2').html(data2); $('#maxpane2').jScrollPane(); stop(); });
	
	*/
	
	$('#hasankeyf').click(function() 
					{ 
					$('.x_hasankeyf').show(); 
					$('.x_imzametni').hide();
					$('.x_hasankeyf div:first').jScrollPane();
					});
	
	$('#raporlar').click(function() 
					{ 
					$('.x_raporlar').show(); 	
					$('.x_videobox').hide(); 
					$('.x_fotograflar').hide();
					$('.x_raporlar div:first').jScrollPane(); 
					});
	/*
	$('#neyapabilirim').click(function() 
					{ 
					$('.x_neyapabilirim').show(); 
					$('.x_fotograflar').hide(); 
					$('.x_videobox').hide(); 
					$('.x_neyapabilirim div:first').jScrollPane();
					});
	*/
	
	$('#fotograflar').click(function() 
					{ 
					$('.x_fotograflar').show(); 	
					$('.x_raporlar').hide(); 
					$('.x_videobox').hide(); 
					$('.x_fotograflar div:first').jScrollPane(); 
					});
	
	$('.namecont').click(function()
					{ var namehidden = $('.namehidden').html(); $('.namehidden').html(''); $('.nameout').html(namehidden); $('.name').focus(); });
	
	$('.emailcont').click(function()
					{ var namehidden = $('.emailhidden').html(); $('.emailhidden').html(''); $('.emailout').html(namehidden); $('.email').focus(); });
	
	$('.jobcont').click(function()
					{ var namehidden = $('.jobhidden').html(); $('.jobhidden').html(''); $('.jobout').html(namehidden); $('.job').focus(); });
	
	$('.citycont').click(function()
					{ var namehidden = $('.cityhidden').html(); $('.cityhidden').html(''); $('.cityout').html(namehidden); $('.city').focus(); });
	
	$('.f_box').click(function()
					{ window.open('http://www.facebook.com/sharer.php?u=http://www.hasankeyf.dogadernegi.org&t=HASANKEYF YOK OLMASIN KAMPANYASI','','width=600,height=300'); });
	/*
	$(this).mousemove(function(e){
      $('.signaturesbox_in').html(e.pageY);
		var x = parseInt($('.alt').css('height'));
	  	if(x < 200 && e.pageY > 500)
	  		{ 
			$('.alt').animate({height:'300px'},1000); 
			}
		if(x > 200 && e.pageY < 500)
			{
			$('.alt').animate({height:'100px'},1000); 
			}
  	});
	*/ 
		$('#pane1').jScrollPane();
		$('.news').jScrollPane();
		$('.videobox').jScrollPane();
		
	
				$('#pane3, #pane4').jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
                
				// this allows you to click a link to add content to #pane4 and shows how to 
				// reinitialise the scrollbars when you have done this.
				$('#add-content').bind(
					'click',
					function()
					{
						$('#pane4').append($('<p></p>').html($('#intro').html())).jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
					}
				);
				// and this allows you to click the link to reduce the amount of content in
				// #pane4 and reinitialise the scrollbars.
				$('#remove-content').bind(
					'click',
					function()
					{
						$('#pane4').empty().append($('<p></p>').html($('#intro').html())).jScrollPane({scrollbarWidth:20, scrollbarMargin:10});
					}
				);
	
	$(document).pngFix(); 
});

