﻿/*
+--------------------------------------------------------------------------+
| ※　(hdzc.com.cn.js)                       |   运行环境 : Asp.net环境    |
|                                            |   开发年月 : 2009年11月     |
|--------------------------------------------------------------------------|
|     程序设计 : Alin   QQ:410589305                                       |
|                                                                          |
|--------------------------------------------------------------------------|
|  声明:                                                                   |
|         本人保留本代码的原著权,擅自修改本程序造成的一切损失本人概不负责! |
|                                                      2008年11月08日      |
+--------------------------------------------------------------------------+
*/
function KeyDownLogin()
{
    if (event.keyCode == 13)
    {
       User.MainLogin(getObjValue('txtLoginName'),getObjValue('txtLoginPassword'),getObj('cbLoginCache').checked);return false;
    }
}

//User会员类
var User = new TUser();
function TUser()
{
    //用户登陆
    this.Login = function(username,password,isOnCache)
    {
        var cache = isOnCache==true ? 1 : 0;
        var bigID=0;
        //用户名判断
         if(getObj('bigID_0').checked==true)
        {
          bigID=1;
        }
        else if(getObj('bigID_1').checked==true)
        {
          bigID=2;
        }
        else 
        {
          alert("请选择您的会员类型！")
          return;
        }
        if(username=="" || username=="用户名" || password=="")
        {
          alert("请输入用户名和密码！")
          return;
        }
        else
        {
                $.ajax({
				url:"/Ajax/",
				data:"modul=1&mode=4&username="+username+"&password="+password+"&cache="+cache+"&bid="+bigID,
				dataType:'POST',
				async:false,
				cache: false,
				beforeSend:function(){
	
					$('#LoginInfo').html("正在加载数据，请稍等...<img src=\"/images/loading.gif\"/>");
				}, 
				success:function(msg){
					if(msg.indexOf("<OK/>")!=-1)
                    {
                        window.location.reload();
                        onCancel();
                    }
                    else
                    {
   
                        $('#LoginInfo').html("&nbsp;<font color=red>用户密码不正确，请检查</font>");
                        MsgBox(msg);
                       
                    }
				},
			    error:function(){
		
			     $('#LoginInfo').html("登陆失败<img src=\"/images/loading.gif\"/>");
				
				}	
			});
        }
    } //End Login
    
    //用户登陆
    this.MainLogin = function(username,password,isOnCache)
    {  
        var cache = isOnCache==true ? 1 : 0;
        if(username=="" || username=="用户名" || password=="")
        {
          alert("请输入用户名和密码！")
          return;
        }
        else
        {
                $.ajax({
				url:"/Ajax/",
				data:"modul=1&mode=4&username="+username+"&password="+password+"&cache="+cache,
				dataType:'POST',
				async:false,
				cache: false,
				beforeSend:function(){
				    $('#UnLogin').hide();
					$('#LoginInfo').html("正在加载数据，请稍等...<img src=\"/images/public/other/loading.gif\"/>");
				}, 
				success:function(msg){
					if(msg.indexOf("<OK/>")!=-1)
                    {
                        window.location.reload();
                        onCancel();
                    }
                    else
                    {
                       MsgBox(msg);
                       window.location.reload();
                           
                    }
				},
			    error:function(){
			     $('#UnLogin').show();
			     $('#LoginInfo').html("登陆失败<img src=\"/images/public/other/loading.gif\"/>");
				
				}	
			});
        }
    } //End Login
    
    
    //用户退出登录
    this.LoginOut = function()
    {
        ///<summary>退出登录</summary>
         $.ajax({
                type: "POST",
                url:"/Ajax/",
                data:"modul=1&mode=5",
                success: function(code)
                { 
                    if(code.indexOf("<OK/>")!=-1)
                    {
                       MsgBox(code);
                       window.location.reload();
                     
                    }
                    
                 } 
                }); 
      
    }
   
    this.LoginState=function()
    {
       $.ajax({
                type: "POST",
                url:"/Ajax/",
                data:"modul=1&mode=14",
                success: function(code)
                { 
                   $('#LoginInfo').html(arguments[0]);
                 } 
                }); 
    }
    this.GetSinaWeather=function()
    {
       $.ajax({
                type: "POST",
                url:"/Ajax/",
                data:"modul=1&mode=15",
                success: function(code)
                { 
                   $('#GetSinaWeather').html(arguments[0]);
                 } 
                }); 
    }
}

//Company会员类
var Hdzc = new THdzc();
function THdzc()
{
    //愿望搜索开始
    this.HdzcHopSearch=function()
    {
           var value_Key      = getObjValue("keyword");
           if(value_Key=="请输入愿望代码")
              {
                alert("请输入愿望代码");return;
              }
           else
           {
           var url = "/hdzc/winhua/wish/?action=list";
           url += value_Key?"&id="+value_Key:"";
           Control.goUrl(url);
           }
    }
    //end  CompanySearch
    
    
    //职场资讯新闻搜索  
this.HdzcDoctorSearch=function()
{
var key=document.getElementById("key").value;
var value_bid=getObjValue("ddlstGrade");
var value_sid=getObjValue("ddlstType");
var value_Key="";
 if(key=="" || key=="请输入关键字")
        {
            value_Key="";
        }
       else
      {
        value_Key=key;
      }
        
        var url = "/hdzc/winhua/health/?action=list";
           url += value_bid?"&bid="+value_bid:"";
           url += value_sid?"&sid="+value_sid:"";
           url += value_Key?"&key="+value_Key:"";
           
         Control.goUrl(url);
        
     
}

    
    
   this.GetNewsReply=function(id)
   {
    $.ajax({
		url:"/ajax/?modul=1&mode=18&id="+id+"&time"+new Date().toString(),
		type:'GET',
		success:function(){
			$('#NewsReply1').html(arguments[0]);
			$('#NewsReply2').html(arguments[0]);
		}
	});
   } 
    this.UpdateNewsReply=function(id)
   {
       var value_Key      = getObjValue("txtContent");
       if(value_Key.length ==0)
        {
            alert("评价内容不为空！！！");
            getObj("txtContent").focus();
            return;
        }
        else  if(value_Key.length > 200)
        {
            alert("内容太长，字数不能超过200");
            getObj("txtContent").focus();
            return;
        }
        else
        {

            if(getCookie_comment("submitted"+id) == null)
            {
	            setCookie_comment("submitted"+id,1,10*60*1)
	        }
            else
            {
                var submitted = parseInt(getCookie_comment("submitted"+id));
                if(submitted < 3)
                {
	                setCookie_comment("submitted"+id,++submitted,10*60*1);
                }else
                {
	                alert("对不起，您发帖速度太快了，请稍后再试！");
	                return false;
                }
            }
           
           if(value_Key!="")
                 {
                    $.ajax({
		                url:"/ajax/?modul=1&mode=19&id="+id+"&value="+value_Key+"&time"+new Date().toString(),
		                type:'GET',
		                success:function(msg){
			                alert(msg);
            			 
		                }
	                });
	                }
	    }
   } //end
   
    this.GetInfoReply=function(id)
   {
    $.ajax({
		url:"/ajax/?modul=5&mode=3&id="+id+"&time"+new Date().toString(),
		type:'GET',
		success:function(){
			$('#NewsReply1').html(arguments[0]);
			$('#NewsReply2').html(arguments[0]);
		}
	});
   } 
    this.UpdateInfoReply=function(id)
   {
       var value_Key      = getObjValue("txtContent");
       if(value_Key.length ==0)
        {
            alert("评价内容不为空！！！");
            getObj("txtContent").focus();
            return;
        }
        else  if(value_Key.length > 200)
        {
            alert("内容太长，字数不能超过200");
            getObj("txtContent").focus();
            return;
        }
        else
        {

            if(getCookie_comment("submitted"+id) == null)
            {
	            setCookie_comment("submitted"+id,1,10*60*1)
	        }
            else
            {
                var submitted = parseInt(getCookie_comment("submitted"+id));
                if(submitted < 3)
                {
	                setCookie_comment("submitted"+id,++submitted,10*60*1);
                }else
                {
	                alert("对不起，您发帖速度太快了，请稍后再试！");
	                return false;
                }
            }
           
           if(value_Key!="")
                 {
                    $.ajax({
		                url:"/ajax/?modul=5&mode=4&id="+id+"&value="+value_Key+"&time"+new Date().toString(),
		                type:'GET',
		                success:function(msg){
			                alert(msg);
            			 
		                }
	                });
	                }
	    }
   } //end
   
 this.yellowsearch=function(PlaceBigId)
{
var key=document.getElementById("keyword").value;
var a=document.getElementById("uyellowsearch1_type").rows.length; 
for(var i=0;i<a;i++)
{
    if(eval('document.all.uyellowsearch1_type_0').checked==true)
     {
     
     if(key=="")
       {
         window.open('/hdzc/winhua/life/yellow/yellow_List.aspx','_blank');
       }
       else
       {
        window.open('/hdzc/winhua/life/yellow/yellow_List.aspx?key='+key,'_blank');
       }
       
     } 
     else if(eval('document.all.uyellowsearch1_type_1').checked==true)
     {
         window.open('http://www.baidu.com/s?wd='+key+'&cl=3','_blank');
     }    
     else if(eval('document.all.uyellowsearch1_type_2').checked==true)
     {
         window.open('http://www.google.cn/search?hl=zh-CN&ie=GB2312&q='+key+'&meta=&aq=t','_blank');
     } 
     else if(eval('document.all.uyellowsearch1_type_3').checked==true)
     {
         window.open('http://search.yahoo.cn/search;_ylt=A0oGkmCCYX1HLxIASiul87UF?p='+key+'&ei=GB2312&iscqry=&fr=sfp','_blank');
     }
     else
     {
        alert("请选择搜索分类！")
        return;
     }   
 }//end
 

}
 this.addflower=function(id,userid)
   {
  
  
    $.ajax({
		url:"/ajax/?modul=5&mode=1&id="+id+"&uid="+userid+"&time"+new Date().toString(),
		type:'GET',
		success:function(){
			 alert("添加成功！");
			    window.location.reload();
		}
	});
   }//end addflower 
   
    this.AddOppose=function(id,userid)
   {
    $.ajax({
		url:"/ajax/?modul=5&mode=2&id="+id+"&uid="+userid+"&time"+new Date().toString(),
		type:'GET',
		success:function(){
			 alert("添加成功！");
			    window.location.reload();
		}
	});
   }//end addflower 
   
this.SearchInn= function(PlaceBigId,ClassBigId)
{
var strkey;

var   value_PlaceBig      = getObjValue(PlaceBigId),
              value_PositionBig   = getObjValue(ClassBigId),
              value_Key           = getObjValue("keyword");
              
 if( value_Key=="请输入关键字" || value_Key=="")
        {
          value_Key="";
        }
       
       var url = "/hdzc/winhua/life/chihe/ShopHome/WP_List.aspx?action=list";
           url += value_PlaceBig?"&sid="+value_PlaceBig:"";
           url += value_PositionBig?"&bid="+value_PositionBig:"";
           url += value_Key?"&key="+value_Key:"";
           
      Control.goUrl(url);   

}//end

this.NewsSearch= function(ClassBigId)
{
var strkey;
var  value_ClassBig   = getObjValue(ClassBigId),
     value_Key           = getObjValue("txtKey");
              
 if( value_Key=="请输入关键字" || value_Key=="")
        {
         	 alert("请输入关键字");
        }
       else
       {
       var url = "/hdzc/winhua/hdnews/search/?action=list";
           url += value_ClassBig?"&tid="+value_ClassBig:"";
           url += value_Key?"&key="+value_Key:"";
           
      Control.goUrl(url);  
       }
        

}//end
}
