﻿var fCallBack;

function showLogin() {
    if ($("#dlfancybox").size() == 0) {
        $("body").append('<a id="dlfancybox" href="###"></a>');
    }
    $("a#dlfancybox").addClass("iframe").attr('href', 'http://group.chinaaet.com/My/poplogin.aspx').fancybox({ 'hideOnContentClick': false, 'overlayShow': false, 'frameWidth': 434, 'frameHeight': 260 }).trigger('click');
}

function closPop(a, b) {
    $("#fancy_outer").hide();
    $.fn.fancybox.close;
    if (typeof fCallBack === 'function')
        fCallBack();
}


function message(msg) {
    $.facebox.settings.fadeout = 2000;
    $.facebox.loading()
    $.facebox.reveal("<span style=\"color:#666666;font-weight:800;\">"+msg+"</span>");
}

function ValidSubmit() {
    if ($.trim($(".txtTitle").val()).length == 0) {    
        alert("标题不能为空")
        return false;
    }
    else if (CKEDITOR.instances.ctl00_ContentPlaceHolder1_txtDetail.getData() == "") {
        alert("内容不能为空")
        CKEDITOR.instances.ctl00_ContentPlaceHolder1_txtDetail.focus();
        return false;
    }
    else if ($.trim($(".txtTags").val()).length == 0) {
    alert("标签不能为空")
    $(".txtTags").focus();
        return false;
    }

    return ValidScoreAjax();
}

function Search() {
    var key = document.getElementById("keyword");
    var aim = document.getElementById("search-aid");
    if (key.value != '' && key.value != '请输入关键字') {
        location.href = aim.value + escape(key.value);
    } else {
        alert("请输入关键字");
        key.focus();
        return false;
    }
}

function ValidScoreAjax() {    
    var score = parseInt($("#score").val());
    var totalScore = parseInt($("#score").next("span").contents(".point").text());
    var expertScore = parseInt($("#ShowExpert").next("div").contents(".point").text());
    var expertUser = parseInt($("#ddlexpert").val());
    if (expertUser != 0) {
        score = score + expertScore
    }
    //alert(score + "," + expertScore + "," + totalScore);
    if (score > totalScore) {
        alert("您的积分不够");
        return false;
    }
    return true;
}       
                      
