function showpopup(type){
    $.fn.colorbox({iframe:true, href:"changeinfo.php?type="+type, open:true, width:'60%', height:'60%', title:"Edit account details"});
}

function msg(id){
    $.fn.colorbox({iframe:true, href:"viewmessage.php?id="+id, open:true, width:'60%', height:'60%', title:"Message details"});
}

function closepop(){
    $.fn.colorbox.close();
}

function changesuccess(){
    closepop();
    window.location.href = "profile.php";
}

$(document).ready(function(){
    var currH = $(document).height();
    var winH = $(window).height()-300;
    var newH = currH-300;
    if(newH<winH)
    newH = winH;
    $(".right").css('height',newH+'px');
    
});

function more_info(level){
    $.fn.colorbox({iframe:true, href:"viewlevel.php?level="+level, open:true, width:'60%', height:'80%', title:"Level details"});
}

function update_portal(id){
    var username = $("#"+id).val();
    $.post("assets/ajax/portal.php", "username="+username+"&type="+id, function(data){
        alert(data.msg);
    }, 'json');
}

function invalid_link(type,username){
    var x = confirm("Are you sure you want to report this "+type+" link as inactive?");
    if(x){
        $.post("assets/ajax/reportlink.php", "username="+username+"&type="+type, function(data){
            alert(data.msg);
        }, 'json');
    }
}
