

Date.prototype.formatDate = function(format)
{
    var date = this;
    if (!format)
      format="MM/dd/yyyy";               

    var month = date.getMonth() + 1;
    var year = date.getFullYear();    

    format = format.replace("MM",month.toString().padL(2,"0"));        

    if (format.indexOf("yyyy") > -1)
        format = format.replace("yyyy",year.toString());
    else if (format.indexOf("yy") > -1)
        format = format.replace("yy",year.toString().substr(2,2));

    format = format.replace("dd",date.getDate().toString().padL(2,"0"));

    var hours = date.getHours();       
    if (format.indexOf("t") > -1)
    {
       if (hours > 11)
        format = format.replace("t","pm")
       else
        format = format.replace("t","am")
    }

    if (format.indexOf("HH") > -1)
        format = format.replace("HH",hours.toString().padL(2,"0"));
    if (format.indexOf("hh") > -1) {
        if (hours > 12) hours - 12;
        if (hours == 0) hours = 12;
        format = format.replace("hh",hours.toString().padL(2,"0"));        
    }
    if (format.indexOf("mm") > -1)
       format = format.replace("mm",date.getMinutes().toString().padL(2,"0"));
    if (format.indexOf("ss") > -1)
       format = format.replace("ss",date.getSeconds().toString().padL(2,"0"));
    return format;
}

String.repeat = function(chr,count)

{    

    var str = ""; 

    for(var x=0;x<count;x++) {str += chr}; 

    return str;

}

String.prototype.padL = function(width,pad)

{

    if (!width ||width<1)

        return this;   

 

    if (!pad) pad=" ";        

    var length = width - this.length

    if (length < 1) return this.substr(0,width);

 

    return (String.repeat(pad,length) + this).substr(0,width);    

}    

String.prototype.padR = function(width,pad)

{

    if (!width || width<1)

        return this;        

 

    if (!pad) pad=" ";

    var length = width - this.length

    if (length < 1) this.substr(0,width);

 

    return (this + String.repeat(pad,length)).substr(0,width);

} 

String.format = function(frmt,args)

{   

    for(var x=0; x<arguments.length; x++)

    {

        frmt = frmt.replace("{" + x + "}",arguments[x+1]);

    }

    return frmt;

}

function HaberAc(HaberNo)
{
	window.open('haberdetay.aspx?haberNo=' + HaberNo,'','status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,width=650,height=500');
}

function sube()
{
	
    d=Math.round(Math.random()*10000)
    window.name = "AKBFNPORTALWN"+d;
    mbb1 = "Akbank" + "_" + window.name;
	mbb = "Akbank" ;

    if(document.getElementById('sube1').checked == true)
	{
        window.open("https://internetsube.akbank.com.tr/FN_main_yatirimciOTP.html", mbb1, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,dependent=no,resizable=no,top=0,left=0,width=850,height=615");
		//document.getElementById('musteriNo').value = "";
	}
    else if(document.getElementById('sube2').checked == true)
     {
window.open("https://internetsubesi.akbank.com/WebApplication.UI/entrypoint.aspx", mbb, "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=auto,dependent=0,resizable=0,top=0,left=0,width=1012,height=700");    	     //document.getElementById('musteriNo').value = "";
	 }
    else if(document.getElementById('sube3').checked == true)
     {   window.open("https://internetsube.akbank.com.tr/FN_main_HISOTP.html", mbb, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,dependent=no,resizable=no,top=0,left=0,width=790,height=545");
		//document.getElementById('musteriNo').value = "";
	 }
}

function bireyselsube(mbb, session)
{
    window.open("https://internetsubesi.akbank.com/WebApplication.UI/entrypoint.aspx", mbb, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,dependent=no,resizable=no,top=0,left=0,width=1012,height=700");    
}

function hissesube(mbb, session)
{
    window.open("https://internetsube.akbank.com.tr/cgi-bin/direct_his_login.cgi?MBB=" + mbb + "&SS_ID=" + session + "&ISL=L", "hissesube", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,dependent=no,resizable=no,top=0,left=0,width=790,height=545");
}

function openHisseSubeLogin() {
	window.open("https://internetsube.akbank.com.tr/FN_main_HISOTP.html", "hissesube", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,dependent=no,resizable=no,top=0,left=0,width=790,height=545");
}

function anlikborsa(mbb, session)
{
	//window.open("http://webfx2.akbank.com.tr/webtop.jsp?foreks=" + mbb + "&sessionid="+ session + "&connectionType=TCP&layout=codebase:layout-yuzeysel.xml&language=tr&country=TR", "anlikborsa", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,dependent=no,resizable=no,top=0,left=0,width=555,height=100");
	window.open("http://webfxplus.akbank.com.tr/webtop.jsp?foreks=" + mbb + "&sessionid="+ session + "&connectionType=TCP&layout=codebase:layout-yuzeysel.xml&language=tr&country=TR&kanal=YAT", "anlikborsa", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,dependent=no,resizable=no,top=0,left=0,width=555,height=100");
}

function anlikborsa_yeni(mbb, sid_id, sid_enc)
{
	//window.open("http://webfxplus.akbank.com.tr/webtop.jsp?foreks=" + mbb + "&sid_id="+ sid_id + "&sid_enc=" + sid_enc + "&connectionType=TCP&layout=codebase:layout-yuzeysel.xml&language=tr&country=TR&kanal=YAT", "anlikborsa", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,dependent=no,resizable=no,top=0,left=0,width=555,height=100");
	var d = new Date();
	var st = d.formatDate("yyyy-MM-dd-HH.mm.ss.00");
	window.open("http://webfxplus.akbank.com.tr/webtop.jsp?sid_id="+ sid_id + "&foreks=" + mbb + "&sid_enc=" + sid_enc + "&sessionTime=" + st + "&output=23C5C0B7E75380C1DE345589C6A1EB1A&connectionType=TCP&layout=codebase:layout-yuzeysel.xml&language=tr&country=TR&from=bis&HesapAdedi=0&brokerage=AK&withSMS=1&withVOB=1&withExchange=1&withTransfer=0&pVobKademeLimit=5&cp=Cp1254&uid=" + mbb + "&xml=codebase:xml/webfx/AKBANK/wins-akbank.jsp&kanal=YAT", "anlikborsa", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,dependent=no,resizable=no,top=0,left=0,width=684,height=485");
}

function teknikanaliz(mbb, session)
{
	
	//window.open("http://chartfx.akbank.com.tr/teknikanaliz/chart.jsp?foreks=" + mbb + "|" + session + "&connectionType=TCP&layout=codebase:layout-yuzeysel.xml&language=tr&country=TR", mbb, "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,dependent=no,resizable=no,top=0,left=0,width=790,height=545");
	window.open("http://chartfx.akbank.com.tr/teknikanaliz/chart.jsp?foreks=" + mbb + "&sessionid="+ session , "teknikanaliz", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,dependent=no,resizable=no,top=0,left=0,width=850,height=600");
}

function disableEnterKey(e)
{
     var key;
	
     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox
     if(key == 13 && document.getElementById('musteriNo').value!="")
	 {
	sube();
	 }
     else
     return true;
}

function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
