﻿
(function ($) {
    $.fn.panpaMultiSlider = function (options) {
        var settings = {
            '$slideElement': 'ul', //
            '$speed': 500, // hýz ayarý
            '$fadeDuration': 1000,
            '$slideType': 'slide', // slide or fade
            '$easing': 'linear' // easing kullanýlmayacaksa linear seçilmeli
        };
        var options = $.extend(settings, options);
        return this.each(function () {
            var object = $(this);
            var $currentindex = 0;
            var $size = $(options.$slideElement, object).find("> li").size();
            var $index = $(options.$slideElement, object).find("> li").index();
            var $width = $(options.$slideElement, object).find("> li").outerWidth()
            var isBusy = false;
            function Render(control) {
                if ($currentindex < 0) {
                    $currentindex = $size - 1;
                }
                else if ($currentindex > ($size - 1)) {
                    $currentindex = 0;
                }
                var calcStep = -1 * $width * $currentindex;
                if (options.$slideType == "slide") {
                    $(options.$slideElement, object).css("width", $size * $width)
                    $(options.$slideElement, object).animate({ "left": calcStep }, options.$speed, options.$easing, function () { isBusy = false; });
                }
                if (options.$slideType == "fade") {
                    $(options.$slideElement, object).find("> li").css("position", "absolute")
                    var currentFade = $(options.$slideElement, object).find("> li").eq($currentindex);
                   // var captionHeight = $(options.$slideElement, object).find("> div div").outerHeight();
                    $(options.$slideElement, object).find("> li").animate({ "opacity": 0 })
                  //  $(options.$slideElement, object).find("> div div").animate({ "bottom": "-"+captionHeight+"px" })
                    $(currentFade).animate({ "opacity": 1 }, options.$fadeDuration, function () { isBusy = false; $(currentFade).find("li").animate({ "bottom": "0" }) })
                }
            }
            $currentindex = 0;
            Render(null);
            function next() {
                if (isBusy == true)
                { return; }
                isBusy = true;
                $currentindex++;
                Render("R");
            };
            function previous() {
                if (isBusy == true)
                { return; }
                isBusy = true;
                $currentindex--;
                Render("L");
            };

            $(".prev", object).click(function () {
                previous();
																
            });
            $(".next", object).click(function () {
                next();
            });
        });
    };
})(jQuery);

$(document).ready(function(){
$("li#bireyselLink").hover(function(){
		$("ul#bireyselSub").css("display","block");
		$("a#hBireysel").addClass("hover");	
},function(){
	$("ul#bireyselSub").css("display","none");
	$("a#hBireysel").removeClass("hover");
});


$("li#bizLink").hover(function(){
		$("ul#bizSub").css("display","block");
		$("a#hBiz").addClass("hover");	
},function(){
	$("ul#bizSub").css("display","none");
	$("a#hBiz").removeClass("hover");
});
 $("#tickerSide").panpaMultiSlider({
        '$slideType': 'slide',
        '$pagination': true,
        '$fadeDuration': 1000,
        '$slideElement': 'ul'
    });

$("#two li a").hover(function(){
var relChk = $(this).attr("rel")
$("#twoDisplay").html('<img src="'+relChk+'"/>')
})
$("#twoDisplay").html('<img src="'+$("#two li a:first").attr("rel")+'"/>');


// TAB MENU
$("#three ul a").hover(function() {
   $("#three ul a").removeClass("selected");
   $(this).addClass("selected");
   $("#three > div#threeDisplay div").hide();
   var activeTab = $(this).attr("href");
   $(activeTab).show();
   return false;
});
$("#three > div#threeDisplay div").hide();
$("#three ul a:first").addClass("selected").show();
$("#three > div#threeDisplay div:first").show();

$("#otherWebSite").hover(function (){
	$("#otherWebSite > div").fadeIn(250);				
}, function(){$("#otherWebSite > div").fadeOut(150);})

$("#otherWebSiteEn").hover(function (){
	$("#otherWebSiteEn > div").fadeIn(250);				
}, function(){$("#otherWebSiteEn > div").fadeOut(150);})


var timeId;
$('#facebook').hover(
 function() {
	$('#facebook-likebox').fadeIn('fast');
 },
 function() {
	timeId = setTimeout(ShowLikebox, 500);
 }
);
$('.facebook').click(function() {
 window.open("http://www.facebook.com/avea");			
});

function ShowLikebox() {
 $('#facebook-likebox').fadeOut('fast');
}
$('#facebook-likebox').hover(function() {
	clearTimeout(timeId);
	$(this).show();
},function() {
	ShowLikebox();
});

$("#mpFooter #footerNav li a:first").css("border","none")

$("#mpFooterMain #footerNavMain li a:first").css("border","none")

if($.browser.msie && $.browser.version=="8.0"){
$("#threeDisplay #t1 p ").css("float","none");

}



});
