//********* LK GR POPUP'I balang **********//

function kapat() {
    document.getElementById('PopupPencere').style.display = 'none';
    document.getElementById('PopupBg').style.display = 'none';
}

function dahagosterme() {
    document.getElementById('PopupPencere').style.display = 'none';
    document.getElementById('PopupBg').style.display = 'none';
    writeCookie('businessankara', 'dahagosterme', 30);
}

function BegenPencereKontrol() {
    var sonuc = readCookie('businessankara');

    if (sonuc != "dahagosterme") {
        document.getElementById('PopupPencere').style.display = 'inline';
        document.getElementById('PopupBg').style.display = 'inline';
    }
}

//********* LK GR POPUP'I biti **********//


//********* COOKE LEMLER balang **********//
function writeCookie(name, value, days) {
    //Fix Days 
    if (days == null || days == "") days = 365;

    // Set Date 
    var d = new Date();
    d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = "; expires=" + d.toGMTString();

    // Write Cookie 
    document.cookie = name + "=" + value + expires + "; path=/";
}

function readCookie(name) { // by .fm 
    var c = document.cookie;
    if (c.indexOf(name) != -1) {
        pos1 = c.indexOf("=", c.indexOf(name)) + 1;
        pos2 = c.indexOf(";", pos1);
        // If last cookie 
        if (pos2 == -1) pos2 = c.length; ;

        data = c.substring(pos1, pos2);
        return data;
    }
}
//********* COOKE LEMLER bitti **********//


/*

function getScrollY() {

    scrOfY = 0;

    if( typeof( window.pageYOffset ) == "number" ) {

        scrOfY = window.pageYOffset;

    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {

        scrOfY = document.body.scrollTop;

    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {

        scrOfY = document.documentElement.scrollTop;

    }

    return scrOfY;

}



// var $ = jQuery.noConflict();

bigtop = null





var upprev_closed = false;

var upprev_hidden = true;

//$("#upprev_box").stop().css({right:"-1000px"});



$(window).scroll(function() {

    //console.log("in $");

    var lastScreen = getScrollY() + $(window).height() < $(document).height() * 0.6 ? false : true;

    bigtop = lastScreen;

    if (lastScreen && !upprev_closed) {

        $("#upprev_box").stop().animate({right:"0px"});

        upprev_hidden = false;

    }

    else if (upprev_closed && getScrollY() == 0) {

        //upprev_closed = false;

    }

    else if (!upprev_hidden) {

        // upprev_hidden = true;

        $("#upprev_box").stop().animate({right:"-1000px"});

    }

});







$("#upprev_close").click(function() {

    $("#upprev_box").stop().animate({right:"-1000px"});

    // console.log($BTB.trackEvent("noslide"));

    upprev_closed = true;

    upprev_hidden = true;

});


*/




(function($){

  $.fn.equalBlocks = function() {

    var tallest = 0,

        rowStart = 0,

        items = [],

        $el,

        topPos = 0;

    

    $(this).each(function() {

      $el = $(this);

      topPos = $el.position().top;

      

      if (rowStart != topPos) {

        // we just came to a new row. Set all the heights on the completed row

        for (i = 0 ; i < items.length ; i++) {

          items[i].height(tallest);

        }

        

        // set the variables for the new row

        items.length = 0; // empty the array

        rowStart = topPos;

        tallest = $el.height();

        items.push($el);

      } else {

        // another item on the current row. Add it to the list and check if it's taller

        items.push($el);

        tallest = Math.max(tallest, $el.height());

      }

      

      // do the last row

      for (i = 0 ; i < items.length ; i++) {

        items[i].height(tallest);

      }

    });

  }

})(jQuery);



$(document).ready(function () {

	$('#slider2').bxSlider({

	  mode: 'fade',					   

	  auto: true,

	  pager: true,

	  pagerSelector:'.pagers',

	  pagerLocation:'bottom'

	});

	$('.haber,.phaber').equalBlocks();

	
$('#slider3').bxSlider({
mode: 'fade',
auto: true,
pager: true,
pagerSelector:'.pagerss',
pagerLocation:'bottom'
});
	

	var originalFontSize = $('.yazi p').css('font-size');

	// Reset Font Size

	$(".resetFont").click(function(){

	  $('.yazi p').css('font-size', originalFontSize);

	  

	});

	// Increase Font Size

	$(".increaseFont").click(function(){

	  var currentFontSize = $('.yazi p').css('font-size');

	  var currentFontSizeNum = parseFloat(currentFontSize, 12); // use styles for tags. {IE6 fix} (because tag font size do not change on IE6)

	  var newFontSize = currentFontSizeNum + 1;

	  if (newFontSize < 20) {

		$('.yazi p').css('font-size', newFontSize);

		

	  }

	  return false;

	});

	// Decrease Font Size

	$(".decreaseFont").click(function(){

	  var currentFontSize = $('.yazi p').css('font-size');

	  var currentFontSizeNum = parseFloat(currentFontSize, 12);

	  var newFontSize = currentFontSizeNum - 1;

	  if (newFontSize > 10) { // $(’html’).css(’font-size’, newFontSize); braces is an IE6 fix.

		  $('.yazi p').css('font-size', newFontSize);

		  

	  }

	  return false;

	});

	$(".galleri a").fancybox({'transitionIn'		: 'none',

			'transitionOut'		: 'none'

			

	});

});
