﻿
var setMenuTimeoutset = null;
var elm;
var vers = 110721;
function onlyLetter(e) {
	var InvalidChars = "!#/*{[()]},;%^><\\?+:='`|0123456789";
	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;
		}
	}
}
function onlyNumber(e) {
	var keyCode = ($.browser.mozilla) ? e.which : event.keyCode;
	if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 0) {
		return false;
	}
}
function mailTo(m, e, t) {
	if (!e) {
		e = 'MagiClick.com ';
	}
	if (!t) {
		t = m + String.fromCharCode(64) + e
	}
	document.write('<a href="mailto:' + m + String.fromCharCode(64) + e + '">' + t + '</a>');
}

var po_Win = {};

function PopItUp_po(src,w,h) {

	if (po_Win.close) {
		po_Win.close();
	}

	po_Win = window.open(src,"_blank","toolbar=0,width="+w+", height="+h+", location=0, directories=0, status=1, scrollbars=0, menubar=0, resizable=0, copyhistory=0");
	po_Win.focus();
}


$().ready(function() {
	$(".faqItem .faqTitle a").click(function() {
		var _index = $(".faqItem .faqTitle a").index(this);
		if ($(".faqItem").eq(_index).hasClass("active")) {
			$(".faqItem").eq(_index).removeClass("active")
			$(".faqItem .faqContent").eq(_index).slideUp("slow");
			return false;
		}
		$(".faqItem").each(function() {
			$(this).removeClass("active");
		})
		$(".faqContent").each(function() {
			$(this).slideUp("slow");
		})
		$(".faqItem").eq(_index).addClass("active");
		$(".faqItem .faqContent").eq(_index).slideToggle("slow");
		return false;
	})

	if (window.location.pathname == "/") {
		$("#logo a").removeAttr("href");
	}
	$(".hasSub img").each(function() {
		$(this).attr("change", $(this).attr("src").split(".gif")[0])
	})
	$("li.sublink").hover(function() {
		$(this).find(".hasSub img").attr("src", $(this).find(".hasSub img").attr("change") + "_ON.gif");
		$(this).find(".subMenu").show();
		var offs = $(this).offset();
		$(this).find(".subMenu").css("left",offs.left+"px")
		$(this).find(".subMenu").children('.subMenuContent').css({
			width: ($(window).width() - offs.left) - 18 + "px"
		});
	}, function() {
	$(this).find(".hasSub img").attr("src", $(this).find(".hasSub img").attr("change") + ".gif");
		$(this).find(".subMenu").hide();
	})

	$(window).bind("load resize")

	var rotatorInterval = null;
	var rotator = $(".image-navigation a");
	var rotatorIndex = 1;
	function ImageRotator() {
		if (rotatorIndex == rotator.size()) {
			rotatorIndex = 0;
		}
		rotator.removeClass("active");
		rotator.eq(rotatorIndex).addClass("active");
		$(".image-list img").fadeOut(500).eq(rotatorIndex).fadeIn(500);
		rotatorIndex++

	}
	rotatorInterval = setInterval(ImageRotator, 4000)
	rotator.click(function() {
		var _index = rotator.index(this);
		rotator.removeClass("active");
		$(this).addClass("active");
		$(".image-list img").fadeOut(500).eq(_index).fadeIn(500);
		rotatorIndex = _index + 1;
		return false;
	})
	$(".input-txt input").focus(function() {
		$(this).parents(".input-txt").addClass("active-state");
	})
	$(".input-txt input").blur(function() {
		$(this).parents(".input-txt").removeClass("active-state");
	})

		if ($("h3.baslik").height()!=28) {
			$("h3.baslik").addClass('baslik-tek');
		}


	$(function(){
		$(".accordeon").each(function(){
			 $(this).find("> .acc-content").each(function() {
				 var acCon = $(this);
				 acCon.find(".acc-link").click(function(){
					 acCon.next(".acc-hidden-content").toggleClass("acc-visible-content");
					 return false;
				 });
			 });
		});
	});


	$(function(){
		$("#right-menu li").each(function(){
			//var a = $(this).find("a");
			//var r = new RegExp( a.attr("href") + "$");
			//if (r.test(document.location)) {
				//$(this).addClass("selected");
				//$(this).parents('.menu-level').parent().addClass("selected");
				//return;
				var a = $(this).children("a");
				var tLink = a.attr("href");
				if(a.attr("rel")) {
					tLink = a.attr("rel");
				}
			var r = new RegExp( tLink + "$");
			var parts = document.location.pathname.split('/');
			var parts2 = tLink.split('/');
			if (document.location.href.indexOf(tLink) > -1 && parts2[parts2.length-1] == parts[parts.length-1]) {
				$(this).addClass("selected");
				$(this).parents('.menu-level').parent().addClass("selected");
				$(this).parents('.hidden').parent().addClass("selected");
				Cufon.refresh();
				return;
			}
		});



		$('#right-menu > .selected').each(function() {
			var menuLevel = $(this).children('.menu-level');

			if(menuLevel.length > 0) {
				$(this).children('a').addClass('border-none');

				menuLevel.find("li:last a").addClass('border-none');
				Cufon.refresh();
			}
		});


		$('#right-menu > li > a:last').addClass('border-none');


		var catsr = /^\/?(farki_yasa|kesfet|faydalan|rouge|black|pos)/i

		var cats = catsr.exec(document.location.pathname);

		if (cats != null) {		

			switch(cats[1]) {
				case "farki_yasa":
					$('.menu .farki-yasa').addClass ('farki-yasa-select');
				break;
				case "kesfet":
				case "rouge":
				case "black":
					$('.menu .kesfet').addClass ('kesfet-select');
				break;
				case "faydalan":
				case "pos":
					$('.menu .faydalan').addClass ('faydalan-select');
				break;
			}
		}


	});
})



   /**
   * jQuery.Preload
   * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
   * Dual licensed under MIT and GPL.
   * Date: 3/12/2008
   *
   * @projectDescription Multifunctional preloader
   * @author Ariel Flesler
   * @version 1.0.7
   */
   ; (function($) {

	var $preload = $.preload = function(original, settings) {
		if (original.split)//selector
			original = $(original);

		settings = $.extend({}, $preload.defaults, settings);
		var sources = $.map(original, function(source) {
			if (!source)
				return; //skip
			if (source.split)//URL Mode
				return settings.base + source + settings.ext;
			var url = source.src || source.href; //save the original source
			if (typeof settings.placeholder == 'string' && source.src)//Placeholder Mode, if it's an image, set it.
				source.src = settings.placeholder;
			if (url && settings.find)//Rollover mode
				url = url.replace(settings.find, settings.replace);
			return url || null; //skip if empty string
		});

		var data = {
			loaded: 0, //how many were loaded successfully
			failed: 0, //how many urls failed
			next: 0, //which one's the next image to load (index)
			done: 0, //how many urls were tried
			//found:false,//whether the last one was successful
			total: sources.length//how many images are being preloaded overall
		};

		if (!data.total)//nothing to preload
			return finish();

		var imgs = '<img/>', //ensure one
			thres = settings.threshold; //save a copy

		while (--thres > 0)//it could be oddly negative
			imgs += '<img/>';
		imgs = $(imgs).load(handler).error(handler).bind('abort', handler).each(fetch);

		function handler(e) {
			data.found = e.type == 'load';
			data.image = this.src;
			var orig = data.original = original[this.index];
			data[data.found ? 'loaded' : 'failed']++;
			data.done++;
			if (settings.placeholder && orig.src)//special case when on placeholder mode
				orig.src = data.found ? data.image : settings.notFound || orig.src;
			if (settings.onComplete)
				settings.onComplete(data);
			if (data.done < data.total)//let's continue
				fetch(0, this);
			else {//we are finished
				if (imgs.unbind)//sometimes IE gets here before finishing line 84
					imgs.unbind('load').unbind('error').unbind('abort'); //cleanup
				imgs = null;
				finish();
			}
		};
		function fetch(i, img, retry) {
			if ($.browser.msie && data.next && data.next % $preload.gap == 0 && !retry) {//IE problem, can't preload more than 15
				setTimeout(function() { fetch(i, img, true); }, 0);
				return false;
			}
			if (data.next == data.total) return false; //no more to fetch
			img.index = data.next; //save it, we'll need it.
			img.src = sources[data.next++];
			if (settings.onRequest) {
				data.image = img.src;
				data.original = original[data.next - 1];
				settings.onRequest(data);
			}
		};
		function finish() {
			if (settings.onFinish)
				settings.onFinish(data);
		};
	};

	// each time we load this amount and it's IE, we must rest for a while, make it lower if you get stack overflow.
	$preload.gap = 14;

	$preload.defaults = {
		threshold: 2, //how many images to load simultaneously
		base: '', //URL mode: a base url can be specified, it is prepended to all string urls
		ext: '', //URL mode:same as base, but it's appended after the original url.
		replace: ''//Rollover mode: replacement (can be left empty)
		/*
		find:null,//Rollover mode: a string or regex for the replacement
		notFound:''//Placeholder Mode: Optional url of an image to use when the original wasn't found
		placeholder:'',//Placeholder Mode: url of an image to set while loading
		onRequest:function( data ){ ... },//callback called every time a new url is requested
		onComplete:function( data ){ ... },//callback called every time a response is received(successful or not)
		onFinish:function( data ){ ... }//callback called after all the images were loaded(or failed)
		*/
	};

	$.fn.preload = function(settings) {
		$preload(this, settings);
		return this;
	};

   })(jQuery);

   /* HSBC JS */
   window.onload = function() {
	initForm();
}
   function initForm() {
	var i;
	var j;
	var frm;
	var elm;
	var val;

	for(i=0; i < document.forms.length; i++) {
		frm = document.forms[i];

		for(j=0; j < frm.elements.length; j++) {
			elm = frm.elements[j];

			if((elm.type == 'text' || elm.type == 'textarea') && elm.value != '') {
				if(!elm.alt) {
					elm.alt = elm.value;
				}

				elm.onblur = function() {
					if(this.value == '') {
						this.value = this.alt;
					}
				}

				elm.onfocus = function() {
					if(this.value == this.alt) {
						this.value = '';
					}
				}
			}
		}
	}
}


   function winopennew(x) {
	otherSiteInternetSube(x)

	/*if (x=="xfr") {   
		internetWindow();
	} else if (x=="bilgi") {  
		newFreeWindow('http://www.hsbc.com.tr/OnlineServisler/Bireysel/Bilgi.asp');
	} else if (x=="demo") {
		newWindow('http://www.hsbc.com.tr/OnlineServisler/Bireysel/Demo/','780','560');
	} else if (x=="guvenlik") {
		newWindow('http://www.hsbc.com.tr/Security.asp','780','560');
	} else if (x=="basvuru") {
		newFreeWindow('http://www.hsbc.com.tr/OnlineServisler/Bireysel/Basvuru.asp');
	} else if (x=="facebook") {
		newFreeWindow('http://www.avantajtoplamaca.com');
	}
	return;*/
}

function getCenter(pwidth,pheight){
	wwidth=screen.width;
	wheigth=screen.height;
	lpos= (wwidth - pwidth)/2;
	tpos= (wheigth - pheight)/2;
	return lpos, tpos;
}
function PopItUp(src,w,h,s) {
	if(s) w=w+17;
	getCenter(w,h);
	Popwin = window.open(src,"pop_up","toolbar=0,width=" + w + ", height=" + h + ", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=1, copyhistory=0");
	Popwin.focus();
	//return false;
}

function PopItUp_New(src,w,h,s) {
	getCenter(w,h);
	Popwin = window.open(src,"pop_up","toolbar=0,width=" + w + ", height=" + h + ", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=1, copyhistory=0");
	Popwin.focus();
	//return false;
}

function PopItUp_other(src,w,h,s) {
	if(s) w=w+17;
	getCenter(w,h);
	PopwinOther = window.open(src,"PopwinOther","toolbar=0,width=" + w + ", height=" + h + ", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=1, copyhistory=0");
	PopwinOther.focus();
	//return false;
}

function PopItUp_Return(src,w,h,s) {
	if(s) w=w+17;
	getCenter(w,h);
	Popwin = window.open(src,"pop_up","toolbar=0,width=" + w + ", height=" + h + ", left="+ lpos +", top="+ tpos +"; location=0, directories=0, status=1, scrollbars="+s+", menubar=0, resizable=1, copyhistory=0");
	Popwin.focus();
	return false;
}

function otherSiteLinks(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyari.asp?' + redirectionSite, w, h, 0);
	return false;
}

function otherSiteLinks(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyari.asp?' + redirectionSite, w, h, 0);
	return false;
}

function otherHSBCSiteLinks(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyariOtherHsbc.asp?' + redirectionSite, w, h, 0);
	return false;
}




function otherSiteLinksboyutlu(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_basvuru.asp?' + redirectionSite, w, h, 0);
	return false;
}


function otherSiteLinksboyutlu_2(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_basvuru_ck.asp?' + redirectionSite, w, h, 0);
	return false;
}




function nonHSBCSiteLinks(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyari_nh.asp?' + redirectionSite, w, h, 0);
	return false;
}

function nonHSBCSiteLinksTR(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyari_tr.asp?' + redirectionSite, w, h, 0);
	return false;
}


function nonHSBCSiteLinks_2(redirectionSite){
//blank page
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyari_nh.asp?' + redirectionSite, w, h, 0);
}



function otherSiteInternetSube(openparameter){
//internet subesi
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp('/pop_uyari_internet_bankaciligi.asp?' + openparameter, w, h, 0);
	return false;
}

function otherSiteBasvuru(gelen){
//internet subesi
	w="586";
	h="530"
	getCenter(w,h);
	PopItUp(gelen, w, h, 0);
	return false;
}

var DWin 
	function bireysel_int(url,name){	
		DWin = window.open(url,name,"toolbar=0,top=0,left=0,width=777,height=570,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1"); 
	}

	function DemirWin_2(url,name){

	}



	var DWin 
	function kurumsal_int(url,name){	
		DWin = window.open(url,name,"toolbar=0,top=0,left=0,width=777,height=570,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1"); 
	}	




	function getUrl(url,target) {
		if(url=='blank') return false;
		if(target && target=='blank') window.open(url);
	else document.location.href=url;
	  }




function pageType(type){

						var myContainer = document.getElementById("sright")
						if (type =="small"){
							myContainer.className = "sright";
						}
						else if(type =="big"){

							myContainer.className = "sRight_big";
						}

			}

function msignKWindow() //m-Sign için gerekli pencereyi açar.
{
var scrwidth=(screen.width>1000 ? 785:790); var scrheight=(screen.height>800 ? 608:522); var CWin = window.open("https://kurumsal.hsbc.com.tr/TUR/MSGNOR_01.asp","MsignB","toolbar=0,top=0,left=0,width="+scrwidth+",height="+scrheight+",location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1,dependent=0");
}


function msignWindow() //m-Sign için gerekli pencereyi açar.
{
var scrwidth=(screen.width>1000 ? 785:790); var scrheight=(screen.height>800 ? 608:522); var CWin = window.open("https://kurumsal.hsbc.com.tr/TUR/MSGNAP_01.asp","Msign","toolbar=0,top=0,left=0,width="+scrwidth+",height="+scrheight+",location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1,dependent=0");
}


function newWindow(url,width,height) //Yeni pencere açar.
{
	day = new Date();
	id = day.getTime();
	PageName="Page"+id
	PageName = window.open(url,id,"toolbar=0,top=0,left=0,width="+width+",height="+height+",location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=0"); 
}

function internetWindow() //İnternet Bankacılığı için gerekli pencereyi açar.
{
	var url="https://bireysel.hsbc.com.tr/TUR"
	var DWin = window.open(url,"HSBCNET","toolbar=0,top=0,left=0,width=798,height=555,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1"); 
}

function winopenKK(x,s)
{
	var strRf = s ;     //Url'e eklenecek strRef değişkeni

	var url="https://bireysel.hsbc.com.tr/TUR/transactions/CAPPLY_01.asp?strRef="+ strRf
	var DWin = window.open(url,"BASVURUFORMU","toolbar=0,top=0,left=0,width=785,height=555,location=0,directories=0,status=1,menubar=0,scrollbars=1,resizable=1,copyhistory=1");

}





