var win=null;
function pop_up(mypage,myname,w,h,pos,infocus)
{
    if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
    
    settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no";
    win=window.open(mypage,myname,settings);
    win.focus();
}  

function sohbet()
{
    pop_up(BASE_URL +"seslisohbet","sohbet",'1020','700','center');
}
function sohbet_nav()
{
    pop_up(BASE_URL +"seslisohbet/sohbet","sohbet",'1020','700','center');
}
function acil_sohbet()
{
    pop_up(BASE_URL +"seslisohbet/hizligiris","sohbet",'1020','700','center');
}
function odaya_gir(id,odano)
{
    if(win == null)
    pop_up(BASE_URL+"seslisohbet/sohbet/"+id,"sohbet",'1000','700','center');
    else{
        win.focus();
        win.baglan(id,odano);
    }
}
function odaya_gir_ajax(id)
{
    pop_up(BASE_URL+"seslisohbet/sohbet/"+id,"sohbet",'1000','700','center');
}

function odaya_gir_prelogin(id)
{ 
    pop_up(BASE_URL+"seslisohbet/giris/"+id,"sohbet",'1000','700','center'); 
}


$('.tabs').livequery(function () {
   $(this).tabs({ fx: [{opacity:'toggle', duration:'normal'},   // hide option
                        {opacity:'toggle', duration:'fast'}] });
});

function yukle()
{ 
    $sht = $('<div class="sht"></div>').appendTo($('.shoutbox_content'));
	$sht.platin({ 
			term			: "shoutbox", 
			bird			: false, 
			colorExterior	: '#000',
			colorInterior	: '',
			pause			: true
	});
}

setInterval("$sht.remove();yukle();",300000); 

$(document).ready(function(){
    yukle(); 
    setTimeout('$(".online_sayi").load(BASE_URL+"/seslisohbet/online_goster").fadeOut(100).fadeIn(100);',100);
    $("a.bay").click(function(){
        $('#cinsiyet').val('m');
        $('.bayan').removeClass('selected');
        $('.bay').addClass('selected');
    });
    $("a.bayan").click(function(){
        $('#cinsiyet').val('f');
        $('.bay').removeClass('selected');
        $('.bayan').addClass('selected');
    });
     
    $("#sidebar a.odayagir, a[rel=odayagir]").colorbox({width:"auto",overflow:"hidden"});
    
    $(".ajaxlogin a").livequery('click',function(){  
        $(".ajaxlogin a").colorbox({width:"620px",overflow:"hidden"}); 
    });
});
 
function facebookpop_next()
{
    pop_up(BASE_URL +"seslisohbet/facebooklogin","sohbet",'1020','700','center');
}
function facebookpop_first()
{
    $.fn.colorbox({
        href:BASE_URL+'ajax/ajax_login/facebook',
        width:"620px",height:"200px"
        }); 
} 
function ajax_next(next)
{
    $.fn.colorbox({
        href:BASE_URL+'ajax/ajax_login/'+next,
        width:"50%",height:"50%"
        }); 
        $("#tmp_frame").attr('src','about:blank');
}

$(function() { 
	$(".scrollable").scrollable({circular: true,vertical: true}).autoscroll(2000)
});
