var myOrientArr = new Array();

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();

var flashVersion = 0;
function getFlashVersion() {
	var latestFlashVersion = 25;
	var agent = navigator.userAgent.toLowerCase(); 
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object'){ 
			for (var i = latestFlashVersion; i >= 3; i--){
	            if (flashPlugin.description.indexOf(i + '.') != -1){
	               flashVersion = i;
	               break;
	            }
			}
		}
	}
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
		var doc = ''+
			'<scr' + 'ipt language="VBScript"\> \n'+
			'On Error Resume Next \n'+
			'Dim obFlash \n'+
			'For i = ' + latestFlashVersion + ' To 3 Step -1 \n'+
			'	Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n'+
			'	If IsObject(obFlash) Then \n'+
			'		flashVersion = i \n'+
			'		Exit For \n'+
			'	End If \n'+
			'Next \n'+
			'</scr' + 'ipt\> \n';
		document.write(doc);
	} else {flashVersion = flashVersion_DONTKNOW; }
return flashVersion;
}
var flashVersion_DONTKNOW = -1;
function FlashObject(){
	this.ID=this.ID;
	this.maxVersion=this.maxVersion;
	this.SwfFile;
	this.minVersion;
	this.altSwfFile;
	this.altImage;
	this.altImageAddAtribute;
	this.altImageHTML;
	this.width;
	this.height;
	this.menu;
	this.background;
	this.wmode;
	this.flashvars;
	this.scale;
	this.salign;
}
FlashObject.prototype.rnd=function(){
	this.ranNum= Math.random()*255;
    return this.ranNum;
}
FlashObject.prototype.embed=function(){
	var buff;
	if(getFlashVersion()>=this.maxVersion){
		
		buff=''+
			'<OBJECT ID="'+this.ID+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+this.width+' HEIGHT='+this.height+'><PARAM NAME=movie VALUE="'+this.SwfFile+'"><PARAM NAME=menu VALUE='+this.menu+'><param name="wmode" value="'+this.wmode+'"><PARAM NAME="quality" VALUE="high"><PARAM NAME="flashvars" VALUE="'+ this.flashvars +'"><PARAM NAME="bgcolor" VALUE="'+this.background+'"><PARAM NAME="scale" VALUE="'+this.scale+'"><PARAM NAME="salign" VALUE="'+this.salign+'">'+
				'<EMBED name="'+this.ID+'" src="'+this.SwfFile+'" menu="'+this.menu+'" wmode="'+this.wmode+'" quality="high" bgcolor="'+this.background+'"  WIDTH="'+this.width+'" HEIGHT="'+this.height+'" scale="'+this.scale+'" salign="'+this.salign+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveConnect="true"></EMBED>'+
			'</OBJECT>';
	}else if((getFlashVersion()> this.minVersion) && (getFlashVersion()< this.maxVersion) && this.altSwfFile){
		
		buff=''+
			'<OBJECT ID="'+this.ID+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" WIDTH='+this.width+' HEIGHT='+this.height+'><PARAM NAME=movie VALUE="'+this.altSwfFile+'"><PARAM NAME=menu VALUE='+this.menu+'<param name="wmode" value="'+this.wmode+'">><PARAM NAME="quality" VALUE="high"><PARAM NAME="bgcolor" VALUE='+this.background+'>'+
				'<EMBED flashvars="'+ this.flashvars +'" name="'+this.ID+'" src="'+this.altSwfFile+'" menu="'+this.menu+'" wmode="'+this.wmode+'" quality=high bgcolor='+this.background+'  WIDTH='+this.width+' HEIGHT='+this.height+' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" swLiveConnect="true"></EMBED>'+
			'</OBJECT>';
	}else{
		this.altImageAddAtribute ? (buff='<img src="'+this.altImage+'" width="'+this.width+'" height="'+this.height+'" border="0" '+this.altImageAddAtribute+' />'+this.altImageHTML) : (buff='<img src="'+this.altImage+'" width="'+this.width+'" height="'+this.height+'" border="0" />');
	}
	document.write(buff);
}



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 externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external"){
			anchor.target = "_blank";
		}
	}
}

function extWin(src){
	ExtWin = window.open(src);
	ExtWin.focus();
	return false;
}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i]
		if (anchor.href && anchor.rel == "external" ){
			anchor.target="_blank";
		}
	}
}

function getCenter(pwidth,pheight){
	wwidth=screen.width;
	wheigth=screen.height;
	lpos= (wwidth - pwidth)/2;
	tpos= (wheigth - pheight)/2;
	return lpos, tpos;sd/'';
}


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_noresize(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=0, copyhistory=0");
	Popwin.focus();
	//return false;
}

function PopItUpReturn(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=0, copyhistory=0");
	
	Popwin.focus();
	return false;
}


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;
}


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 + footerHeight)>= 0) {
				footerElement.style.marginTop = (windowHeight - (wrapperHeight+footerHeight)) + 'px';
			}else{
				footerElement.style.marginTop = '0';
			}
		}
	}
}





window.onresize = function() {
		if(foooterEnabled){// footer olmayasan sayfalar için
			setFooter();
		 }	
}

function mailTo(m,e) {
	if (!e) {
		e='bankasya.com.tr';
	}
	document.write('<a href="mailto:'+m+String.fromCharCode(64)+e+'">'+m+String.fromCharCode(64)+e+'</a>');
}




function orientation(tit,_lk){
	root = "http://" + window.location.hostname + "";
	myStr ="";
	myWinTitle = "";
	myWinTitle += "Bank Asya"+" > "+tit;
	myStr += "<a href=\"" + root + _lk + "\">"+tit+"</a>";
	
	for (i=0;i<myOrientArr.length;i++){

		if (i==myOrientArr.length-1){
			myStr += "<img src=\"\/_i\/root_ok.gif\"  \/>";
			myStr +=  myOrientArr[i][1];
			myWinTitle += " > "+myOrientArr[i][1];
		}
		else{
			myStr += "<img src=\"\/_i\/root_ok.gif\" \/>";
			myStr += "<a href=\""+ myOrientArr[i][0] +"\">" + myOrientArr[i][1] + "</a>";	
			
			myWinTitle +=  " > "+myOrientArr[i][1];
		}

	}
	
	if($("content_root")){
		$("content_root").innerHTML = myStr;
	}
	document.title = myWinTitle;
}


function setSearchTxt(mytxtObj,statu){	
	if(!mytxtObj._defaultValue) {
			mytxtObj._defaultValue = mytxtObj.value;
	}	
	if (statu==1){
		if (mytxtObj.value==''){
			mytxtObj.value=mytxtObj._defaultValue;
		}
	}
	else{
		if (mytxtObj.value == mytxtObj._defaultValue){
			mytxtObj.value = '';
		}
	}
	
}

function $(_id){return document.getElementById(_id);}

var exObj="";
var exClickObj="";
var selecterFlag=0;
function showHideElement(_elm, clickObj){
	var myElement = $(_elm);
	var windowHeight = getWindowHeight();
	if (myElement){
		if (myElement.style.display == ""){
			myElement.style.display = "none";
		}
		else{
			myElement.style.display = "";
		}
	}
	
	if(exObj!="" && exObj != _elm){
		$(exObj).style.display = "none";
	}
	
	if(exObj != _elm){
		exObj = _elm;
	}
	
	if (exClickObj != ""){					
		exClickObj.className = "";
	}
	if (clickObj){
		if (clickObj != exClickObj){
			selecterFlag=1;
		}
		else{
			if (selecterFlag==1){selecterFlag=0;}
			else{selecterFlag=1;}
		}
					
		if (selecterFlag==1){
			clickObj.className += " selected";
		}
		
		exClickObj = clickObj;
	}
	
}

function loadHideElement(_link){
	mydiv = _link.split("#");
	if (mydiv.length > 1){
		showHideElement(mydiv[1],$(mydiv[1]));
	}
}



/* function InternetBankaciligi(){
	if(window.location != 'http://' + window.location.hostname + '/index.jsp' ){
		if(is.IE6x){
			document.getElementById('internetSubesi').style.display='none';
			document.getElementById('internetSubesi_ie6').style.display='block';
			
		}else {
			window.elm = document.getElementById("internetSubesi");
			window.elm_off = document.getElementById("internetSubesi_off");
			elm[navigator.appName=="Microsoft Internet Explorer"?"attachEvent":"addEventListener"]((navigator.appName=="Microsoft Internet Explorer"?"on":"")+"mouseover",_open,0);
			document.body[navigator.appName=="Microsoft Internet Explorer"?"attachEvent":"addEventListener"]((navigator.appName=="Microsoft Internet Explorer"?"on":"")+"mousemove",close,0);
	   }	
	}		
} */


/* var isInternetBankaciligiEnabled= true; */

window.onload = function() {
	init();
	externalLinks();
	homepage_btn();
	
	
		if(foooterEnabled){// footer olmayasan sayfalar için
			setFooter();
		 }	

/* 		if(isInternetBankaciligiEnabled){// anasayfada internetbankacılığı çalışmaması için
			InternetBankaciligi();
		 } */
	
}



	function getUrl(url,target) { //Fiyat oran komisyon için
		if(url=='blank') return false;
		if(target && target=='blank') window.open(url);
			else document.location.href=url;
	  }
	  
	  
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 check_arama()
	{
		if(document.getElementById("txtSearch").value.length == 0)
		{
			alert("Lütfen bir arama sözcüğü giriniz.");
			return false;
		}
		else if (document.getElementById("txtSearch").value.length < 3)
		{
			alert("Aradığınız terim en az 3 karakterden oluşmalıdır.");
			return false;
		}
		
		return true;
		
	}
	
	
function homepage_btn(){
	if((window.location == 'http://' + window.location.hostname+'/index.jsp') || (window.location == 'http://' + window.location.hostname+'/')){
		document.getElementById('homepage_link_sub').style.display='none';
		document.getElementById('homepage_link_home').style.display='block';
	}
	else{
		document.getElementById('homepage_link_sub').style.display='block';
		document.getElementById('homepage_link_home').style.display='none';
		}
}



var yourImages = new Array(
		"/_i/int_sube_on.jpg"
	);

	if (document.images) {
		var dots = new Array() ;
		dots[0] = new Image(1,1);
		dots[0].src = "../images/preLD.gif" ;
		dots[1] = new Image(1,1);
		dots[1].src = "../images/preLDend.gif";
		var preImages = new Array(),	currCount = 0;
		var loaded = new Array(),	i,	timerID;
	}

	function loadImages() { 
		for (i = 0; i < yourImages.length; i++) { 
			preImages[i] = new Image();
			preImages[i].src = yourImages[i];
		}
		for (i = 0; i < preImages.length; i++) { 
			loaded[i] = false;
		}
		checkLoad();
	}

	function checkLoad() {
		if (currCount == preImages.length) { 
			//alert('yüklendi');
			return;
		}
		for (i = 0; i <= preImages.length; i++) {
			if (loaded[i] == false && preImages[i].complete) {
				loaded[i] = true;
				currCount++;
			}
		}
		window.status =""
		if ( preImages.length > 0) 
			{	window.status = "Sayfa Yükleniyor: " + Math.floor(100*currCount/preImages.length) + "% tamamlandı";	}
		else
			{	window.status = "Sayfa Yükleniyor: 0% tamamlandı";	}
		timerID = setTimeout("checkLoad()",10) ;
	}
	
	if (document.images) {	loadImages();	}
	
	function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') {
			c = c.substring(1,c.length);
		}

		if (c.indexOf(nameEQ) == 0) {
			return c.substring(nameEQ.length,c.length);
		}
	}
	return null;
}
//WTCookie varmi diye kontrol ediyoruz
if(readCookie("WTCookie")==null)
{

//bossa cookie set ediyoruz (siteye ilk defa geliyor)
var tarih = new Date()
createCookie("WTCookie", tarih.getTime(), 10000);
}

function popup_acil(url,isim,genislik,yukseklik,lpos,tpos) {
	window.open (url,isim,"menubar=0,resizable=0,scrollbars=1,status=1,width="+genislik+",height="+yukseklik+",left="+lpos+",top="+tpos);
}


function Kontrol(e) {
	olay = document.all ? window.event : e;
	tus = document.all ? olay.keyCode : olay.which;
	if(tus==60||tus==33||tus==37||tus==38||tus==47||tus==62||tus==63) {
		if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
	}
}	

