﻿jQuery.fn.extend({
    scrollTo: function(speed, easing) {
        return this.each(function() {
            var targetOffset = $(this).offset().top;
            $('html,body').animate({ scrollTop: targetOffset }, speed, easing);
        });
    }
});

$(document).ready(function() {
            
    $("#links").hover(
        function() {
            $("#links .linksContent").stop().animate({ top: "-131px", height: "120px" }, 200);
        },
        function() {
            $("#links .linksContent").stop().animate({ top: "0px", height: "0px" }, 200);
        });

    $(".menu li:last").addClass("nonBorder");

    $(".menuItem").hover(
        function() {
            var imageName = $(this).find("img").attr("src");
            var overName = imageName.split("-off.")[0];
            $(this).find("img").attr({ src: "" + overName + "-on.gif" });
            $(this).stop().animate({ paddingLeft: "15px", backgroundColor: "#b9112b" }, 100);
        },
        function() {
            var imageName = $(this).find("img").attr("src");
            var overName = imageName.split("-on.")[0];
            $(this).find("img").attr({ src: "" + overName + "-off.gif" });
            $(this).stop().animate({ paddingLeft: "0", backgroundColor: "#fff" }, 100);
        });
        
    $(".menuRoll").hover(
        function() {
            $("img", this).stop().animate({ top: "-45px", backgroundColor: "#474747" }, { queue: false, duration: 100 });
        }, function() {
            $("img", this).stop().animate({ top: "0px", backgroundColor: "#b9112b" }, { queue: false, duration: 100 });
        });
        
    $(".RollBasin").hover(
        function() {
            $("img", this).stop().animate({ top: "-79px", backgroundColor: "#b9112b" }, { queue: false, duration: 200 });
        }, function() {
            $("img", this).stop().animate({ top: "0px", backgroundColor: "#000" }, { queue: false, duration: 200 });
        });           

        
    $(".menuRollHome").hover(
        function() {
            $("img", this).stop().animate({ top: "-30px", backgroundColor: "#2a2a2a" }, { queue: false, duration: 100 });
        }, function() {
            $("img", this).stop().animate({ top: "0px", backgroundColor: "#474747" }, { queue: false, duration: 100 });
        });

    $(".table tr td").each(function() {
        $(".table tr td:first-child").addClass("nonBorder");
    });

    $(".table tr:even").addClass("tableEven");


    $(".breadCrumb span a:first").addClass("breadCrumbFirst");
    
    $(".breadCrumb span:not(.selected)").hover(
        function() {
            $(this).addClass("breadCrumbHover");
        }, function() {
           $(this).removeClass("breadCrumbHover");
        });
    
        $(".kampanyaCont:even").css("margin-left","0");

      $(".kampanyaCont").each(function(i){
        if(i%2 == 0){
            if($(this).find(".kampanyaText").height() > $(this).next().find(".kampanyaText").height()){
                $(this).next().find(".kampanyaText").css("height",$(this).find(".kampanyaText").height()+"px");
            }else {
                $(this).find(".kampanyaText").css("height",$(this).next().find(".kampanyaText").height())
            }
        }
      });
      
      $(".breadCrumb span.selected a").removeAttr("href");
      
      $(".blindClick").click(function(){
        $(this).parent().next("div.blindContent").slideToggle("fast");
        $(this).scrollTo();
      });
      
      $(window).bind("load resize",function(){
          var pagePageLeft = $(".pageLeft").height() + 90;
          var pagePageRight =  $(".pageRight").height();
          
          if ( pagePageLeft >= pagePageRight ) {
            $(".pageRight").css("padding-bottom", pagePageLeft - pagePageRight);
          }
      });
      
});

function PopItUp(src, w, h, s) {
    if (s) w = w + 17;
    Popwin = window.open(src, "pop_up", "toolbar=0,width=" + w + ", height=" + h + ", location=0, directories=0, status=1, scrollbars=" + s + ", menubar=0, resizable=1, copyhistory=0");
    Popwin.focus();

}

function SitemapATM(src, w, h, s) {
    if (s) w = w + 17;
    Popwin = window.open('http://www.finansbank.com.tr/finansbank-atm-ve-subeler/default.aspx');
    Popwin.focus();

}

function PopItUp2(src, w, h, s) {
    if (s) w = w + 17;
    Popwin = window.open(src, "pop_up2", "toolbar=0,width=" + w + ", height=" + h + ", location=0, directories=0, status=1, scrollbars=" + s + ", menubar=0, resizable=1, copyhistory=0");
    Popwin.focus();

}

function PopItUp3(src, w, h, s) {
    if (s) w = w + 17;
    Popwin = window.open(src, "pop_up3", "toolbar=0,width=" + w + ", height=" + h + ", location=0, directories=0, status=1, scrollbars=" + s + ", menubar=0, resizable=1, copyhistory=0");
    Popwin.focus();

}

function PopSube(src, w, h, s, r, hi) {
    if (s) w = w + 17;
    Popwin = window.open(src, "FWFINTBANK", "width=" + w + ",height=" + h + ",top=0,left=0,toolbar=0,location=0,address=no, directories=0,status=0,menubar=0,scrollbars=yes,resizable=1,copyhistory=1");
    Popwin.focus();
}

function intBank(ref) {
    if (ref) {
    	PopSube('https://intbank.finansbank.com.tr/FWF/login.jsp' + ref + ' ', 1000, 599);
    }
    else {
    	PopSube('https://intbank.finansbank.com.tr/FWF/login.jsp', 1000, 599);
    }
}


function eEkstre(ref){
    if(ref){
        PopItUp(webRoot + 'https://e-ekstre.finansbank.com.tr/EEKSTRE/eekstre.jsp?lang=tr&loginPage=EEKSTRELOGIN&type=br'+ref,620,690,1);
    }
    else {
        PopItUp(webRoot + 'https://e-ekstre.finansbank.com.tr/EEKSTRE/eekstre.jsp?lang=tr&loginPage=EEKSTRELOGIN&type=br',620,690,1);
    }
}


function anindaSifre() {
        PopItUp3("https://internetkolay.finansbank.com.tr/HBASVURU/hizlibasvuru.jsp?lang=tr&loginPage=HIZLILOGIN&type=br", 610, 680, 0);
}

function fixOnlinePopup() {
        PopItUp2("/yonlendirme/fix-online.aspx", 524, 360, 1);
}

function onlyNumber(e) {
    var keyCode = ($.browser.mozilla) ? e.which : event.keyCode;
    if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 0) {
        return false;
    }
}

function onlyEmail(e) {
    var InvalidChars = " !#/*{[()]},;%^><\\?+:='`|şŞĞğÜüÇçİıÖö";

    kCode = InvalidChars.charAt(5);

    var keyCode = ($.browser.mozilla) ? e.which : event.keyCode;

    if (keyCode > 127) {
        return false;
    }
    for (i = 0; i <= InvalidChars.length - 1; i++) {
        if (keyCode == InvalidChars.charCodeAt(i)) {
            return false;
        }
    }
    return true;
} 

function onlyLetter(e) {
        var InvalidChars = "!#/*{[()]},;%^><\\?+:='`|&-_";

        var keyCode = ($.browser.mozilla) ? e.which : event.keyCode;

        if (keyCode > 47 && keyCode < 58) {
            return false;
        }
        for (i = 0; i <= InvalidChars.length - 1; i++) {
            if (keyCode == InvalidChars.charCodeAt(i)) {
                return false;
            }
        }
}

		var URL = location.href
		function querySt(ji) {
			hu = window.location.search.substring(1);
			gy = hu.split("&");
			for (i=0;i<gy.length;i++) {
				ft = gy[i].split("=");
				if (ft[0] == ji) {
					return ft[1];
				}
			}
		}
		var introStatus = querySt("intro");
		if(introStatus == "" || introStatus == undefined){
			introStatus = true;
		}
        
        function homeFormShow() {
            $("#homeForm").fadeIn(1000);
        };
        
        function CallTanitimPopup(){
            PopItUp('/tanitim.aspx',670,745,1);
        }        
