﻿/*Begin Function VNidol top 10*/
function goNextVideoOld(page){		
    var action = $("#hidenAction").val();
    var type = $("#hidenType").val();
	$.post('post_data.aspx', { "action": action, "page" : page,"type":type, "act" : "NextVideoOld"}, function(data) { 
	     if (data!=""){
              var tmp = data;
              var arrRes = tmp.split('@@@@-----@@@@');
	          $("#"+action).append(arrRes[0]);

	          if (arrRes[1] != "0")
	          {
	              var goPage = '<a href="javascript:void(0)" id="href_sidebar" onclick="goNextVideoOld(' + arrRes[1] + ');return false;">Xem Tiếp các video cũ hơn</a>';
                  $("#paging-sidebar-"+action).html(goPage);
	          }
	          else
	          {
	              $("#paging-sidebar-"+action).remove();
              }
          }
    });	

}		

function goSideComment2(id, page, type){		
	$.post('post_data.aspx', { "id": id, "page" : page,"type":type, "act" : "commentNext"}, function(data) { 
	     if (data!=""){
              var tmp = data;
              var arrRes = tmp.split('@@@@-----@@@@');
	          $("#commentlist").append(arrRes[0]);

	          if (arrRes[1] != "0")
	          {
	              var goPage = '<a href="javascript:void(0)" id="href_sidebar" onclick="goSideComment2(' + id + "," + arrRes[1] + ',\''+type+'\');return false;">Đọc Tiếp các bình luận cũ hơn</a>';
                  $("#paging_sidebar").html(goPage);
	          }
	          else
	          {
	              $("#paging_sidebar").hide();
              }
          }
    });	

}			

function postBehindComment()
{
    $.post('post_data.aspx', { "id": $("#spot_id").val(), "name": $("#spot_name").val(), "email": $("#spot_email").val(),"comment": $("#spot_comment").val(), "act": "postComment", "type":"behindthescene_top10"},
            function(data) {                
                $("#spot_name").val("");
                $("#spot_email").val("(sẽ không hiển thị)");
                $("#spot_comment").val('Viết ý kiến của bạn tại đây');
                $("#psmoment_cm_scroll").html(data);
				psmoment_callback();
            });
	
}

function postBehindTopComment()
{  
    $.post('post_data.aspx', { "id": $("#past_id").val(), "name": $("#past_name").val(), "email": $("#past_email").val(),"comment": $("#past_comment").val(), "act": "postComment", "type":"behindthescene", "mtype":"behindthescene"},
            function(data) {            
                $("#past_name").val("");
                $("#past_email").val("(sẽ không hiển thị)");
                $("#past_comment").val("Viết ý kiến của bạn tại đây");
                //$("#past_comment").html('');
                $("#moment_cm_scroll").html(data);
				moment_callback();
            });
}
function postBehindTopComment2()
{  
    $.post('post_data.aspx', { "id": $("#judge_id").val(), "name": $("#judge_name").val(), "email": $("#judge_email").val(),"comment": $("#judge_comment").val(), "act": "postComment", "type":"behindthescene", "mtype":"behindthescene","showreport":"1"},
            function(data) {            
                $("#judge_name").val("");
                $("#judge_email").val("(sẽ không hiển thị)");
                $("#judge_comment").val("Viết ý kiến của bạn tại đây");
                //$("#past_comment").html('');
                $("#hotstar_cm_scroll").html(data);
				hotstar_callback();
            });
}

function QuestPrevNext(page)
{  
    $.post('post_data.aspx', { "contestant_id":$("#contestants_id").val(),"act": "PostQuestion","op":"listdata", "page":page},
    function(data) { 
        if (data!="")
        {   
            $("#boxquestionlist").html(data);
        }
    });  
}
function behind_videoTop10_detail(id){	
    
   $.ajax({
    type: "POST",
    url: "post_data.aspx?act=change_list_Behind_video&id="+id+"&mtype=video&type="+$("#type").val(),    
    //dataType: "json",
    success: function(res,status) {    
            var tmp = res;
            var arrRes = tmp.split('----');
			$("#funVideo").html(arrRes[0]);
			$("#listFun").html(arrRes[3]);	
			$("#spot_id").val(arrRes[2]);				
            if (arrRes[1] != "")
            {				
				$('#flashPlayer_psmoement').html('<object width="356" height="267"><param name="movie" value="swf/VideoPlayer_v03.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="auto_play" value="1"></param><param name="flashvars" value="video_url=../'+ arrRes[1] +'" /><embed src="swf/VideoPlayer_v03.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="356" height="267" flashvars="video_url=../'+ arrRes[1] +'&amp;auto_play=1"></embed></object>');				
			}
			Cufon.replace('h2, .font');
    }    
  });				
}
function change_list_Behind_videoTop10(order){    
   $.ajax({
    type: "POST",
    url: "post_data.aspx?act=change_list_Behind_video&order="+order+"&mtype=video&type="+$("#type").val(),           
    success: function(res,status) {    
            var tmp = res;
            var arrRes = tmp.split('----');
			$("#funVideo").html(arrRes[0]);
			$("#listFun").html(arrRes[3]);	
			$("#spot_id").val(arrRes[2]);					
            if (arrRes[1] != "")
            {				
				$('#flashPlayer_psmoement').html('<object width="356" height="267"><param name="movie" value="swf/VideoPlayer_v03.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="auto_play" value="1"></param><param name="flashvars" value="video_url=../'+ arrRes[1] +'" /><embed src="swf/VideoPlayer_v03.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="356" height="267" flashvars="video_url=../'+ arrRes[1] +'&amp;auto_play=0"></embed></object>');								
			}
			Cufon.replace('h2, .font');
    }    
  });			
	
}

function behind_videoTop_detail(id){	
    
   $.ajax({
    type: "POST",
    url: "post_data.aspx?act=change_list_Behind_video&id="+id+"&mtype=video&flag=1&order="+$("#orderss").val(),    
    data: ({"listidtop":$("#listidtop10").val()}),
    //dataType: "json",
    success: function(res,status) {    
            var tmp = res;
            var arrRes = tmp.split('----');
			$("#DesciptionTopOne").html(arrRes[0]);
			$("#lisTopVideoItems").html(arrRes[3]);	
			$("#spot_id_top").val(arrRes[2]);				
            if (arrRes[1] != "")
            {				
				$('#flashplayerTopOne').html('<object width="356" height="267"><param name="movie" value="swf/VideoPlayer_v03.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="auto_play" value="1"></param><param name="flashvars" value="video_url=../'+ arrRes[1] +'" /><embed src="swf/VideoPlayer_v03.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="356" height="267" flashvars="video_url=../'+ arrRes[1] +'&amp;auto_play=1"></embed></object>');
				//$("#psLink").attr("href", "video-detail.aspx?id="+arrRes[2]);
			}
			Cufon.replace('h2, .font');
    }    
  });				
}
function change_list_Behind_video(order){
    var type = $("#objtype").val();	    
   $.ajax({
    type: "POST",
    url: "post_data.aspx?act=change_list_Behind_video&order="+order+"&mtype=video",        
    data: ({"listidtop":$("#listidtop10").val()}),
    success: function(res,status) {    
            var tmp = res;
            var arrRes = tmp.split('----');
			$("#DesciptionTopOne").html(arrRes[0]);
			$("#lisTopVideoItems").html(arrRes[3]);	
			$("#spot_id_top").val(arrRes[2]);	
			$("#orderss").val(order);				
            if (arrRes[1] != "")
            {				
				$('#flashplayerTopOne').html('<object width="356" height="267"><param name="movie" value="swf/VideoPlayer_v03.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="auto_play" value="1"></param><param name="flashvars" value="video_url=../'+ arrRes[1] +'" /><embed src="swf/VideoPlayer_v03.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="356" height="267" flashvars="video_url=../'+ arrRes[1] +'&amp;auto_play=0"></embed></object>');				
			}
			Cufon.replace('h2, .font');
    }    
  });			
	
}


function contestant_video_detail(id){	
    
   $.ajax({
    type: "POST",
    url: "post_data.aspx?act=change_list_contestant_video&id="+id+"&type="+$("#objtype").val()+"&mtype=contestant",    
    //dataType: "json",
    success: function(res,status) {    
            var tmp = res;
            var arrRes = tmp.split('----');
			$("#funVideo").html(arrRes[0]);
			$("#listFun").html(arrRes[3]);	
			$("#spot_id").val(arrRes[2]);				
            if (arrRes[1] != "")
            {				
				$('#flashPlayer_psmoement').html('<object width="356" height="267"><param name="movie" value="swf/VideoPlayer_v03.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="auto_play" value="1"></param><param name="flashvars" value="video_url=../'+ arrRes[1] +'" /><embed src="swf/VideoPlayer_v03.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="356" height="267" flashvars="video_url=../'+ arrRes[1] +'&amp;auto_play=1"></embed></object>');
				$("#psLink").attr("href", "video-detail.aspx?id="+arrRes[2]);
			}
			Cufon.replace('h2, .font');
    }    
  });			
	
}


function postContestantComment()
{    
    $.post('post_data.aspx', { "id": $("#spot_id").val(), "name": $("#spot_name").val(), "email": $("#spot_email").val(),"comment": $("#spot_comment").val(), "act": "postComment", "type": $("#objtype").val(),"mtype":"contestant"},
            function(data) {                
                $("#spot_name").val("");
                $("#spot_email").val("(sẽ không hiển thị)");
                $("#spot_comment").val('Viết ý kiến của bạn tại đây');
                $("#psmoment_cm_scroll").html(data);
				psmoment_callback();
            });
	
}

function changeSong()
{
    var songid = $(".drplistSong").val();       
    $.post('post_data.aspx', { "contestant_id":$("#contestant_id").val(),"id":songid, "act": "postsong", "contestant_name":$("#contestant_name").val()},
    function(data) { 
        if (data!="")
        {   
            $("#Contestant_comment").html(data);         
        }
    });  
}
function changePhotoBanner(id)
{
    var picLarge = $("#"+id).attr("lang");
    $("#PicMainPhoto").attr("src", picLarge);    
}
function PostQuestion()
{
    var songid = $("#contestants_id").val();     
    var question = $("#questiontext").val();      
    $.post('post_data.aspx', { "contestant_id":$("#contestants_id").val(),"question":question,"act": "PostQuestion"},
    function(data) { 
        if (data!="")
        {   
            $("#msg_success_question").html("Câu hỏi của bạn đã được gửi đi. Cảm ơn bạn đã đặt câu hỏi").show();
            $("#questiontext").html("");
        }
    });  
}
function change_list_contestant_video(order){
    var type = $("#objtype").val();	    
   $.ajax({
    type: "POST",
    url: "post_data.aspx?act=change_list_contestant_video&type="+type+"&order="+order,        
    success: function(res,status) {    
            var tmp = res;
            var arrRes = tmp.split('----');
			$("#funVideo").html(arrRes[0]);
			$("#listFun").html(arrRes[3]);	
			$("#spot_id").val(arrRes[2]);					
            if (arrRes[1] != "")
            {				
				$('#flashPlayer_psmoement').html('<object width="356" height="267"><param name="movie" value="swf/VideoPlayer_v03.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="auto_play" value="1"></param><param name="flashvars" value="video_url=../'+ arrRes[1] +'" /><embed src="swf/VideoPlayer_v03.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="356" height="267" flashvars="video_url=../'+ arrRes[1] +'&amp;auto_play=0"></embed></object>');
				$("#psLink").attr("href", "video-detail.aspx?id="+arrRes[2]);
			}
			Cufon.replace('h2, .font');
    }    
  });			
	
}

/*End*/
/*Paul.Tanh update*/
function textareaComment(id,flag)
{
    var str = $("#" + id).val();    
    var txt = document.getElementById('' + id + '').lang;
    if (flag == 1 && str == txt) $("#" + id).val("");
    if (flag == 0 && (str == '' || str == ' ')) $("#" + id).val(txt);
}	

function getdata(stract) {
	
	//if (autoRotatePhoto) clearInterval(autoRotatePhoto);

    var strtype = $("#hidenType").val();
    var limit = parseInt( $("#limit").val());
    if (strtype != "") {
        $(".main-photoList").hide();
        strtext = trim($("#photo-list-top-" + stract).html());       
        if (strtext == "") {
             $('#loading').show();
            $.post("photo.aspx", { action: "" + stract + "", type: strtype, "limit":limit}, function (data) {
                if (data != "") {
                    $("#photo-list-top-" + stract).html(data);
                    $("#photo-list-top-" + stract).masonry({ columnWidth: 205 });                                         
                }
                $('#loading').hide();
            });
        }
        $("#photo-list-top-" + stract).show();
		
		//if (stract=="moi-nhat") autoRotatePhoto = setInterval( "getdata2()", 10000 );
    }
}
function getdatavideo(stract)
{
    var strtype = $("#hidenType").val();   
     $("#hidenAction").val("video-list-top-"+stract);
     $(".pagingcomment").hide();
     $("#paging-sidebar-video-list-top-"+stract).show();
    if (strtype != "") {
        $(".main-videoList").hide();
        strtext = trim($("#video-list-top-" + stract).html());                
        if (strtext == "") {
            $('#loading').show();            
            $.post("video.aspx", { action: "" + stract + "", type: strtype }, function (data) {
                if (data != "") {
                    $("#video-list-top-" + stract).html(data);
                }
                $('#loading').hide();
            });
        }
        $("#video-list-top-" + stract).show();      
    }
}
function getdatavideobehind(stract)
{
    var strtype = $("#hidenType").val();
    if (strtype != "") {
        $(".main-videoList").hide();
        strtext = trim($("#video-list-top-" + stract).html());        
        if (strtext == "") {
            $('#loading').show();
            $.post("behind-the-scene-list.aspx", { action: "" + stract + "", type: strtype }, function (data) {
                if (data != "") {
                    $("#video-list-top-" + stract).html(data);                    
                }
                $('#loading').hide();
            });
        }
        $("#video-list-top-" + stract).show();
       
    }
}
function getdatabuzz(stract, type) {
    var url = "";
    if (type == "photo") {
        url = "buzz-photo.aspx";
        $(".main-photoList").hide();        
    }
    if (type == "video") {
        url = "buzz-video.aspx";
        $(".main-videoList").hide();        
    }
    strtext = trim($("#ulListItems_" + stract).html());                
    if (strtext == "") {
        $('#loading').show();
        $.post(url, { action: "" + stract + "" }, function (data) {
            if (data != "") {
                $("#ulListItems_" + stract).html(data);  
                $("#ulListItems_" + stract).masonry({ columnWidth: 205 });                  
            }
            $('#loading').hide();
        });
    }
    $("#ulListItems_" + stract).show();
}

function postCommentOkie()
{
    var id = parseInt($("#txt_id").val());    
    var comment = $("#txt_comment").val();
    var type = $("#txt_types").val();  
    var fullname = $("#txt_fullname").val();     
    var email = $("#txt_email").val();  
    if (fullname=="" || email=="" || comment=="")   
    {
        $("#msgpost_success").html("<span style=\"color:Red\">Vui lòng nhập đầy đủ thông tin</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 50){
        $("#msgpost_success").html("<span style=\"color:Red\">Họ và tên của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 160){
        $("#msgpost_success").html("<span style=\"color:Red\">Thông diệp của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (id> 0 && comment.length>=3 && comment.length <=160 && type.length >0 && fullname.length >0 && email.length >0)
    {
        $("#submitcomment").attr('disabled', true);
        $("#txt_comment").val("");
        $("#txt_fullname").val("");
        $("#txt_email").val("");   
        $.post('post_data.aspx', { "id": id,"name":fullname, "email":email, "comment": comment,"act": "postComment", "type":type},
            function(data) { 
                if (data=="-1"){
                    $("#msgpost_success").html("<span style=\"color:Red\">Vui lòng đăng nhập trước</span>").show().fadeIn();
                }
                if (data=="0"){
                    $("#msgpost_success").html("<span style=\"color:Blue\">Ý kiến của bạn đã được gửi đi. Cảm ơn sự đóng góp của bạn.</span>").show().fadeIn();
                }
                else if (data!=""){                      
                    $("#commentlist").html(data);     
                    $("#msgpost_success").html("<h4>Ý kiến của bạn đã được gửi đi. Cảm ơn sự đóng góp của bạn.</h4>").show().fadeIn();
                }
                $("#submitcomment").attr('disabled', false);
            });    
    }    
}
function postBuzzComment()
{
    var id = $("#txt_id").val();    
    var comment = $("#txt_comment").val();
    var type = $("#txt_types").val();  
    var fullname = $("#txt_fullname").val();     
    var email = $("#txt_email").val();  
    if (fullname=="" || email=="" || comment=="")   
    {
        $("#msgpost_success").html("<span style=\"color:Red\">Vui lòng nhập đầy đủ thông tin</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 50){
        $("#msgpost_success").html("<span style=\"color:Red\">Họ và tên của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 160){
        $("#msgpost_success").html("<span style=\"color:Red\">Thông diệp của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (id!="" && comment.length>=3 && comment.length <=160 && type.length >0 && fullname.length >0 && email.length >0)
    {    
        $.post('post_data.aspx', { "id": id,"name":fullname, "email":email, "comment": comment,"act": "postBuzzComment", "type":type},
            function(data) { 
                if (data=="-1"){
                    $("#msgpost_success").html("<span style=\"color:Red\">Vui lòng đăng nhập trước</span>").show().fadeIn();
                }
                if (data=="0"){
                    $("#msgpost_success").html("<span style=\"color:Red\">Thao tác bạn quá nhanh</span>").show().fadeIn();
                }
                else if (data!=""){
                    $("#txt_comment").val("");
                    $("#txt_fullname").val("");  
                    $("#txt_email").val("");     
                    $("#commentlist").html(data);     
                    $("#msgpost_success").html("<h4>Ý kiến của bạn đã được gửi đi. Cảm ơn sự đóng góp của bạn.</h4>").show().fadeIn();
                }
            });    
    }    
}
function postBuzzReply(comment_id)
{
    var id = $("#txt_id_"+comment_id).val();    
    var comment = $("#txt_comment_"+comment_id).val();
    var type = $("#txt_types_"+comment_id).val();  
    var fullname = $("#txt_fullname_"+comment_id).val();     
    var email = $("#txt_email_"+comment_id).val();  
    if (fullname=="" || email=="" || comment=="")   
    {
        $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Vui lòng nhập đầy đủ thông tin</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 50){
        $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Họ và tên của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 160){
        $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Thông diệp của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (comment_id >0 && id!="" && comment.length>=3 && comment.length <=160 && type.length >0 && fullname.length >0 && email.length >0)
    {    
        $.post('post_data.aspx', { "id": id,"name":fullname, "email":email, "comment": comment,"act": "postBuzzComment", "type":type, "parentid":comment_id},
            function(data) { 
                if (data=="-1"){
                    $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Vui lòng đăng nhập trước</span>").show().fadeIn();                   
                }
                if (data=="0"){
                   $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Thao tác bạn quá nhanh</span>").show().fadeIn();                   
                }
                else if (data!=""){
                    $("#txt_comment_"+comment_id).val("");
                    $("#txt_fullname_"+comment_id).val("");  
                    $("#txt_email_"+comment_id).val("");     
                    $("#commentreply_"+comment_id).html(data);                         
                    $("#msgpost_success_"+comment_id).html("<h4>Ý kiến của bạn đã được gửi đi. Cảm ơn sự đóng góp của bạn.</h4>").show().fadeIn();
                    $('.commentFormReply').hide();
                }
            });    
    }    
}

function postCommentReply(comment_id)
{
    var id = parseInt($("#txt_id_"+comment_id).val());    
    var comment = $("#txt_comment_"+comment_id).val();
    var type = $("#txt_types_"+comment_id).val();  
    var fullname = $("#txt_fullname_"+comment_id).val();     
    var email = $("#txt_email_"+comment_id).val();  
    if (fullname=="" || email=="" || comment=="")   
    {
        $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Vui lòng nhập đầy đủ thông tin</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 50){
        $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Họ và tên của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (fullname.length > 160){
        $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Thông diệp của bạn quá dài</span>").show().fadeIn();
        return;
    }
    if (comment_id >0 && id> 0 && comment.length>=3 && comment.length <=160 && type.length >0 && fullname.length >0 && email.length >0)
    {    
        $.post('post_data.aspx', { "id": id,"name":fullname, "email":email, "comment": comment,"act": "postComment", "type":type, "parentid":comment_id},
            function(data) { 
                if (data=="-1"){
                    $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Vui lòng đăng nhập trước</span>").show().fadeIn();                   
                }
                if (data=="0"){
                   $("#msgpost_success_"+comment_id).html("<span style=\"color:Red\">Thao tác bạn quá nhanh</span>").show().fadeIn();                   
                }
                else if (data!=""){
                    $("#txt_comment_"+comment_id).val("");
                    $("#txt_fullname_"+comment_id).val("");  
                    $("#txt_email_"+comment_id).val("");     
                    $("#commentreply_"+comment_id).html(data);                         
                    $("#msgpost_success_"+comment_id).html("<h4>Ý kiến của bạn đã được gửi đi. Cảm ơn sự đóng góp của bạn.</h4>").show().fadeIn();
                    $('.commentFormReply').hide();
                }
            });    
    }    
}


function show_box(id) {
    $.blockUI({ message: $('#' + id), css: {              
        cursor: 'auto'        
    }
    });


}

function show_login() {
    show_box('login2');
    document.getElementById('top_usernames').focus();
}
function wait() {
    $.blockUI({ message: "Vui lòng chờ trong giây lát...", css: {
        padding: 10,
        backgroundColor: '#fff',
        cursor: 'auto'        
    }
    });
}
function close_box() {
    $.unblockUI();
}
function getdatagossip(stract) {

    var strtype = $("#hidenType").val();
    if (strtype != "") {
        $(".reporterOfTheMonth").hide();
        $(".bottomreporterlist").hide();        
        strtext = trim($("#top-" + stract).html());       
        if (strtext == "") {
             $('#loading').show();
            $.post("gossip.aspx", { action: "" + stract + "", type: strtype }, function (data) {
                if (data != "") {
                    list = data.split("--------------@@@@%%%%---------------");                    
                    if (list[0]!="");
                        $("#top-" + stract).html(list[0]);  
                    if (list[1]!="");
                        $("#bottom-" + stract).html(list[1]);                   
                }
                $('#loading').hide();
            });
        }
        $("#top-" + stract).show();                      
        $("#bottom-" + stract).show(); 
    }
}
function formForgotPassword() {  
         $('#loading').show();         
         $.post("forgotpassword.aspx", { act: "actForgotPassword", forgotEmail : $("#forgotEmail").val(), forgotCaptcha : $("#forgotCaptcha").val()}, function (data) { 
                if (data!=null)
                {   
                    if (data=="1"){
                        $("#errForgotPassword").html("Vui lòng nhập email");
                        $("#errForgotPassword").show(); 
                    }
                    else if (data=="2"){
                        $("#errForgotPassword").html("Địa chỉ email bạn không hợp lệ");
                        $("#errForgotPassword").show(); 
                    }
                    else if (data=="3"){
                        $("#errForgotPassword").html("Mã bảo mật bạn nhập không hợp lệ");
                        $("#errForgotPassword").show(); 
                    }
                    else if (data=="4"){
                        $("#errForgotPassword").html("Vui lòng bạn thử lại");
                        $("#errForgotPassword").show(); 
                    }
                    else
                    {
                       $("#boxforgotpass").html("Mật khẩu của bạn đã được gửi tới email thành công");
                    }        
                }
                $('#loading').hide();
            });
    }    
function formlogin() {  
     $('#loading').show();         
     $.post("signup.aspx", { act: "actlogin", usernames:$("#top_usernames").val(), passwords:$("#top_passwords").val(),securitycodelogin:$("#top_securitycodelogin").val()}, function (data) { 
            if (data!=null)
            {
                list = data.split("-------@@@-----"); 
                if (list[0]=="Fail"){
                    $("#Msglogin").html(list[1]);
                    $("#Msglogin").show();
                }
                if (list[0]=="Okie")   
                {
                    $("#boxforgotpass").html("Bạn đã đăng nhập thành công");
                    caobox.hide();
                    window.location = list[1];
                }        
            }
            $('#loading').hide();
        });
}    
function showboxcomment(commentid)
{
     $('.commentFormReply').hide();
     $('#commentForm_'+commentid).show();
}
function getdata2() {	
	slidePhotoOut(0);   
}


function slidePhotoOut(portInitNum){	
	var stract = "moi-nhat";
	
	//var portLength = $("#photo-list-top-moi-nhat li").length;
	var portLength = 12;
	
	$('#photo-list-top-moi-nhat li:eq('+portInitNum+')').animate({top:'+=600px', opacity:'0'}, 300);
	portInitNum=Number(portInitNum)+1;
	
	if (portInitNum<portLength) portInitFade=setTimeout("slidePhotoOut("+portInitNum+")", 50);
	else{
		clearTimeout(portInitFade);
		
		$("#photo-list-top-" + stract).show().css({height:'700px'});
		
		 if($('#moi-nhat').hasClass('active')) {
			var strtype = $("#hidenType").val();                
			if (strtype != "") {                       
				 $.post("photo.aspx", { action: "moi-nhat", type: strtype }, function (data) {
					if (data != "") {								
							$("#photo-list-top-" + stract).css({ visibility: "hidden"}).html(data);
							$("#photo-list-top-" + stract).masonry({ columnWidth: 205 });
							$("#photo-list-top-" + stract+" > li").hide().css("position", "absolute");
							$("#photo-list-top-" + stract).css({ visibility: "visible"}).find('li').fadeIn(500);
					}                
				});            
			}
		}
	}	
};

function getdatabuzzRandom() { 
      if($('#newest').hasClass('active')) {       
            stract= "newest";
            url = "buzz-photo.aspx";
            $.post(url, { action: "" + stract + "" }, function (data) {
                if (data != "") {
                    $("#ulListItems_" + stract).html(data);  
                    $("#ulListItems_" + stract).masonry({ columnWidth: 205 });  
                    $("#ulListItems_" + stract+" > li").css("position", "absolute");                
                }            
            });
       }
}
function ReportComment(cid, objid, obj_type)
{      
    list = cid.split("_"); 
    coment_id  = parseInt(list[1]);     
    var strMessage = $("#message_"+coment_id).html();
    if (coment_id>0 && objid.length>0 && obj_type!="" )
    {
        $.post("post_data.aspx", { "act": "reportcomment", "obj_id": objid, "type":obj_type, "commentid":coment_id, "message":strMessage}, function (data) {            
        });
    }
    $("#reportcoment_"+list[1]).hide();
}

