$(document).ready(function(){  

$("a[rel=new]").attr('target','_blank');
$("#uyelink").colorbox({inline:true, href:"#uyeol"});
$("#sifrelink").colorbox({inline:true, href:"#sifre-hatirlat"});
$("#smslink").colorbox({inline:true, href:"#sms-iptal"});
$("#webtellink").colorbox({inline:true, href:"#web-telefonu"});
$(".userframe").colorbox({width:"60%", height:"80%", iframe:true});
$(".sifreframe").colorbox({width:"60%", height:"80%", iframe:true});
$(".testframe").colorbox({width:"60%", height:"80%", iframe:true});
$(".frame").colorbox({width:"60%", height:"80%", iframe:true});


// Wave Fade
  waveFade();      
  
	// The default axis is 'y', but in this demo, I want to scroll both
	// You can modify any default like this
	// $.localScroll.defaults.axis = 'xy';
	$.localScroll.defaults.axis = 'x';
	
	// Scroll initially if there's a hash (#something) in the url 
	$.localScroll.hash({
		target: '#outer', // Could be a selector or a jQuery object too.
		queue:true,
		duration:1500
	});
	
	/**
	 * NOTE: I use $.localScroll instead of $('#navigation').localScroll() so I
	 * also affect the >> and << links. I want every link in the page to scroll.
	 */
	$.localScroll({
		target: '#outer', // could be a selector or a jQuery object too.
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){
			// The 'this' is the settings object, can be modified
		},
		onAfter:function( anchor, settings ){
			// The 'this' contains the scrolled element (#content)
		}
	}); // Local scroller end


// Login inputs
$('.loginput').focus(function() {
	$(this).removeClass("user-input").removeClass("pass-input");
});       



//Menu effect

$("ul.thumb li").hover(
  function () {
    var theId = $(this).find('img').attr('id');
    $('#'+theId).attr('src', 'images/menu/'+theId+'_h.png');
    
    $('#'+theId).animate({
      marginTop: '+=5'
    }, 150, function() {
      // Animation complete. 
    });
       
  },
  function () {
    var theId = $(this).find('img').attr('id');       
    $('#'+theId).attr('src', 'images/menu/'+theId+'.png');
       $('#'+theId).animate({
          marginTop: '-=5'
        }, 300, function() {
          // Animation complete.  
          
        });                       
   
  });
  
  
// Show / Hide back
  $('.sback').click(function() {
    $("#sback").fadeOut('fast');
    $(".answer").slideUp();
    $("#sss li").delay(200).slideDown();
  });     
  

}); // doc ready end   
     

// Fade animation loop     
var loop = 1;  
function waveFade(){ 
  $('.wave').fadeIn(300, function(){          
    
   if(loop >= "50") {       
     // alert("animasyon tamam");
   
      $('#wave1').fadeIn(100);
      $('#wave2').fadeIn(200);
      $('#wave3').fadeIn(300);
      $('#wave4').fadeIn(400);
   } 
         
   else { 
  
    setTimeout(function(){
      $('#wave1').delay(100).fadeIn(300).fadeOut(400);
      $('#wave2').delay(200).fadeIn(300).fadeOut(400);
      $('#wave3').delay(300).fadeIn(300).fadeOut(500);
      $('#wave4').delay(400).fadeIn(300).fadeOut(600);
      
      $('#sms1').delay(100).fadeIn(300).fadeOut(100);
      $('#sms2').delay(200).fadeIn(300).fadeOut(200);
      $('#sms3').delay(300).fadeIn(300).fadeOut(300);
      $('#sms4').delay(400).fadeIn(300).fadeOut(400);
      $('#sms5').delay(500).fadeIn(300).fadeOut(500);
      $('#sms6').delay(600).fadeIn(300).fadeOut(600);
      $('#sms7').delay(700).fadeIn(300).fadeOut(700);
      $('#sms8').delay(800).fadeIn(300).fadeOut(800, waveFade);   
           
      loop++;                            
      
     },300);  
    
    }             
    
  });
  
// Arrows
$(".top-menu").hover(     
  function () {
    var scrWidth = $(document).width();     
    if(scrWidth>=1086) {   
     // alert(scrWidth);    
      $('#arrow-l').fadeIn();
      $('#arrow-r').fadeIn();
    }
  },
  function () {
    $('#arrow-l').fadeOut();
    $('#arrow-r').fadeOut();
  });  
  
}     

// Bg switcher
function changeBg(theBg){
  $("body").css("background-image", "url(images/bg-"+theBg+".jpg)");   
} 


//SAG scroller (PDA)
var sagscroller=new sagscroller({
  id:'pda-scroll',
  mode: 'auto',
  pause: 1600,
  animatespeed: 400 //<--no comma following last option
})

 
// Show - Hide
  function showMe(theId) {    
    if($("#ans"+theId).is(':hidden')) {
      $("#sss li").fadeOut('fast');
      $("#li"+theId).slideDown();
      $("#ans"+theId).delay(600).fadeIn();
      $("#sback").delay(600).fadeIn();
    }
    else {
      $("#sback").fadeOut('fast');
      $("#ans"+theId).slideUp();
      $("#sss li").delay(200).slideDown();        
    } 
  }  
