﻿// JScript 文件
if (top.location != location) top.location.href = location.href;
function $my(ob){	return document.getElementById(ob);}
function drop_mouseout(pos){
	var posSel=$my(pos+"Sel").style.display;
	if(posSel=="block"){
		timer = setTimeout("drop_hide('"+pos+"')", 3000);
	}
}
function drop_hide(pos){
	$my(pos+"Sel").style.display="none";
}
function search_show(pos,sortid){
	$my("searchsort").value = sortid;
	$my("hf_searchrido").innerHTML = pos;
}

function dropsearchselect()
{
    if(document.getElementById('headSel').style.display=='none')
    {
        document.getElementById('headSel').style.display='block';
    }
    else 
    {
        document.getElementById('headSel').style.display='none';
    }
}
    
function search_ckdt()
{
	var skw = $my("txtsearch").value;
	if(skw=="")
	{
	   alert('请输入要搜索的关健词');
	   $my("txtsearch").value="";
	   $my("txtsearch").focus();
	   return false; 
	}
	return true;
}

function index_log_ckdt()
{
	if($my("txtusername").value=="")
	{
	    alert('请输入用户名');
	    $my("txtusername").focus();
	    return false; 
	}
	if($my("txtuserpassword").value=="")
	{
	   alert('请输入密码');
	   $my("txtuserpassword").focus();
	   return false; 
	}
	return true;
}

function myGod(id,w,n){
	var box=document.getElementById(id),can=true,w=w||1500,fq=fq||10,n=n==-1?-1:1;
	box.innerHTML+=box.innerHTML;
	box.onmouseover=function(){can=false};
	box.onmouseout=function(){can=true};
	var max=parseInt(box.scrollHeight/2);
	new function (){
		var stop=box.scrollTop%20==0&&!can;
		if(!stop){
			var set=n>0?[max,0]:[0,max];
			box.scrollTop==set[0]?box.scrollTop=set[1]:box.scrollTop+=n;
		};
		setTimeout(arguments.callee,box.scrollTop%20?fq:w);
	};
};

        
function createXMLHttp(){  
        if (window.XMLHttpRequest) {   
            return(new XMLHttpRequest());   
        }   
        var arr_t = [   
            'MSXML2.XMLHTTP.3.0',   
            'MSXML2.XMLHTTP',   
            'Microsoft.XMLHTTP'  
        ]   
        for(var i=0; i<arr_t.length; i++) {   
            try {   
                xmlhttp_ver = arr_t[i];   
                return new ActiveXObject(arr_t[i]);   
            }catch(e) {}   
        }   
        return null ;   
}
        
function GetCity()
{
    var url="/WebServices/WebService.asmx/GetCity";
    var http_Request = new Request({
    method: "post",
    url: url,
    onSuccess: function (responseText) {
        document.getElementById("hfheadcityid").innerHTML = responseText;
    },
    onFailure: function () {
        document.getElementById("hfheadcityid").innerHTML = "error";
    }
    });
    http_Request.send("url=" + url);  
}

function CityShow(show,unshow)
{
    $(show+'bd').className="hf_regtopon";
    $(unshow+'bd').className="hf_regtopli";
    $(show).style.display = '';
    $(unshow).style.display = 'none';
}

function GetUser_main()
{
    var hf_m_userunlstr = "<li>";
    hf_m_userunlstr += "                <form id=\"m_login\" name=\"m_login\" method=\"post\" action=\"/UserLogin.aspx\">";
    hf_m_userunlstr += "                <span>";
    hf_m_userunlstr += "                用户名：<input type=\"text\" id=\"txtusername\" tabindex=\"1\" name=\"txtusername\" class=\"hfinput\"/><br />";
    hf_m_userunlstr += "                密　码：<input type=\"password\" id=\"txtuserpassword\" tabindex=\"2\" name=\"txtuserpassword\" class=\"hfinput\"/>";
    hf_m_userunlstr += "                </span>";
    hf_m_userunlstr += "                <em>";
    hf_m_userunlstr += "                    <input name=\"image\" type=\"image\" src=\"/images/login_bt.gif\" onclick=\"return index_log_ckdt();\" />";
    hf_m_userunlstr += "                </em>";
    hf_m_userunlstr += "                </form>";
    hf_m_userunlstr += "            </li>";
    hf_m_userunlstr += "            <li style=\"text-align:center;\">";
    hf_m_userunlstr += "                <a href=\"/UserReg.aspx\" target=\"_blank\" style=\"color:#FF7800;\">免费注册</a> | <a href=\"/Forgetpassword.aspx\" target=\"_blank\">忘记密码?</a>";
    hf_m_userunlstr += "            </li>";

    
    var url="/WebServices/WebService.asmx/GetUser";
    var http_Request = new Request({
    method: "post",
    url: url,
    onSuccess: function (responseText) {
        if(responseText.indexOf("NULL") == -1)
        {
            var hf_m_userlstr = "<li>";
            hf_m_userlstr += "欢迎您： <a href=\"/user/\" target=\"_blank\" style=\"color:#FF7800;\">" + responseText+"</a><br />";
            hf_m_userlstr += "<a href=\"/info/poststep1.html\" target=\"_blank\"> 免费发布分类信息 </a><a href=\"/life/postlife.aspx\" target=\"_blank\">免费登记商铺</a></li>";
            hf_m_userlstr += "<li style=\"text-align:center;\">";
            hf_m_userlstr += "<a href=\"/user/\" target=\"_blank\">用户中心</a> | <a href=\"/UserLoginOut.aspx\">退出</a>";
            hf_m_userlstr += "            </li>";
            document.getElementById("hf_m_userplan").innerHTML = hf_m_userlstr;
        }
        else
        {
            document.getElementById("hf_m_userplan").innerHTML = hf_m_userunlstr;
        }
    },
    onFailure: function () {
        document.getElementById("hf_m_userplan").innerHTML = hf_m_userunlstr;
    }
    });
    http_Request.send("url=" + url); 
}

function GetUser()
{
    var url="/WebServices/WebService.asmx/GetUser";
    var http_Request = new Request({
    method: "post",
    url: url,
    onSuccess: function (responseText) {
        if(responseText.indexOf("NULL") == -1)
        {
            document.getElementById("UserInfo").innerHTML = "欢迎您： " + responseText + " <a href=\"/user/\" target=\"_blank\">用户中心</a>  <a href=\"/UserLoginOut.aspx\">退出</a>";
        }
        else
        {
            document.getElementById("UserInfo").innerHTML = "欢迎您：游客 <a href=\"/UserLogin.aspx\">登录</a> <a href=\"/UserReg.aspx\" target=\"_blank\">注册</a>";
        }
    },
    onFailure: function () {
        document.getElementById("UserInfo").innerHTML = "欢迎您：游客 <a href=\"/UserLogin.aspx\">登录</a> <a href=\"/UserReg.aspx\" target=\"_blank\">注册</a>";
    }
    });
    http_Request.send("url=" + url);  
}

function SetMenuon(liid)
{
    $(liid).className = "current";
}

function doZoom(divname,size){
 $(divname).style.fontSize = size + "px";
}

var formcommchk = function()
{
    var isok=true;
    var errormest="";
    var txttxtcommcontentjs=$('txtcommcontent').get('value');//内容
    if(txttxtcommcontentjs.length < 4 || txttxtcommcontentjs > 1000)
    {
        isok=false;
        errormest+="评论内容应在4到1000个字符以内！\r<br />";
    }
    
    if(!isok)
    {
        showWin1(errormest);
        return false;
    }
    
}

var postcommfloor = function(str){
    $('txtcommcontent').value = "〖回复："+str+"〗";
}

/* easytabs */
/*第一种形式 第二种形式 更换显示样式*/   
function setTab(m,n){   
 var tli=document.getElementById("menu"+m).getElementsByTagName("li");   
 var mli=document.getElementById("main"+m).getElementsByTagName("ul");   
 for(i=0;i<tli.length;i++){   
  tli[i].className=i==n?"hf_newsnow":"";   
  mli[i].style.display=i==n?"block":"none";   
 }   
}

function setTablg(m,n){   
 var tli=document.getElementById("menu"+m).getElementsByTagName("li");   
 var mli=document.getElementById("main"+m).getElementsByTagName("ul");   
 for(i=0;i<tli.length;i++){   
  tli[i].className=i==n?"hf_actionnow":"";   
  mli[i].style.display=i==n?"block":"none";   
 }   
}

var showupimg = function(inputtxt)
{
    $my("hf_inputimg").style.display="none";
    $(inputtxt).value = "";
    $my("hf_upimg").style.display="block";
}

var hideupimg = function()
{
    $my("hf_inputimg").style.display="block";
    $my("hf_upimg").style.display="none";
}

var showupimg_other = function(inputtxt,showdiv,hiddiv)
{
    $my(hiddiv).style.display="none";
    $(inputtxt).value = "";
    $my(showdiv).style.display="block";
}
var hideupimg_other = function(showdiv,hiddiv)
{
    $my(showdiv).style.display="block";
    $my(hiddiv).style.display="none";
}

var brandsetimg = function(imgid)
{
    $(imgid).src = "/images/brand/"+imgid+"_2.gif";
}
var brandsetimgover = function(imgid)
{
    $(imgid).src = "/images/brand/"+imgid+"_1.gif";
}

function bookmark(){
    var title=document.title
    var url=document.location.href
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if( window.opera && window.print ){
    var mbm = document.createElement('a');
    mbm.setAttribute('rel','sidebar');
    mbm.setAttribute('href',url);
    mbm.setAttribute('title',title);
    mbm.click();}
    else if( document.all ) window.external.AddFavorite( url, title);
}

function getNowFormatDate()
{
   var day = new Date(); 

   var Year = 0;
   var Month = 0;
   var Day = 0;
   var CurrentDate = "";
   //初始化时间   
   Year       = day.getFullYear();
   Month      = day.getMonth()+1;
   Day        = day.getDate();
   
   CurrentDate += Year + "-";
   
   if (Month >= 10 )
   {
    CurrentDate += Month + "-";
   }
   else
   {
    CurrentDate += "0" + Month + "-";
   }
   if (Day >= 10 )
   {
    CurrentDate += Day ;
   }
   else
   {
    CurrentDate += "0" + Day ;
   } 
   return CurrentDate;
} 

function checkEndDate( edate ) {
var today = getNowFormatDate(); 
var startDate = new Date(today.replace("-",",")).getTime() ;
var endDate = new Date(edate.replace("-",",")).getTime() ;

    if( startDate > endDate ) 
    {  
       $my("lietime").style.display="block";
       $my("litel").style.display="none";
       document.getElementById("hf_pass_mesg").innerHTML ="该信息已过期，用户联系方式已关闭！";
    }
    else
    {
        $my("litel").style.display="block";
        $my("lietime").style.display="none";
    }
}


var checkcompanyadd=function()
{
    var isok=true;
    var errormest="";
    var txtcompanynamejs = $('txtcompanyname').get('value');//标题
    if(txtcompanynamejs.length ==""||txtcompanynamejs > 25)
    {
        isok=false;
        errormest+="公司名称不能为空且在25个字符以内！\r<br />";
    }
    var txtcompanytypejs=$('txtcompanytype').get('value');//
    if(txtcompanytypejs==0)
    {
       isok=false;
        errormest+="请选择企业性质！\r<br />"; 
    }
    var txtcategoryfidjs=$('txtcategoryfid').get('value');//
    if(txtcategoryfidjs==0)
    {
       isok=false;
        errormest+="请选择行类大分类！\r<br />"; 
    }
    var txtcategoryidjs=$('txtcategoryid').get('value');//
    if(txtcategoryidjs==0)
    {
       isok=false;
        errormest+="请选择行类小分类！\r<br />"; 
    }
    var txtzhucezibenjs=$('txtzhuceziben').get('value');//
    if(txtzhucezibenjs.length=="")
    {
       isok=false;
        errormest+="请填写注册资本！\r<br />"; 
    }
    var txtprovinceidjs=$('txtprovinceid').get('value');//
    if(txtprovinceidjs.length==0)
    {
       isok=false;
        errormest+="请填选择公司所在区域！\r<br />"; 
    }
    var txtaddressjs=$('txtaddress').get('value');//
    if(txtaddressjs.length=="")
    {
       isok=false;
       errormest+="请填写详细地址！\r<br />"; 
    }
    
    var txtcompanycontentjs = $('txtcompanycontent').get('value');//
    if(txtcompanycontentjs.length =="")
    {
        isok=false;
        errormest+="公司简介不能为空！\r<br />";
    }
    var txtlxusernamejs = $('txtlxusername').get('value');//
    if(txtlxusernamejs.length =="")
    {
        isok=false;
        errormest+="联系人姓名不能为空！\r<br />";
    }
    var txtlxteljs = $('txtlxtel').get('value');//
    if(txtlxteljs.length =="")
    {
        isok=false;
        errormest+="联系人电话不能为空！\r<br />";
    }
     var txtbusinessmodeljs=$('txtbusinessmodel').get('value');//
    if(txtbusinessmodeljs==0)
    {
       isok=false;
        errormest+="请选择行类经营模式！\r<br />"; 
    }
    if(!isok)
    {
        showWin1(errormest);
        return false;
    }
}


function Check_Company_Name(Nameid)
{
    var url="/ajax/check_exit.aspx?type=company&checkvalue="+escape($(Nameid).get('value'));
    var http_Request = new Request({
    method: "post",
    url: url,
    onSuccess: function (responseText) {
        if(responseText!="")
        {
            alert(responseText);
        }
    },
    onFailure: function () {
        //alert(responseText);
    }
    });
    http_Request.send("url=" + url);  
}

function Check_Bradn_Name(Nameid)
{
    var url="/ajax/check_exit.aspx?type=brand&checkvalue="+escape($(Nameid).get('value'));
    var http_Request = new Request({
    method: "post",
    url: url,
    onSuccess: function (responseText) {
        if(responseText!="")
        {
            alert(responseText);
        }
    },
    onFailure: function () {
        //alert(responseText);
    }
    });
    http_Request.send("url=" + url);  
}

var Check_GuestBook_Post = function(){
    var txttitlejs = $('txttitle').get('value');
    if(txttitlejs.length == "")
    {
        alert("请填信息标题！");
        document.getElementById("txttitle").focus();
        return false;
    }
    var txtlogojs = $('txtlogo').get('value');
    if(txtlogojs.length != "")
    {
        if((txtlogojs.indexOf(".jpg")== -1)&&(txtlogojs.indexOf(".gif")== -1)&&(txtlogojs.indexOf(".jepg")== -1)&&(txtlogojs.indexOf(".bmp")== -1)&&(txtlogojs.indexOf(".JPG")== -1)&&(txtlogojs.indexOf(".JPEG")== -1)&&(txtlogojs.indexOf(".GIF")== -1)&&(txtlogojs.indexOf(".BMP")== -1))
        {
            alert("图片格式不正确！");
            document.getElementById("txtlogo").focus();
            return false;
        }
    }
    var txtlogoupjs = $('txtlogoup').get('value');
    if(txtlogoupjs.length != "")
    {
        if((txtlogoupjs.indexOf(".jpg")== -1)&&(txtlogoupjs.indexOf(".gif")== -1)&&(txtlogoupjs.indexOf(".jepg")== -1)&&(txtlogoupjs.indexOf(".bmp")== -1)&&(txtlogoupjs.indexOf(".JPG")== -1)&&(txtlogoupjs.indexOf(".JPEG")== -1)&&(txtlogoupjs.indexOf(".GIF")== -1)&&(txtlogoupjs.indexOf(".BMP")== -1))
        {
            alert("上传图片格式不正确！");
            document.getElementById("txtlogoup").focus();
            return false;
        }
    }
   var txtcontentjs = $('txtcontent').get('value');
    if(txtcontentjs.length == "")
    {
        alert("请填信息内容！");
        return false;
    }
}
