﻿
function NavOpen(trid){
		
		if(document.getElementById(trid).style.display == 'none')
		{
			document.getElementById(trid).style.display = '';
		}else{
			document.getElementById(trid).style.display = 'none';
		}	
	}
	
function SWFDelegate(url,width,height,caption) {
   var objLink = document.createElement('a');
   objLink.setAttribute('href',url);
   objLink.setAttribute('rel','lightbox');
   objLink.setAttribute('title',caption);
   if(typeof width != 'undefined') {
      objLink.setAttribute('width',width);
   }
   if(typeof height != 'undefined') {
      objLink.setAttribute('height',height);
   }
   Lightbox.prototype.start(objLink);
}

function GroupDelegate(id) {
   var objLink = document.getElementById(id);
   Lightbox.prototype.start(objLink);
}


function FindCurrentPage(prm)
{
    var oItm = document.getElementById("Nv" + prm);
    if(oItm)
    {
        oItm.className="current";
        var prnt = oItm.parentNode;
        while(prnt)
        {
            //alert(prnt.nodeName);
            if(prnt.nodeName=="UL")
            {
                prnt.style.display="";
                var ps = prnt.previousSibling;
                
                if(ps)
                    if(ps.nodeType!=3){
                       ps.className="current";
                    }
                    
            }
            else if(prnt.nodeName=="DIV")
            {
                break;
            }
            prnt = prnt.parentNode;    
        }
        
        
//        oItm.className="current";
//        var prn = FindParent(oItm);
        
    }
}

function FindParent(obj)
{
    return obj.parent;
}

function BottomOpener (){
	
	if(document.getElementById("bottom_flash_opener").style.display == 'none')
		{
			document.getElementById("bottom_flash_opener").style.display = '';
			document.getElementById("bottom_flash_opener_button").src = '../images/bottom_flash_close.png';
		}else{
			document.getElementById("bottom_flash_opener").style.display = 'none';
			document.getElementById("bottom_flash_opener_button").src = '../images/bottom_flash_open.png';
		}	

}



/* ---------------------- Panel Collapse ----------------------------------- */
var FooterCollapsed = true;
        var maxH = 365;
        var minH = 0;
        var aniType = "asc";
        var aniVal = 0;
        var aniRate = 10;
        var aniTime = 50;
        var timeo;
        
        function FooterInit()
        {
            var cPath = window.location.pathname;
            if(cPath.length>0)
                cPath = cPath.toLowerCase();
            var page = "content";
            if(cPath=="/tr-tr/" || cPath=="/en-us/" || cPath=="/de-de/" || cPath.toLowerCase()=="/ru-ru/") // "www.domain.com/"
            {
                // home page
                page = "home";
            }
            else 
            {
                var m = cPath.lastIndexOf("/");
                if(m!=-1 && (m+1)<cPath.length) // "www.domain.com/default.aspx"
                {
                    var tPath = cPath.substring(m);
                    if(tPath.length>0 && tPath.toLowerCase().indexOf("default.aspx")!=-1)
                    {
                        page = "home";
                    }
                }
            }
            
            var obj = document.getElementById("FooterContainer");
            if(page=="home")
            {
                obj.style.height = maxH + "px";  
                FooterCollapsed = false; 
                //window.onload+=ToggleFooter();
            }
            else
            {
                obj.style.height = minH + "px";  
                FooterCollapsed = true; 
            }
        }
        
        
        function ToggleFooter()
        {
            var obj = document.getElementById("FooterContainer");
            if(FooterCollapsed)
            {
                //ResizeContainer(max);
                aniType = "asc";
                aniVal = minH;
                timeo = window.setTimeout(ResizeContainer,aniTime);
            }
            else
            {
                //ResizeContainer(min);
                aniType = "desc";
                aniVal = maxH;
                timeo = window.setTimeout(ResizeContainer,aniTime);
            }
        }
        
        var resizeText1="Kapat";
        var resizeText2="Hızlı Erişim";
        function ResizeContainer(max)
        {
            var obj = document.getElementById("FooterContainer");
            obj.style.height = aniVal + "px";  
             
            if(aniType=="asc")
            {
                if(aniVal<maxH)
                {
                    aniVal+= aniRate;
                    if(aniVal>maxH)
                        aniVal = maxH;
                    timeo = window.setTimeout(ResizeContainer,aniTime);
                }
                else
                {
                    aniType="";
                    FooterCollapsed = false;
                    var objlink = document.getElementById("ErisimLink");
                    objlink.innerHTML="<a href='Javascript:ToggleFooter();' style='color:White; background-image:url(/styles/images/footer_close.jpg); background-repeat:no-repeat; background-position:right; padding-right:17px; text-decoration:none; color:#898989; font-size:10px'>"+resizeText1+"</a>";
                }
            }
            else if(aniType=="desc")
            {
                if(aniVal>minH)
                {
                    aniVal-=aniRate;
                     if(aniVal>minH)
                        aniVal = minH;
                    timeo = window.setTimeout(ResizeContainer,aniTime);
                }
                else
                {
                    aniType="";
                    FooterCollapsed=true;
                    var objlink = document.getElementById("ErisimLink");
                    objlink.innerHTML="<a href='Javascript:ToggleFooter();' style='color:White; background-image:url(/styles/images/footer_open.jpg); background-repeat:no-repeat; background-position:right; padding-right:17px; text-decoration:none; color:#898989; font-size:10px'>"+resizeText2+"</a>";
                }
            }
            
        }
        
        
        
// ----- Call Video Panel ------------------------------------------------------------------------------------

        var styleToSelect;
       
        function CallVideo(param1,param2,param3)
        {
            //"pVideo=";
            
            var obj = $find("Modal1");
            if(obj)
            {
                var pan = document.getElementById("ctl00_Panel1");
                if(!pan)
                    pan = document.getElementById("Panel1");
                if(pan)
                {
                    pan.style.width = "412px";
                    pan.style.height = "356px";
                    pan.style.background = "#212121";
                }
                var cnt = document.getElementById("VideoContainer");
                var str = "";
                str += "<script type=\"text/javascript\" language=\"javascript\">";
                str += "AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width', '412px','height', '356px','src', '/swf/fplayer','quality', 'high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','align', 'middle','play', 'true','loop', 'true','scale', 'showall','wmode', 'transparent', 'devicefont', 'false','id', 'HeaderFlash','bgcolor', '#000000','name', 'HeaderFlash','menu', 'true','allowFullScreen', 'false','allowScriptAccess','sameDomain','movie', '/swf/fplayer','salign', '','flashVars','pVideo="+ encodeURI(param1) +"');";
                str += "\<\/script\>";
                
                str = "<embed height=\"356\" align=\"middle\" width=\"412\" type=\"application/x-shockwave-flash\" flashvars=\"pVideo="+ encodeURI(param1) +"\" salign=\"\" allowscriptaccess=\"sameDomain\" allowfullscreen=\"false\" menu=\"true\" name=\"HeaderFlash\" bgcolor=\"#000000\" devicefont=\"false\" wmode=\"transparent\" scale=\"showall\" loop=\"true\" play=\"true\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\"/swf/fplayer.swf\"/>";
                cnt.innerHTML = str;
                obj.show();
            }
        }
        
        
// ----- Call Flash Modal ------------------------------------------------------------------------------------

        function CallFlash(swfPath,w,h,params)
        {
            var obj = $find("Modal1");
            if(obj)
            {
                var pan = document.getElementById("ctl00_Panel1");
                if(!pan)
                    pan = document.getElementById("Panel1");
                    
                if(pan)
                {
                    pan.style.width = w;
                    pan.style.height = h;
                    pan.style.background = "#212121";
                }
                var cnt = document.getElementById("VideoContainer");
                var str = "";
                str += "<script type=\"text/javascript\" language=\"javascript\">";
                str += "AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width', '"+w+"','height', '"+h+"','src', '"+ encodeURI(swfPath)+ "','quality', 'high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','align', 'middle','play', 'true','loop', 'true','scale', 'showall','wmode', 'transparent', 'devicefont', 'false','id', 'PopFlash','bgcolor', '#000000','name', 'HeaderFlash','menu', 'true','allowFullScreen', 'false','allowScriptAccess','sameDomain','movie', '"+encodeURI(swfPath)+"','salign', '','flashVars','"+ encodeURI(params) +"');";
                str += "\<\/script\>";
                
                str = "<embed height=\""+ h +"\" align=\"middle\" width=\""+ w +"\" type=\"application/x-shockwave-flash\" flashvars=\""+ encodeURI(params) +"\" salign=\"\" allowscriptaccess=\"sameDomain\" allowfullscreen=\"false\" menu=\"true\" name=\"PopFlash\" bgcolor=\"#000000\" devicefont=\"false\" wmode=\"transparent\" scale=\"showall\" loop=\"true\" play=\"true\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" quality=\"high\" src=\""+ encodeURI(swfPath) +"\"/>";
                cnt.innerHTML = str;
                obj.show();
            }
        }
        
// ----- Call Flash Modal ------------------------------------------------------------------------------------

        function CallModalHtml(body,w,h)
        {
            var obj = $find("Modal1");
            if(obj)
            {
                var pan = document.getElementById("ctl00_Panel1");
                if(!pan)
                    pan = document.getElementById("Panel1");
                    
                if(pan)
                {
                    pan.style.width = w +"px";
                    pan.style.height = h +"px";
                    pan.style.background = "transparent";
                }
                var cnt = document.getElementById("VideoContainer");
                var str = "";
                str += "<div class=\"CloseModal\"><a href=\"Javascript:CloseModal();\"><img src=\"/images/callme_kapat.png\" alt=\"\" /></a></div>";
                str += "<div class=\"ModalHtmlBody\">"+ body +"</div>";
                str += "<div style=\"clear:both;\"></div>";
                cnt.innerHTML = str;
                obj.show();
            }
        }
        
// ----- Close Modal ------------------------------------------------------------------------------------
        function CloseModal()
        {
            var obj = $find("Modal1");
            if(obj)
            {
                obj.hide();
            }
        }
        
        function CallJajah()
        {
            var str = "";
            str = "<div id=\"jajahbtn\"><embed type=\"application/x-shockwave-flash\" src=\"http://www.jajah.com/buttons/jjb.swf?v=1.02\" width=\"250\" height=\"220\" wmode=\"transparent\" allowScriptAccess=\"always\" allowFullScreen=\"true\" flashvars=\"atm=43520&amp;ctc=3355443&amp;bgc=16777215&amp;bcc=7167800&amp;mcl=7167800&amp;sn=ElaQuality&amp;lng=en&amp;lnko=1&amp;loc=any\" quality=\"high\" bgcolor=\"#ffffff\" name=\"JajahButton\" id=\"JajahButton\" /></div>";
            CallModalHtml(str,285,250);
        }