function openPictureOperator(operator, height) {
    var url = '/u/' + operator + '.html';
    var xopen = window.open(url, 'operatorwindow', 'width=600, height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=no, status=yes');
}

function openRingtoneOperator(operator, height) {
    var url = '/u/' + operator +'_cdl.html';
    var xopen = window.open(url, 'operatorwindow', 'width=600, height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=no, status=yes');
}

function openFunToneOperator(operator, height) {
    var url = 'http://mobi.kapanlagi.com/u/' + operator +'_funtone.html';
    var xopen = window.open(url, 'operatorwindow', 'width=600, height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=no, status=yes');
}

function openFunToneGprs(operator, height,width) {
    var url = 'http://mobi.kapanlagi.com/u/' + operator +'_funtone.html';
    var xopen = window.open(url, 'operatorwindow', 'width='+width+', height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=0, status=yes');
}

function openRBTOperator(operator, height) {
    var url = '/u/' + operator +'_rbt.html';
    var xopen = window.open(url, 'operatorwindow', 'width=600, height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=no, status=yes');
}

function openGameAppOperator(operator, height) {
    var url = '/u/' + operator +'_game.html';
    var xopen = window.open(url, 'operatorwindow', 'width=600, height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=no, status=yes');
}

function openKartuOperator(operator, height, id) {
    var url = '/u/' + operator + '.html?pid='+id;
    var xopen = window.open(url, 'operatorwindow', 'width=600, height='+ height +', location=no, scrollbars=yes, menubar=no, toolbar=no, resizable=no, status=yes');
}

function load_random_picture(a, c) {
    $(document).ready(function() {
        $.ajax({
            type: "POST",
            url: "../../u/random_preview2.php",
            data: "a="+a+"&c="+c,
            success: function(msg){
                $("#preview_rand_id").html(msg);
            }
        });
    });
}

function preview_back(d) {
    var re = document.referrer;
    if (re.match(/^http\:\/\/mobi\.kapanlagi\.com/g) || re.match(/^http\:\/\/www\.kapanlagi\.com\/partner\/disney/g)) {
        window.history.go(-1);
    }
    else {
        location = d;
    }
}

function play_ring(id) {
    var x = id.substr(0,1);
    var y = id.substr(1,4).replace(/^0*/g,'');
    var url = 'http://mobi.kapanlagi.com/u/demo.php?type=' + x + '&ringid=' + y;
    //window.alert(url);
    window.open(url, "ring_demo", "width=250, height=150, location=no, scrollbars=no, menubar=no, toolbar=no, resizable=yes, status=yes");
}

function checkType(val){
    if(val=="N") {
        document.getElementById("ring_kategori").value="all";
        document.getElementById("ring_kategori").disabled=true;
    }
    else {
        document.getElementById("ring_kategori").disabled=false;
    }
    return false;
}

function good_div_game() {
    var maks = 0;
    $(".item_content").each(function() {
        var ttmp = $(this).height();
        if (maks < ttmp) {
            maks = ttmp;
        }
    });
    $(".item_content").each(function() {
        $(this).height(220);
    });
}

var x;
var conter = 0;
$(document).ready(function() {
    var u = document.location.href;
    var dl = 'content_left_sub';
    if (u.substr(0,50) == 'http://mobi.kapanlagi.com/index.html' || u == 'http://mobi.kapanlagi.com/') {
        dl = 'content_left';
        x = window.setTimeout("div_cek('"+dl+"')", 1);
    }

    $('.paging_small_abjad').each(function() {
        $(this).mouseover(function() {
            $(this).css('background-color', '#bbbbbb');
        });
        $(this).mouseout(function() {
            $(this).css('background-color', '#999999');
        });
    });
    
    // banner load
    $('#banwin').load('http://mobi.kapanlagi.com/u/addsm.php');
});

function div_cek(dl) {
    var l = $('.'+dl).height();
    var r = $('.content_right').height();
    //if (r > l) $('.'+dl).height(r);
    if (l > r) $('.content_right').height(l);

    if (conter >= 5) {
        window.clearTimeout(x);
    }
    conter++;
}