﻿                

           
           
function GetDropHeader(moduleid,nodename,isalone, containerwidth,category,languageid)
{

    $.ajaxSetup( { async: false } );
    grouptype=0;
    titletext='';
    switch (nodename)
    {
        //entry
        case 'GetMostRatingEntries':
        {   
            grouptype=1;
            if(languageid == 1)
            {
                titletext='En Çok Oy Alan Konular';
            }
            else if (languageid==2)
            {
                titletext='Top Themen';            
            }
            else if (languageid==3)
            {
                titletext='Темы с Топ Рейтингом';            
            }
            else if (languageid==4)
            {
                titletext='Most popular';            
            }
            break;
        }
        
         case 'GetMostRatingEntriesByCategory':
        {
            grouptype=1;
            if(languageid == 1)
            {
                titletext='En Çok Oy Alan Konular';
            }
            else if (languageid==2)
            {
                titletext='Top Themen';            
            }
            else if (languageid==3)
            {
                titletext='Темы с Топ Рейтингом';            
            }
            else if (languageid==4)
            {
                titletext='Most popular';            
            }
            
            break;
        }
        case 'GetMostReadingEntries':
        {
            grouptype=1;
            if(languageid == 1)
            {
                titletext='En Çok Okunan Konular';
            }
            else if (languageid==2)
            {
                titletext='Die meisten gelesenen Themen';            
            }
            else if (languageid==3)
            {
                titletext='Наиболее Прочитанные Темы';            
            }
            else if (languageid==4)
            {
                titletext='Most Reading Entries';            
            }
            
            break;
        }
        
        
        //members
        case 'MainPageGetNewMembers':
        {
            grouptype=2;
            if(languageid == 1)
            {
                titletext='Yeni Üyeler';
            }
            else if (languageid==2)
            {
                titletext='Neue Mitglieder';            
            }
            else if (languageid==3)
            {
                titletext='Новые Члены';            
            }
            else if (languageid==4)
            {
                titletext='New Members';            
            }
            
            break;
        }
        
        
        // groups
        case 'MainPageGetNewGroups':
        {

            grouptype=3;
            if(languageid == 1)
            {
                titletext='Yeni Gruplar';
            }
            else if (languageid==2)
            {
                titletext='Neue Gruppen ';
            }
            else if (languageid==3)
            {
                titletext='Новые Группы';
            }
            else if (languageid==4)
            {
                titletext='New Groups';
            }
            
            break;
        }
        case 'GetMostHaveGroupMessages':
        {
            grouptype=3;
            if(languageid == 1)
            {
                titletext='En Aktif Gruplar';
            }
            else if (languageid==2)
            {
                titletext='Die berühmtesten Gruppen';
            }
            else if (languageid==3)
            {
                titletext='Активнейшие Группы';
            }
            else if (languageid==4)
            {
                titletext='Most Active Groups';
            }
            
            break;
        }

        case 'GetMostVisitedGroups':
        {
            grouptype=3;
            if(languageid == 1)
            {
                titletext='En Popüler Gruplar';
            }
            else if (languageid==2)
            {
                titletext='Die aktivsten Gruppen';
            }
            else if (languageid==3)
            {
                titletext='Популярнейшие Группы';
            }
            else if (languageid==4)
            {
                titletext='Most Popular Groups';
            }
            
            break;
        }
        
        case 'GetNewEntryComments':
        {
            if(languageid == 1)
            {
                titletext='Ne Dediler?';
            }
            else if (languageid==2)
            {
                titletext='Was haben die gesagt?';
            }
            else if (languageid==3)
            {
                titletext='Что Они Сказали?';
            }
            else if (languageid==4)
            {
                titletext='What they say?';
            }
            
            break;
        }
    }    

rightImage="FonksiyonTitleSag.png";
if (isalone==1)
rightImage="FonksiyonTitleSagBos.png";

    dropwidth=containerwidth-6;
    totalwidth=parseInt(containerwidth)+36;
    headerhtml="";
    headerhtml+='<div id="menu-index'+moduleid+'" class="menu-index"  style="width: '+totalwidth+'px;">';
        headerhtml+='<ul id="ul-index'+moduleid+'" class="ul-index">';
            headerhtml+='<li>';
                headerhtml+='<table style="width: '+totalwidth+'px; position:absolute; cursor:pointer;  " cellpadding="0" cellspacing="0">';
                    headerhtml+='<tr>';
                        headerhtml+='<td style="width: 5px; background-image: url(/images/FonksiyonTitleLeft.png); padding-left: 0px; padding-right: 0px;"></td>';
                        headerhtml+='<td id="tdtitle'+moduleid+'" style="background-image: url(/images/FonksiyonTitleBg.png); height: 23px; padding-left: 0px; padding-right: 0px; padding-top: 5px;" class="bold">'+titletext+'</td>';
                        headerhtml+='<td style="width: 31px; background-image: url(/images/'+rightImage+'); padding-left: 0px; padding-right: 0px;"></td>';
                    headerhtml+='</tr>';
                headerhtml+='</table>';
                if (isalone==0)
                {
                headerhtml+='<div id="menu-details-buyers'+moduleid+'" style="background-color: #FFFFFF; margin-left: 50px;  width: '+dropwidth+'px; border-left:1px solid #acd5df; border-bottom:1px solid #acd5df; 	border-right:1px solid #acd5df; padding:10px 0px 10px 0px;"> ';
                    headerhtml+='<ul id="buyers-details" style="list-style-type: disc; color: #acd5df; ">';
                        if (grouptype==1)
                        {
                            if(languageid == 1)
                            {
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostReadingEntries','En&nbsp;Çok&nbsp;Okunan&nbsp;Konular');>En Çok Okunan Konular</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostRatingEntries','En&nbsp;Çok&nbsp;Oy&nbsp;Alan&nbsp;Konular');>En Çok Oy Alan Konular</a></li>";
                            }
                            else if (languageid==2)
                            {
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostReadingEntries','Die&nbsp;meisten&nbsp;gelesenen&nbsp;Themen');>Die meisten gelesenen Themen</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostRatingEntries','Top&nbsp;Themen');>Top Themen</a></li>";
                            }
                            else if (languageid==3)
                            {
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostReadingEntries','Наиболее&nbsp;Прочитанные&nbsp;Темы');>Наиболее Прочитанные Темы</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostRatingEntries','Темы&nbsp;с&nbsp;Высочайшим&nbsp;Рейтингом');>Темы с Высочайшим Рейтингом</a></li>";
                            }
                            else if (languageid==4)
                            {
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostReadingEntries','Most&nbsp;Reading&nbsp;Entries');>Most Reading Entries</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostRatingEntries','Most&nbsp;с&nbsp;Rating&nbsp;Entries');>Most popular</a></li>";
                            }
                        
                        }
                        else if (grouptype==2)
                        {
                        headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','MainPageGetNewMembers');>Yeni Üyeler</a></li>";
                        }
                        else if (grouptype==3)
                        {
                            if(languageid == 1)
                            {
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','MainPageGetNewGroups','Yeni&nbsp;Gruplar','"+languageid+"');>Yeni Gruplar</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostVisitedGroups','En&nbsp;Popüler&nbsp;Gruplar','"+languageid+"');>En Popüler Gruplar</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostHaveGroupMessages','En&nbsp;Aktif&nbsp;Gruplar','"+languageid+"');>En Aktif Gruplar</a></li>";
                            }
                            else if (languageid==2)
                            {
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','MainPageGetNewGroups','Neue&nbsp;Gruppen','"+languageid+"');>Neue Gruppen</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostVisitedGroups','Die&nbsp;berühmtesten&nbsp;Gruppen','"+languageid+"');>Die berühmtesten Gruppen</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostHaveGroupMessages','Die&nbsp;aktivsten&nbsp;Gruppen','"+languageid+"');>Die aktivsten Gruppen</a></li>";
                            }
                            else if (languageid==3)
                            {  
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','MainPageGetNewGroups','Новые&nbsp;Группы','"+languageid+"');>Новые Группы</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostVisitedGroups','Популярнейшие&nbsp;Группы','"+languageid+"');>Популярнейшие Группы</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostHaveGroupMessages','Активнейшие&nbsp;Группы','"+languageid+"');>Активнейшие Группы</a></li>";
                            
                            }
                            else if (languageid==4)
                            {  
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','MainPageGetNewGroups','New&nbsp;Groups','"+languageid+"');>New Groups</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostVisitedGroups','Most&nbsp;Popular&nbsp;Groups','"+languageid+"');>Most Popular Groups</a></li>";
                                headerhtml+="<li style='display:list-item;'><a style='text-decoration: none;' href=javascript:GetFunctionalData('"+moduleid+"','GetMostHaveGroupMessages','Most&nbsp;Active&nbspGroups','"+languageid+"');>Most Active Groups</a></li>";
                            
                            }
                                 
                        }

                    headerhtml+='</ul>';
                headerhtml+='</div>';
                }
            headerhtml+='</li>';
        headerhtml+='</ul>';
    headerhtml+='</div>';
     $('#dvfunctionalheader'+moduleid).html(headerhtml);
    $.ajaxSetup( { async: true } );
    containername="dvfunctionalcontainer"+moduleid;
    GetDataWidthProviderData(containername,nodename,category,languageid);
    
}   

function GetDataWidthProviderData(container,nodename,category,languageid)
{
    var rand_no = Math.random();
	rand_no = rand_no * 100;
	rand_no = Math.ceil(rand_no);
//$.ajaxSetup( { async: false } );
    dataurl='/pages/dataprovider.aspx?nodename='+nodename+'&rnd='+rand_no;
    if(category!='undefined' && category!='na')dataurl+='&cat='+encodeURI(category.replace("\"","'"));
    if(languageid!='undefined' && languageid!='na')dataurl+='&languageid='+languageid;
    $.get( dataurl , function( data1 ) {$('#'+container).html(data1);});
//$.ajaxSetup( { async: true } );
} 

function GetFunctionalData(moduleid,nodename,title,languageid)
{
	
      var $menuDetails = $('#menu-details-buyers'+moduleid);
      $('#tdtitle'+moduleid).html(title); 
      $menuDetails.hide();
      //alert($menuDetails.html());
      containername="dvfunctionalcontainer"+moduleid;
      GetDataWidthProviderData(containername,nodename,'na',languageid);
      
}


var clockID = 0;
function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
   var tDate = new Date();
    hour=tDate.getHours();
    minutes=tDate.getMinutes();
    seconds=tDate.getSeconds();
    
    if ( seconds<10 ) seconds="0"+seconds;
    if ( minutes<10 ) minutes="0"+minutes;
    if ( hour<10 ) hour="0"+hour;
    nowTime = "" 
            + hour + ":" 
            + minutes + ":" 
            + seconds;
            
   $('#dvClock').html(nowTime);
   clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
       clockID = setTimeout("UpdateClock()", 500);
}
function KillClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
}


function work(dy,mnt,yr,h,m,s) {
    if (!document.layers && !document.all) return;
    var runTime = new Date();
    var hours = h;
    var minutes = m;
    var seconds = s;
    var dn = "AM";
    var shours = h;
    var sminutes = m;
    var sseconds = s;
    if (shours >= 12) {
        dn = "PM";
    }
    
    
    
    if (shours == 0) {
        shours = "0";
    }
    
    if (sminutes <= 9) {
        sminutes = "0" + sminutes;
    }
    
    if (sseconds <= 9) {
        sseconds = "0" + sseconds;
    }
    
    if (shours <= 9) {
        shours = "0" + shours;
    }
    
    if(dy <= 9)
    {
        dy = "0" + dy;
    }
    
    if(mnt <= 9)
    {
        mnt = "0" + mnt;
    }
    
    movingtime = ""+ dy + "."+ mnt + "."+ yr + " - "+ shours + ":" + sminutes +":"+sseconds+"";
    
$('#dvClock').html(movingtime);
    
    if (seconds <=58) {
        seconds=seconds+1;
    }else {
        seconds=0;
        minutes=minutes+1;
    }

    if (minutes <=59) {
    }else{
        hours=hours+1;
    }

    if (hours <=23) {
        if (minutes ==60) {
            minutes=0;
        }
    }else if (hours ==24) {
        hours=0;
        minutes=0;
    }

    setTimeout("work("+dy+","+mnt+","+yr+","+hours+","+minutes+","+seconds+")",1000);
}


function openpopupwindow(url,toolbar,scrollbars,location,statusbar,menubar,resizable,width,height)
{
	popupproperties="toolbar="+toolbar+",scrollbars="+scrollbars+",location="+location+",statusbar="+statusbar+",menubar="+menubar+",resizable="+resizable;
	if (width!='0') popupproperties+=",width="+width;
	if (height!='0') popupproperties+=",height="+height;
	winpops=window.open(url,"",popupproperties)

}

function f_share (share) {
	var url = encodeURIComponent(window.location.href);
    var title = encodeURIComponent(document.title);
	
	switch (share){
		case 'facebook':
		window.open('http://www.facebook.com/sharer.php?u=' + url + '&t=' + title, share, 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
		break;
		case 'tusul':
        window.open('http://www.tusul.com/submit.php?url=' + url + '&baslik=' + title, share,'toolbar=0,status=0,height=600,width=846,scrollbars=yes,resizable=yes');
		break;
		case 'oyyla':
		window.open('http://www.oyyla.com/gonder?url=' + url , share, 'toolbar=0,status=0,height=600,width=846,scrollbars=yes,resizable=yes');
		break;
		case 'webiket':
		window.open('http://www.webiket.net/submit?url=' + url , share, 'toolbar=0,status=0,height=600,width=846,scrollbars=yes,resizable=yes');
		break;
        case 'google':
        window.open('http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk='+url+'&title='+title, 'googlebookmark','toolbar=no,width=700,height=500');
        break;
        case 'spurl':
        window.open('http://www.spurl.net/spurl.php?url='+url+'&title='+title,'spurl','toolbar=no,width=700,height=400');
        break;
        case 'yahoo':
        window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+url+'&t='+title, 'yahoo','toolbar=no,width=800,height=800');
        break;
        case "twitter":
        window.open('http://twitter.com/home?status=Reading ' +url);
        break;
        case "friendfeed":
        window.open('http://friendfeed.com/?url=' +url+'&title='+title);
        
}



}

 var Obj1;
var intervalId=0;
//alert("<%#ToolTip %>");
function ToolTip1(obj,x,y)
{
    //alert(obj);
    Obj1=document.getElementById('Pop1');
    Obj1.innerHTML=document.getElementById('Pop2').innerHTML;
    //alert(Obj1.innerHTML);
    Obj1.style.left=(zxcPos1(obj)[0]+x)+'px';
    Obj1.style.top=(zxcPos1(obj)[1]+y)+'px';
    $('#Pop1').show("slow");
    //Obj1.style.visibility='visible';
    //clearInterval(intervalId);
    //intervalId=setInterval(Hide1,5000);
    setTimeout(Hide1, 5000);
    
    
    //$('#divtooltip').show("slow");
	//		$('#divtooltip').html('<%#ToolTip %>');
    
}

function Hide1()
{
    //alert('bbb');
    $('#Pop1').hide("slow");
    //Obj1.style.visibility='hidden';
}

function ToolTip2()
{
   clearInterval(intervalId); 
}

function zxcPos1(zxcobj)
{
    zxclft=zxcobj.offsetLeft;
    zxctop=zxcobj.offsetTop;
        while(zxcobj.offsetParent!=null)
        {
            zxcpar=zxcobj.offsetParent;
            zxclft+=zxcpar.offsetLeft;
            zxctop+=zxcpar.offsetTop;
            zxcobj=zxcpar;
        }
    return [zxclft,zxctop];
}


