﻿	    function LoadCode()
	    {
		    try
		    {
			    document.getElementById("checkCode").src="/KeyCode.aspx?rnd=" + Math.random();
		    }
		    catch(e)
		    {}
	    }
        //通用弹出层
        $(document).ready(function(){
	        //t弹出层随屏滚动
	        $(window).scroll(function(){
		        $('.lightBox_wrap').animate({top:$(document).scrollTop()+$(window).height()/2-$('.lightBox_wrap').height()/2},{duration:222, queue:false});
	        });
        });
        function show(type)
        {
            if(type == 1)
            {
                var ui = $("#userid").val();
                if(ui > 0)
                {
                    show1(0);
                }
                else
                {
                    show1(1);
                }
            }
            else
            {
                var ui = $("#userid").val();
                if(ui > 0)
                {
                    show1(0);
                }
                else
                {
                    show1(1);
                }
            }
        }
        function show1(type)
        {
            var content = "";
            if(type == 1)
            {
                //登录
                content = "<dt><strong>会员登录</strong><img src='/images/close.gif' id='close' onclick='xxx()' /></dt>";
                content += "<dd style='width:400px;height:180px;'>";
                content += "<table cellpadding='0' cellspacing='0' class='ligbox_table'><tr>";
                content += "<th>用户名：</th><td><input type='text' id='txtusername' name='txtusername' /></td>";
                content += "</tr><tr>";
                content += "<th>密码：</th><td><input type='password' id='txtpassword' name='txtpassword' /></td>";
                content += "</tr><tr>";
                content += "<td></td><td><a target='_blank' href='http://id.chinalao.com/join.aspx'>免费注册</a> | <a href='http://id.chinalao.com/getpassword.aspx' target='_blank'>忘了密码</a></td>";
                content += "</tr><tr>";
                content += "<th>&nbsp;</th><td><input type='button' value='登录' onclick='login()' class='submit' /> <input type='button' value='取消' onclick='xxx()' class='submit' /></td>";
                content += "</tr></table>";
                content += "</dd>";
                
       	        $('.lightBox').css({
		            "width":"400px",
		            "height":"180px"
	            });
            }
            else if(type == 2)
            {
                //登录
                content = "<dt><strong>会员登录</strong><img src='/images/close.gif' id='close' onclick='xxx()' /></dt>";
                content += "<dd style='width:400px;height:180px;'>";
                content += "<table cellpadding='0' cellspacing='0' class='ligbox_table'><tr>";
                content += "<th>用户名：</th><td><input type='text' id='txtusername' name='txtusername' /></td>";
                content += "</tr><tr>";
                content += "<th>密码：</th><td><input type='password' id='txtpassword' name='txtpassword' /></td>";
                content += "</tr><tr>";
                content += "<td></td><td><a target='_blank' href='http://id.chinalao.com/join.aspx'>免费注册</a> | <a href='http://id.chinalao.com/getpassword.aspx' target='_blank'>忘了密码</a></td>";
                content += "</tr><tr>";
                content += "<th>&nbsp;</th><td><input type='button' value='登录' onclick='login()' class='submit' /> <input type='button' value='取消' onclick='xxx()' class='submit' /></td>";
                content += "</tr></table>";
                content += "</dd>";
                
       	        $('.lightBox').css({
		            "width":"400px",
		            "height":"180px"
	            });
            }
            else
            {
                var un = $("#un").val();
                //消息
                content = "<dt><strong>发送站内信</strong><img src='/images/close.gif' id='close' onclick='xxx()' /></dt>";
                content += "<dd style='width:500px;height:360px;'>";
                content += "<table cellpadding='0' cellspacing='0' class='ligbox_table'><tr>";
                content += "<th>发给：</th><td>" + un + "</td>";
                content += "</tr><tr>";
                content += "<th>留言内容：</th><td><textarea name='txtmessages' id='txtmessages' style='width: 360px; height: 100px'></textarea></td>";
                content += "</tr><tr>";
                content += "<td></td><td><input type='button' value='确认提交' onclick='postmessage()' class='submit' /> <input type='button' value='取消' onclick='xxx()' class='submit' /></td>";
                content += "</tr></table>";
                content += "</dd>";
                
       	        $('.lightBox').css({
		            "width":"500px",
		            "height":"280px"
	            });
            }
            $("#lbcontent").html(content);
	        $("#lightBox").css("display", "block");
	        $(".lightBox_wrap").css("display", "block");
	        $('.lightBox_wrap').css({
		        "width":$('.lightBox').width(),
		        "height":$('.lightBox').height(),
		        "top": $(document).scrollTop()+$(window).height()/2-$('.lightBox_wrap').height()/2,
		        "left":($(window).width()-$('.lightBox').width())/2
	        });
        }
        //关闭弹出层
        function xxx(){
	        $("#lightBox").css("display", "none");
            $(".lightBox_wrap").css("display", "none");
	        //$("select").css("visibility","visible");
        }
        function login()
        {
              $.ajax({
                    type:"get",
                    url:"/ajax/login.aspx",
                    data:"username=" + escape($("#txtusername").val()) + "&password=" +  escape($("#txtpassword").val()),
                    success:function(msg)                
                    {
          		        if(msg == 0)
		                {
			                alert("用户名或者密码错误。");
		                }
		                else
		                {
		                    location.href= "http://id.chinalao.com/login.aspx?username=" + escape($("#txtusername").val()) + "&password=" +  escape($("#txtpassword").val()) + "&returnurl=" + escape($("#url").val());
		                }
                    }
                });
        }
        function postmessage()
        {
              $.ajax({
                    type:"post",
                    url:"/ajax/messageadd.aspx",
                    data:"uid=" + escape($("#uid").val()) + "&content=" +  escape($("#txtmessages").val()) + "&userid=" + escape($("#userid").val()),
                    success:function(msg)                
                    {
          		        if(msg == 0)
		                {
			                alert("请先登录。");
			                show(1);
		                }
		                else if(msg == 2)
		                {
		                    alert("请输入留言内容。");
		                }
		                else
		                {
			                alert("发送站内信成功。");
			                xxx();
		                }
                    }
                });
        }
        function postbm()
        {
             $.ajax({
                type:"get",
                url:"/ajax/sendresume.ashx",
                data:"zid=" + escape($("#iid").val()) + "&cuid=" + escape($("#uid").val()) + "&job=" +  escape($("#ititle").val()) + "&itype=" + escape($("#itype").val()),
                success:function(msg)                
                {
                        if(msg>0)
                        {
                            alert("投递简历成功！");
                		    $("#bm_state").removeClass("baoming_button");
                		    $("#bm_state").addClass("baoming_an");
                        }
                        else if(msg==-1)
                        {
                            alert("您不是个人用户所以不能投递简历！");
                        }
                        else if(msg==-2)
                        {
                            alert("请开通简历后再投递简历");
                        }
                        else if(msg==0)
                        {
                            alert("请您先登录再投递简历！");
                        }

                }
            });
        }
        function showpage(page, cid, type)
        {
             $.ajax({
                type:"get",
                url:"/ajax/faq.ashx",
                data:"page=" + page + "&cid=" + cid + "&type=" +  type,
                success:function(msg)                
                {
                    $("#faqlist").html(msg);
                }
            });
        }
        function deletefaq(id)
	    {
             $.ajax({
                type:"get",
                url:"/ajax/faqdel.ashx",
                data:"id=" + id,
                success:function(msg)                
                {
                    showpage(1, $("#iid").val(), $("#itype").val());
                }
            });
	    }
	    function faqre(id, uid)
	    {
             $.ajax({
                type:"post",
                url:"/ajax/faqre.ashx",
                data:"faqid=" + id + "&faqcontent=" + escape($("#txtitem_" + id).val()) + "&url=" + escape($("#iurl").val()) + "&job=" + escape($("#ititle").val()) + "&uid=" + uid,
                success:function(msg)                
                {
                    showpage(1, $("#iid").val(), $("#itype").val());
                }
            });
	    }
        function openre(id)
        {
            $("#item_" + id).css("display", "block");
        }
        function closere(id)
        {
            $("#item_" + id).css("display", "none");
        }
	    function faqadd()
        {
            if($("#askinfo").val() == "" || $("#askinfo").val().substring(0,3) == "留言请")
            {
                alert("请输入留言内容。");
                return;
            }
            var check = $("#Anonymity").attr("checked") ? 1 : 0;
             $.ajax({
                type:"post",
                url:"/ajax/faqadd.ashx",
                data:"Question=" + escape($("#askinfo").val()) + "&Anonymity=" + check + "&cid=" +  escape($("#iid").val()) + "&type=" + $("#itype").val() + "&check=" + $("#check").val() + "&uid=" + $("#uid").val() + "&url=" + escape($("#iurl").val()) + "&job=" + escape($("#ititle").val()),
                success:function(msg)                
                {
                    alert(msg);
                    LoadCode();
                    $("#askinfo").val("");
                    $("#check").val("");
                    $("#Anonymity").removeAttr("checked");
                    showpage(1, $("#iid").val(), $("#itype").val());
                }
            });
        }
        function Add(type,url,title)
        {
            $.ajax({
                type:"get",
                url:"/ajax/collectionadd.ashx",
                data:"type=" + type + "&url=" + escape(url) + "&title=" + escape(title) + "&userid=" + escape($("#userid").val()),
                success:function(msg)                
                {
                    if(msg > 0)
                    {
                        alert("收藏成功！");
                    }
                    else if(msg == -1)
                    {
                        alert("您已收藏过此信息");
                    }
                    else if(msg==0)
                    {
                        alert("请您先登录再收藏信息");
                        show1(1);
                    }
                }
            });
        }
        function Visitor()
        {
            $.ajax({
                type:"get",
                url:"/ajax/visitor.aspx",
                data:"uid=" + escape($("#uid").val()) + "&userid=" + escape($("#userid").val()),
                success:function(msg)                
                {
                }
            });
        }
        function GetContact()
        {
            $.ajax({
                type:"get",
                url:"/ajax/GetContact.aspx",
                data:"uid=" + escape($("#uid").val()) + "&userid=" + escape($("#userid").val()) + "&url=" + escape($("#url").val()),
                success:function(msg)                
                {
                    $("#contactxxx").html(msg);
                }
            });
        }
        function VisitorList(uid)
        {
            $.ajax({
                type:"get",
                url:"/ajax/visitorlist.aspx",
                data:"uid=" + uid,
                success:function(msg)                
                {
                    $("#foot_mark").html(msg);
                }
            });
        }
       function copy(meintext) {
          if (window.clipboardData) {
            window.clipboardData.setData("Text", meintext)
          } else {
            var flashcopier = 'flashcopier';
            if(!document.getElementById(flashcopier)) {
              var divholder = document.createElement('div');
              divholder.id = flashcopier;
              document.body.appendChild(divholder);
            }
            document.getElementById(flashcopier).innerHTML = '';
            var divinfo = '<embed src="/images/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(meintext)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
            document.getElementById(flashcopier).innerHTML = divinfo;
          }
          alert('复制成功，现在您可以ctrl+v粘贴到word或者聊天工具对话框中！');
        }
        function cleartext(text)
        {
            if(text.substring(0, 3) == '留言请')
            {
                $("#askinfo").val("");
            }
        }
        function showditu(x,y,z,text)
        {
            var content = "";
            //地图
            content = "<dt><strong>地图上的位置</strong><img src='/images/close.gif' id='close' onclick='xxx()' /></dt>";
            content += "<div id='myMap' style='position:relative; width:698px; height:300px;border:1px solid #ccc;margin:5px auto 0px;'>";
            content += "</div>";

            
   	        $('.lightBox').css({
	            "width":"718px",
	            "height":"340px"
            });

            $("#lbcontent").html(content);
	        $("#lightBox").css("display", "block");
	        $(".lightBox_wrap").css("display", "block");
	        $('.lightBox_wrap').css({
		        "width":$('.lightBox').width(),
		        "height":$('.lightBox').height(),
		        "top": $(document).scrollTop()+$(window).height()/2-$('.lightBox_wrap').height()/2,
		        "left":($(window).width()-$('.lightBox').width())/2
	        });
	        
	        getditu(x,y,z,text);
        }
        function getditu(x,y,z,txt)
        {
            var maps = new LTMaps( "myMap" );
            var point = new LTPoint( x , y );
            
            maps. centerAndZoom ( point , z );
            var c = new LTSmallMapControl();
            maps.addControl(c);
	        
            var marker = new LTMarker( point );
            maps.addOverLay( marker );
            var text = new LTMapText( marker );
            text.setLabel(txt); 
            maps.addOverLay(text); 
            maps.handleMouseScroll();//鼠标滚轮支持
            LTEvent.bind(maps,"dblclick",maps,function(){this.zoomIn()});//绑定事件，在双击的时候先执行放大操作
        }
        
        function Card_Add()
        {
            $.ajax({
                type:"get",
                url:"/ajax/cardadd.ashx",
                data:"iid=" + escape($("#uid").val()) + "&uid=" + escape($("#userid").val()),
                success:function(msg)                
                {
                    if(msg > 0)
                    {
                        alert("收藏成功！");
                    }
                    else if(msg == -1)
                    {
                        alert("您已收藏过此信息");
                    }
                    else if(msg==0)
                    {
                        alert("请您先登录再收藏信息");
                        show(1);
                    }
                }
            });
        }
        function getmer(uid,mid,site)
        {
            $.ajax({
                type:"get",
                url:"/ajax/getmer.aspx",
                data:"uid=" + uid + "&mid=" + mid + "&site=" + escape(site),
                success:function(msg)                
                {
                    $("#merleft").html(msg);
                }
            });
        }