var testMessageBox=function(ev,id){
    var objPos = mousePosition(ev);
    var cont = '<div class="back">'
            +'<div class="poptop"><span class="closes" onclick="closeWindow();"></span>\u95EE\u9898\u53CD\u9988</div>'
            +'<p><span>\u8054\u7CFB\u65B9\u5F0F\uFF1A</span><input type="text" id="tel" value="\u8BF4\u660E\u8054\u7CFB\u65B9\u5F0F\u7C7B\u578B\uFF01" onfocus=\'this.value=""\' style="color:#d3d3d3"  /><label for="msg" class="dis">\u683C\u5F0F\u5982qq:123456</label></p>'
            +'<p class="tey"><span>\u95EE\u9898\u53CD\u9988\uFF1A</span><textarea name="bugcontent" id="bugcontent"  cols="10" rows="5"></textarea><label for="msg2">\u5185\u5BB9\u5B57\u6570\u5E94\u572810--250\u7684\u8303\u56F4\u5185\uFF01</label></p>'
            +'<p id="p_checkcode" class="dis"><span>\u9A8C\u8BC1\u7801\uFF1A</span><input name="checkcode" id="checkcode" style="width: 80px;" type="text" /><label for="msg1" class="dis">\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801\uFF01</label><img src="/index/valicode/" id="valicode" style="cursor:pointer;" onclick="this.src=\'/index/valicode/id-\'+Math.ceil(Math.random()*100000)+\'.shtml\';" /></p>'
            +'<p><input name="subms" id="subms" type="button" class="feed" /> <a href="/bug/" target="_blank">\u67E5\u770B\u66F4\u591A\u53CD\u9988</a></p>'
    +'</div>';
    messContent=id==""?cont:$(id).html();
    showMessageBox(messContent,objPos,350);
}
$("#nav li").hover(
  function() { $(this).addClass("iehover"); },
  function() { $(this).removeClass("iehover"); }
  );
$("#bugcontent").live("blur",function(){
    if($(this).val()==''){
        $("label[for='msg2']").html("\u8BF7\u8F93\u5165\u95EE\u9898\u5185\u5BB9\uFF01");
        $("#p_checkcode").hide();
   }else if($(this).val().length>250||$(this).val().length<10){
        $("label[for='msg2']").html("\u5185\u5BB9\u5B57\u6570\u5E94\u572810--250\u7684\u8303\u56F4\u5185\uFF01");
        //$("label[for='msg2']").show();
        $("#p_checkcode").hide();
   }else{
        $("label[for='msg2']").html("");
        $("#p_checkcode").show();
    }
});
var checkval=0;
$("#checkcode").live("blur",function(){
     if($("#checkcode").val()==''){
        $("label[for='msg1']").show();
        return false;
    }else{
        $("label[for='msg1']").hide();
    }
    var url="/bug/ajax_checkvalicode/v-"+encodeURI($("#checkcode").val())+"-d-"+Math.ceil(Math.random()*100000)+".shtml";
    var returnValue = $.ajax({url: url, async: false}).responseText;
    if (returnValue==0) {
        $("label[for='msg1']").show();
        $("label[for='msg1']").html('\u9A8C\u8BC1\u7801\u4E0D\u6B63\u786E\uFF01');
    }else{
        $("label[for='msg1']").hide();
        checkval=1;
    }
});
$("#subms").live("click",function(){
    if(!checkval) {alert("\u8BF7\u6838\u5B9E\u8981\u63D0\u4EA4\u7684\u5185\u5BB9\uFF01");return false;}
    var tel=($("#tel").val()!=="\u8BF4\u660E\u8054\u7CFB\u65B9\u5F0F\u7C7B\u578B\uFF01")?$("#tel").val():"null";
    var usercc = getCookie("lu")?getCookie("lu"):"\u533F\u540D";
    var returnValue = $.ajax({url: "/bug/ajax_addbuginfo/",type: "POST", data: "v="+encodeURI($("#checkcode").val())+"&t="+encodeURI(tel)+"&x="+encodeURI(usercc)+"&c="+encodeURI($("#bugcontent").val()), async: false}).responseText;
    if (returnValue==1) {
        alert('\u63D0\u4EA4\u6210\u529F\uFF01');
        closeWindow();
    }else{
       alert('\u63D0\u4EA4\u5931\u8D25\uFF01');
    }
});
var tips;var theTop = 202;var old = theTop;
var initFloatTips=function(){
    tips = document.getElementById('nav');
    moveTips();
}
var moveTips=function(){
    var tt=50;
    if (window.innerHeight){
    pos = window.pageYOffset
    }else if (document.documentElement && document.documentElement.scrollTop) {
    pos = document.documentElement.scrollTop
    }else if (document.body) {
    pos = document.body.scrollTop;
    }
    pos=pos-tips.offsetTop+theTop;
    pos=tips.offsetTop+pos/10;
    if (pos < theTop){
     pos = theTop;
    }
    if (pos != old) {
     tips.style.top = pos+"px";
     tt=10;
    }
    old = pos;
    setTimeout(moveTips,tt);
}
initFloatTips();
if(typeof(HTMLElement)!="undefined"){
    HTMLElement.prototype.contains=function (obj){
    while(obj!=null&&typeof(obj.tagName)!="undefind"){
    if(obj==this) return true;
    obj=obj.parentNode;
    }
    return false;
    }
}
