/* $$$
   $$$    BROWSER DETECT
   $$$
*/

function Browser(){
	var ua = navigator.userAgent.toLowerCase(); 
	this.Gecko = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
	this.Safari = (ua.indexOf('safari') != - 1);
	this.IE = (ua.indexOf('msie') != -1 && !this.Opera && (ua.indexOf('webtv') == -1) ); 
	this.Firefox = ( (ua.indexOf('firebird/') != -1) || (ua.indexOf('firefox/') != -1) );
	this.IECompatible = ( (ua.indexOf('msie') != -1) && !this.IE);
	this.NSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.NS && !this.Mozilla);
	this.geckoVersion = ( (this.Gecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
	this.equivalentMozilla = ( (this.Gecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
	this.versionMinor = parseFloat(navigator.appVersion); 
	if (this.Gecko && !this.Mozilla) this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
	else if (this.Mozilla) this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
	else if (this.IE && this.versionMinor >= 4) this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
	else if (this.Safari) this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
	this.versionMajor = parseInt(this.versionMinor); 
	this.DOM1 = (document.getElementById);
	this.DOM2Event = (document.addEventListener && document.removeEventListener);
	this.mode = document.compatMode ? document.compatMode : 'BackCompat';
	this.Win = (ua.indexOf('win') != -1);
	this.Mac = (ua.indexOf('mac') != -1);
	this.NS6up = (this.NS && this.versionMajor >= 6);
	this.NS7up = (this.NS && this.versionMajor >= 7); 
	this.IE4 = (this.IE && this.versionMajor == 4);
	this.IE5 = (this.IE && this.versionMajor == 5);
	this.IE55 = (this.IE && this.versionMinor == 5.5);
	this.IE5up = (this.IE && this.versionMajor >= 5);
	this.IE6x = (this.IE && this.versionMajor == 6);
	this.IE6up = (this.IE && this.versionMajor >= 6);
}
var is = new Browser();

/* $$$
   $$$    POPUPS
   $$$
*/

var Popwin = null;

function intBankCheck(){
    var checkIntBanking = setInterval(function(){
        if(Popwin!=null && Popwin.closed){
            clearInterval(checkIntBanking);
            document.location.reload();
        }
    },1200);
} 

function PopItUp(src,w,h,s) {
	if(s) w=w+17;
	if(w){
	    Popwin = window.open(src,"pop_up","toolbar=0,width=" + w + ", height=" + h + ", location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=0, copyhistory=0");
	    Popwin.focus();
	}
	else {
	    window.location = src
	}
}



function PopItUp_Fixed(src) {
	Popwin = window.open(src,"pop_up","toolbar=0, width=600, height=600, location=0, directories=0, status=1, scrollbars=1, menubar=0, resizable=0, copyhistory=0");
	Popwin.focus();
}

function PopItUpResize(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 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=1,menubar=0,scrollbars=yes,resizable=1,copyhistory=1");
	    if (Popwin != null) {
	        Popwin.focus();
	    }
}



function externalSite(src){
	var externalSite = window.open(src);
	externalSite.focus();
}


function PopItUp2(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();
}

/* $$$
   $$$    WINDOW HEIGHT
   $$$
*/


function getWindowHeight(){
	var windowHeight = 0;
	if(typeof(window.innerHeight) == 'number'){
		windowHeight = window.innerHeight;
	}else{
		if(document.documentElement && document.documentElement.clientHeight){
			windowHeight = document.documentElement.clientHeight;
		}else{
			if(document.body && document.body.clientHeight){
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

/* $$$
   $$$    WINDOW WIDTH
   $$$
*/

function getWindowWidth(){
	var windowWidth = 0;
	if(typeof(window.innerWidth) == 'number'){
		windowWidth = window.innerWidth;
	}else{
		if(document.documentElement && document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth;
		}else{
			if(document.body && document.body.clientWidth){
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

/* $$$
   $$$    FOOTER
   $$$
*/

function setFooter(){

	if (document.getElementById){
		var windowHeight = getWindowHeight();
		if (windowHeight>0){

			var wrapperHeight = document.getElementById('wrapper').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (wrapperHeight)>= 73) {
				footerElement.style.marginTop = (windowHeight - (wrapperHeight))-73  + 'px';
				//alert((windowHeight - (wrapperHeight))-43  + 'px')
			}else{
				
			}

		}
	}
	
}


/* $$$
   $$$    MAIL ENCODE
   $$$
*/

function mailTo(m,e,t) {
	if (!e) {
		e='finansbank.com.tr';
	}
	if (!t) {
		t=m+String.fromCharCode(64)+e;
	}
	
	document.write('<a href="mailto:'+m+String.fromCharCode(64)+e+'" class="contentlink">'+t+'</a>');
}

/* $$$
   $$$    INPUT CONTROLS
   $$$
*/

function onlyLetter(e) {
	var keyCode = (is.ns) ? e.which : event.keyCode;
	if (keyCode > 47 && keyCode<58){
	return false;}
}

function onlyNumber(e) {
	var keyCode = (is.ns) ? 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 = (is.ns) ? 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 stopt(){
    
}

function KontrolMaxlength(t,l) {
if (document.getElementById(t).value.length >= l)
    {
        document.getElementById(t).value = document.getElementById(t).value.substr(0,l);
        return false;
    }
}

/* $$$
   $$$    INPUT AUTOFOCUS
   $$$
*/

function autofocus(field, limit, next, evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
    if (charCode > 31 && field.value.length == limit) {
        field.form.elements[next].focus();
    }
}



function init(){
	/*if (!document.getElementsByTagName) return;
	imgArray = document.getElementsByTagName("img");
		for (i=0;i<imgArray.length;i++){
			if(imgArray[i].alt!=-1) imgArray[i].title=imgArray[i].alt;
		}
	aArray = document.getElementsByTagName("a");
		for (i=0;i<aArray.length;i++){
			if(aArray[i] && aArray[i].href && !aArray[i].title && aArray[i].childNodes[0])	aArray[i].title = aArray[i].childNodes[0].nodeValue;
		}*/
}


function delCookie(name) {
	createCookie(name,"",-1);
}

function intSube(ref){
    if(ref){
    PopSube('/redirect/internet-subesi.aspx'+ref+' ',1000,599)
    }
    else {
    var fbURL = window.location.pathname;
    PopSube('/redirect/internet-subesi.aspx?FB_URL='+fbURL,1000,599)
    }
}

function intSubeFlash(ref){
    intSube(ref);
    intBankCheck();
}

function hizliLogininPopUp(ref){
    if(ref){
    PopSube('/redirect/hb-aninda-sifre.aspx',600,650)
    }
    else {
    var fbURL = window.location.pathname;
    PopSube('/redirect/hb-aninda-sifre.aspx?FB_URL='+fbURL,600,650)
    }
}

function intSubeEN(ref){
    if(ref){
        PopSube('/redirect/internet-banking.aspx',1000,584)
    }
    else {
        var fbURL = window.location.pathname;
        PopSube('/redirect/internet-banking.aspx?FB_URL='+fbURL,1000,584)
    }
}

function hizliLogin(ref){
    if(ref){
        PopItUp('/redirect/hb-aninda-sifre.aspx' + ref,600,650)
    }
    else {
        var fbURL = window.location.pathname;
        PopItUp('/redirect/hb-aninda-sifre.aspx?FB_URL='+fbURL,600,650)
    }
}
function anindaKredi(ref){
    if(ref){
	  PopItUp('/redirect/hb-aninda-kredi.aspx'+ ref +' ',593,700,1)
    }
    else {
        var fbURL = window.location.pathname;
		PopItUp('/redirect/hb-aninda-kredi.aspx?FB_URL='+fbURL,593,700,1)
    }
}
function anindaKart(ref){
    if(ref){
        PopItUp('/redirect/hb-cardfinans.aspx'+ref,720,480,1)
    }
    else {
        var fbURL = window.location.pathname;
        PopItUp('/redirect/hb-cardfinans.aspx?FB_URL='+fbURL,720,480,1)
    }
}
function ortakMarkaliKartlar(ref){
    if(ref){
        PopItUp('http://www.cardfinans.com.tr/cardfinans-ile-tanisin/popup/hizli-kart-basvurusu-ortak-markali-kartlar.aspx'+ref,750,742,1)
    }
    else {
        var fbURL = window.location.pathname;
        PopItUp('http://www.cardfinans.com.tr/cardfinans-ile-tanisin/popup/hizli-kart-basvurusu-ortak-markali-kartlar.aspx?FB_URL='+fbURL,750,742,1)
    }
}
function eEkstre(ref){
    if(ref){
        PopItUp('/redirect/hb-webden-eekstre.aspx',609,690,1)
    }
    else {
        var fbURL = window.location.pathname;
        PopItUp('/redirect/hb-webden-eekstre.aspx?FB_URL='+fbURL,609,690,1)
    }
}
function anindaSifre(ref){
    if(ref){
        PopItUp('/redirect/hb-aninda-sifre.aspx' + ref,600,650,1)
    }
    else {
        var fbURL = window.location.pathname;
        PopItUp('/redirect/hb-aninda-sifre.aspx?FB_URL='+fbURL,600,650,1)
    }
}
function anindaSifre2(ref){
    if(ref){
        PopItUp('/redirect/as-aninda-sifre.aspx',600,650,1)
    }
    else {
        var fbURL = window.location.pathname;
        PopItUp('/redirect/as-aninda-sifre.aspx?FB_URL='+fbURL,600,650,1)
    }
}
/* $$$
   $$$    ONLOAD - ONRESIZE
   $$$
*/

