﻿// JScript File
function winYeni(url)
{
    window.open(url,'sayfa','width=500,height=500,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,copyhistory=no,directories=no') 
}

function winYeniSayfa(url)
{
    window.open(url,'yenisayfa','width=800,height=600,resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,copyhistory=yes,directories=yes') 
}

function winPopup(url,name,prop)
{
    window.open(url,name,prop) 
}

function winFree(url)
{
    window.open(url,'fSayfa','width=800,height=600,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,copyhistory=no,directories=no') 
}

function winHesapmakine(url)
{
    window.open(url,'hSayfa','width=720,height=400,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,copyhistory=no,directories=no') 
}

function winBBP(url)
{
    window.open(url,'bbp','width=780,height=700,resizable=yes,scrollbars=yes,toolbar=no,menubar=no,copyhistory=no,directories=no') 
}

function winKapat()
{
    window.close(); 
}


function GetServerSideControl(control){
return document.getElementById("ctl00_ContentPlaceHolder1_"+control);
}


function SetPanelVisible(control)
{
//alert(control)
    control=document.getElementById(control);
    if (control == null) return;
    if (control.style.display=="none")
    {
        control.style.display="inline";
    } else 
    {
        control.style.display="none";
    }
}

function SetServerPanelVisible(control)
{
//alert(control)
    control=GetServerSideControl(control);
    if (control == null) return;
    if (control.style.display=="none")
    {
        control.style.display="inline";
    } else 
    {
        control.style.display="none";
    }
}

function findPos(obj) {
  if (obj == null) return;
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function InitLoginPanel(){
    window.onresize = altSablon_Resize;
   // window.onresize += pageWidth;
    SetLoginPanelCoordinates();
    
    
}

function altSablon_Resize()
{
    SetLoginPanelCoordinates();
    pageWidth();
}

function SetLoginPanelCoordinates(){
    ctl=document.getElementById("UyeGiris");
    loginImage = document.getElementById("img_Login");
      if (ctl == null) return;
        if (loginImage == null) return;
    pos=findPos(loginImage);
    ctl.style.left=pos[0]-188;
    ctl.style.top=pos[1]+21;
    
}

function SetSanalPortfoyTabButtons(tabName)
{
    tmp=document.getElementById("td_HisseSenedi");
    if ((tmp!=null) &&(tabName=="td_HisseSenedi"))
    {
           tmp.className="s41"
    } else{
        tmp.className="s42"
    }
    
    tmp=document.getElementById("td_YatirimFonu");
    if ((tmp!=null)&&(tabName=="td_YatirimFonu"))
    {
           tmp.className="s41"
    } else{
        tmp.className="s42"
    }
    
    tmp=document.getElementById("td_BonoTahvil");
    if ((tmp!=null)&&(tabName=="td_BonoTahvil"))
    {
           tmp.className="s41"
    } else{
        tmp.className="s42"
    }
    
    tmp=document.getElementById("td_RepoMevduat");
    if ((tmp!=null)&&(tabName=="td_RepoMevduat"))
    {
           tmp.className="s41"
    } else{
        tmp.className="s42"
    }
    
    
    
}


function InitSecPanel(){

    window.onresize = SetSecPanelCoordinates;        
    SetSecPanelCoordinates();
}

function SetSecPanelCoordinates(){

SetLoginPanelCoordinates();

    ctl=document.getElementById("pnl_Sec");
    loginImage = document.getElementById("td_Sec");
      if (ctl == null){
        
       return;
       }
        if (loginImage == null) {
       
        return;
        }
    pos=findPos(loginImage);
    ctl.style.left=pos[0]-10;
    ctl.style.top=pos[1]+20;
    
}

function HisseKoduSec(tbName,ctl)
{
    if (ctl==null) return;
    tb=GetServerSideControl(tbName)
    if (tb==null) return;
    tb.value = ctl.innerHTML;
    SetPanelVisible('pnl_Sec');
}

function SetSelectedPanel(divName)
{
    hd=GetServerSideControl("hd_SonAcikTab");
    
    if (hd==null) return;
    
    hd.value=divName;
    
}

function InitSelectedPanel()
{
    hd=GetServerSideControl("hd_SonAcikTab");
    
    
    if (hd==null) return;
    
    if (hd.value=="") return;
    
    SetPanelVisible(hd.value);
}

function confirmation() {
    var answer = confirm("Kaydı silmek istiyor musunuz?")
    if (answer) {
        alert("Bye bye!")
        var lbHisse = GetServerSideControl("rpt_HisseListesi_ctl01_lb_HisseCikart");
        if (lbHisse == null) {
            lbHisse.CommandName = "Cikart";
        }
        //window.location = "http://www.google.com/";
    }
    else {
        alert("Thanks for sticking around!")
    }
}