﻿var u,r,i,c,t2,m,f,w,a,t=new Date();
var cType=false;
t.setYear(2000);
function a()
{
    if(parseInt((new Date()-t)/1000)<30)
    {
        alert("请稍后再做评论");
        return false;
    }
    ShowCode();
    r=_$("rcode").value;
    if(r.length!=6){alert("请填写验证码");_$("rcode").focus();return false;}
    u=_$("username").value;
    if(u.length<2){alert("请正确填写用户名");_$("username").focus();return false;}
    i=_$("info").value;
    if(i.length<50){alert("详细信息不得少于50个字");_$("info").focus();return false;}
    return true;
}
function b()
{
    if(parseInt((new Date()-t)/1000)<30)
    {
        alert("请稍后再留言");
        return false;
    }
    ShowCode();
    r=_$("rcode").value;
    if(r.length!=6){alert("请填写验证码");_$("rcode").focus();return false;}
    c=_$("comname").value;
    if(c.length<2){alert("请正确填写公司名");_$("comname").focus();return false;}
    u=_$("username").value;
    if(u.length<2){alert("请正确填写姓名");_$("username").focus();return false;}
    t2=_$("tel").value;
    if(t2.length<8){alert("请正确填写电话");_$("tel").focus();return false;}
    i=_$("info").value;
    if(i.length<20){alert("留言信息不得少于20个字");_$("info").focus();return false;}
    
    m=_$("mail").value;
    f=_$("fax").value;
    w=_$("web").value;
    a=_$("add").value;
    cType=true;
    return true;
}
function b2()
{
    _$("frmPost").reset();
}
function _$(o)
{
    return document.getElementById(o);
}
function ShowRCode()
{
    _$("MyCode").src="http://www.5jjdw.com/RCode.aspx?f=" + Math.random() ;
    _$("rcode").value="";
    _$("rcode").focus();
    return false;
}
function ShowCode()
{
    if(_$("ForCode").style.display!="")
    {
        _$("ForCode").style.display="";
        ShowRCode();
    }
}
function DateDiff(sDate1, sDate2){
    //var aDate, oDate1, oDate2, iDays;
    //aDate = sDate1.split("-")
    //oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
    //aDate = sDate2.split("-")
    //oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0])
    var iDays = parseInt((sDate1 - sDate2) / 1000 / 60 / 60 /24)
    return iDays
}

    function post(id)
    {
        if(a())
        {
            return ture;
        }
        return false;
    }
    
    function liuyan(id)
    {
        if(b())
        {
            return ture;
        }
        return false;
    }

function closeliuyan(){
	var narrowmen = document.getElementById("closediv");
	var narrowbox = document.getElementById("liuyanmain");
	var closebt = document.getElementById("closebt");
	if (narrowbox.style.display == "block"){
		narrowbox.style.display = "none";
		closebt.src="http://www.5jjdw.com/template/qy/default/images/open.gif";
		}
		else{
		narrowbox.style.display = "block";
		closebt.src="http://www.5jjdw.com/template/qy/default/images/close.gif";
		}
	}
function extbkboxove(str){document.getElementById("liuyandiv").style.display = "none";}

function navA(obj){
	obj.className="navA";
	}
function navB(obj){
	obj.className="none";
	}

$(document).ready(function () {
    if ($("#complaintMenu").length < 1) return;
    $("#complaintMenu").hover(function () { $("#complaintManager ul").slideDown(); }, function () { });
    $("#complaintManager").hover(function () { }, function () { $("#complaintManager ul").slideUp(); });
}
);

function complaint(userid, errtype) {
    var data = { "action": 'check_user_qy_contact', "userid": userid, "errtype": errtype };
    $.getJSON('http://www.5jjdw.com/common/check_user_qy_contact.ashx', data, function (json) {
        alert("我们会尽快与该企业联系并改正.感谢你的支持.");
    });
}
