﻿function checknews()
{
    var newskeyword = document.getElementById("txtnewkeyword").value;
    if(newskeyword == "")
    {
        alert("请输入资讯关键字");
        return false;
    }
}
function checkask()
{
    var askkeyword = document.getElementById("txtaskkeyword").value;
    if(askkeyword == "")
    {
        alert("请输入问答关键字");
        return false;
    }
}

 var javaheadstr="";

javaheadstr=javaheadstr+"<div class=\"topxx\">";
javaheadstr=javaheadstr+"<div class=\"top\">";
javaheadstr=javaheadstr+"    <div class=\"Landing\">";
javaheadstr=javaheadstr+"	  <div class=\"Landing_left\">";
javaheadstr=javaheadstr+"	    <label id=\"labUseName\">用户名：</label>";
javaheadstr=javaheadstr+"	    <input name=\"tf_extfield\" type=\"text\" class=\"tf_extfield\" id=\"txtusername\" />";
javaheadstr=javaheadstr+"		<label id=\"labPassWord\">密码：</label>";
javaheadstr=javaheadstr+"	    <input name=\"tf_extfield\" type=\"password\" class=\"tf_extfield\" id=\"txtpassword\" />";
javaheadstr=javaheadstr+"		<input name=\"Su_bmit1\" type=\"submit\" class=\"Su_bmit\" value=\"登录\" onclick=\"DengLu()\" />";
javaheadstr=javaheadstr+"		<input name=\"Su_bmit1\" type=\"button\" onclick=\"location.href='http://user.lixun.cn/Register.aspx?ReturnUrl='+location.href\" class=\"Su_bmitdzj\" value=\"注册\" />";
javaheadstr=javaheadstr+"		<input name=\"Su_bmit1\" type=\"button\" onclick=\"location.href=' http://user.lixun.cn/Find_Pass.aspx?ReturnUrl='+location.href\" class=\"Su_bmit\" value=\"忘记密码\" />";
javaheadstr=javaheadstr+"		<input id=\"btnUserCenter\" name=\"Su_bmit\" type=\"button\" onclick=\"location.href='http://user.lixun.cn/UserShow.aspx'\" class=\"Su_bmit\" value=\"会员中心\" />";
javaheadstr=javaheadstr+"	  </div>";
javaheadstr=javaheadstr+"		<dl>";
javaheadstr=javaheadstr+"		  <dt><img src=\"http://www.lixun.cn/images/Beauty_02.jpg\" width=\"14\" height=\"13\" alt=\"\" /></dt>";
javaheadstr=javaheadstr+"		  <dd><a onclick=\"SetHome(this,window.location);\" title=\"\" style=\" cursor:pointer;\">设为首页</a></dd>";
javaheadstr=javaheadstr+"		  <dt><img src=\"http://www.lixun.cn/images/Beauty_01.jpg\" width=\"15\" height=\"15\" alt=\"\" /></dt>";
javaheadstr=javaheadstr+"		  <dd><a onclick=\"AddFavorite(window.location,document.title)\" title=\"\" style=\" cursor:pointer;\">加入收藏</a></dd>";
javaheadstr=javaheadstr+"		  <dt><img src=\"http://www.lixun.cn/images/Beauty_04.jpg\" width=\"12\" height=\"13\" alt=\"\" /></dt>";
javaheadstr=javaheadstr+"		  <dd><a href=\"http://www.lixun.cn/\" title=\"\">丽讯首页</a></dd>";
javaheadstr=javaheadstr+"		</dl>";
javaheadstr=javaheadstr+"	</div>";
//javaheadstr=javaheadstr+"	<div id=\"adSlide001\" style=\"float:left;width:980px;\"></div>";
javaheadstr=javaheadstr+"  <div class=\"lgbanner\">";
javaheadstr=javaheadstr+"    <div class=\"lgbanner_logo\"  onclick=\"location.href='http://www.lixun.cn'\"><embed width=\"175\" height=\"81\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" src=\"http://www.lixun.cn/images/logo_blank.swf\" play=\"true\" loop=\"true\" menu=\"true\" type=\"application/x-shockwave-flash\" lk_mediaid=\"lk_juiceapp_mediaPopup_1251958067878\" lk_media=\"yes\"/></div>";
javaheadstr=javaheadstr+"	<div class=\"lgbanner_top_center\" id='ad001'><embed width=\"607\" height=\"81\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" src=\"http://www.lixun.cn/images/ad001.swf\" play=\"true\" loop=\"true\" menu=\"true\" type=\"application/x-shockwave-flash\" lk_mediaid=\"lk_juiceapp_mediaPopup_1251958067878\" lk_media=\"yes\"/></div>";
javaheadstr=javaheadstr+"	<div class=\"lgbanner_top_right\" id='ad002'><a target=\"_blank\" href=\"http://bbs.lixun.cn\"><img width=\"181\" height=\"82\" border=\"0\" alt=\"\" src=\"http://img.lixun.cn/AdImg/2009/9/2/200909021412074994.jpg\"/></a></div>";
javaheadstr=javaheadstr+"  </div>";
javaheadstr=javaheadstr+"  <div class=\"navv\">";
javaheadstr=javaheadstr+"  <div class=\"navvv\">";
javaheadstr=javaheadstr+"    <dl class=\"dzj0\">";
//javaheadstr=javaheadstr+"        <dt><a href=\"http://beauty.lixun.cn/\" title=\"\"><img src=\"http://www.lixun.cn/images/index_32.jpg\" width=\"45\" height=\"49\" alt=\"\" /></a></dt>";
javaheadstr=javaheadstr+"	    <dd class=\"dzj0_d\"><a href=\"http://beauty.lixun.cn/\" title=\"\">美容</a><a href=\"http://vogue.lixun.cn/\" title=\"\">服饰</a><a href=\"http://luxury.lixun.cn/\" title=\"\">尚品</a></dd>";
javaheadstr=javaheadstr+"	    <dd class=\"dzj0_d\"><a href=\"http://ent.lixun.cn/\" title=\"\">娱乐</a><a href=\"http://brand.lixun.cn/\" title=\"\">品牌</a><a href=\"http://theme.lixun.cn/\" title=\"\">专题</a></dd>";
javaheadstr=javaheadstr+"    </dl>";
javaheadstr=javaheadstr+"	  <dl class=\"dzj\">";
//javaheadstr=javaheadstr+"        <dt><a href=\"http://bbs.lixun.cn/\" title=\"\"><img src=\"http://www.lixun.cn/images/index_35.jpg\" width=\"40\" height=\"48\" alt=\"\" /></a></dt>";
javaheadstr=javaheadstr+"	    <dd class=\"dzj_d\"><a href=\"http://life.lixun.cn/\" title=\"\">生活</a><a href=\"http://emotion.lixun.cn/\" title=\"\">情感</a><a href=\"http://man.lixun.cn/\" title=\"\">男士</a></dd>";
javaheadstr=javaheadstr+"	    <dd class=\"dzj_d\"><a href=\"http://life.lixun.cn/\" title=\"\">健康</a><a href=\"http://life.lixun.cn/\" title=\"\">旅行</a><a href=\"http://life.lixun.cn/\" title=\"\">家居</a></dd>";
javaheadstr=javaheadstr+"      </dl>";
javaheadstr=javaheadstr+"	  <dl class=\"dzjj\">";
//javaheadstr=javaheadstr+"        <dt><a href=\"http://bbs.lixun.cn/\" title=\"\"><img src=\"http://www.lixun.cn/images/index_37.jpg\" width=\"32\" height=\"48\" alt=\"\" /></a></dt>";
javaheadstr=javaheadstr+"	    <dd class=\"dzjj_d\"><a href=\"http://bbs.lixun.cn/newshowforum-2.aspx\" title=\"\">情感话题</a><a href=\"http://bbs.lixun.cn/newshowforum-3.aspx\" title=\"\">两性世界</a></dd>";
javaheadstr=javaheadstr+"	    <dd class=\"dzjj_d\"><a href=\"http://bbs.lixun.cn/newshowforum-10.aspx\" title=\"\">瘦身减肥</a><a href=\"http://bbs.lixun.cn/newshowforum-20.aspx\" title=\"\">趣味八卦</a></dd>";
javaheadstr=javaheadstr+"      </dl>";
javaheadstr=javaheadstr+"	  <dl class=\"dzjjj\">";
//javaheadstr=javaheadstr+"        <dt><a href=\"http://brand.lixun.cn/\" title=\"\"><img src=\"http://www.lixun.cn/images/index_39.jpg\" width=\"38\" height=\"48\" alt=\"\" /></a></dt>";
javaheadstr=javaheadstr+"	    <dd class=\"dzjjj_d\"><a href=\"http://brand.lixun.cn/plist_12_0_0_0.html\" title=\"\">美白</a><a href=\"http://brand.lixun.cn/plist_229_0_0_0.html\" title=\"\">祛痘</a><a href=\"http://brand.lixun.cn/pidlist_252.html\" title=\"\">祛斑</a></dd>";
javaheadstr=javaheadstr+"	    <dd class=\"dzjjj_d\"><a href=\"http://brand.lixun.cn/plist_273_0_0_0.html\" title=\"\">瘦身</a><a href=\"http://brand.lixun.cn/plist_274_0_0_0.html\" title=\"\">丰胸</a><a href=\"http://brand.lixun.cn/plist_18_0_0_0.html\" title=\"\">眼部</a></dd>";
javaheadstr=javaheadstr+"      </dl>";
javaheadstr=javaheadstr+"  </div>";
javaheadstr=javaheadstr+"  </div>";
javaheadstr=javaheadstr+"	<div class=\"Date\">";
javaheadstr=javaheadstr+"	  <div class=\"Search\">";
javaheadstr=javaheadstr+"	    <img src=\"http://www.lixun.cn/images/index_53.jpg\" width=\"71\" height=\"24\" alt=\"\" />";
javaheadstr=javaheadstr+"		    <input id=\"txtnewkeyword\" name=\"keyword\" type=\"text\" value=\"减肥瘦身\" class=\"f_extfield\" onfocus=\"clearDefault(this)\"; onblur=\"resetDefault(this);\"  />";
javaheadstr=javaheadstr+"		<input name=\"Sf_ubmit\" type=\"submit\" class=\"Sf_ubmit\" value=\"\" onclick=\"Search()\"/>";
javaheadstr=javaheadstr+"      </div>";
javaheadstr=javaheadstr+"	  <h2><a target=\"_blank\" href=\"http://www.lixun.cn/search.aspx?keyword="+ escape("减肥") + "\" title=\"\">减肥</a> <a target=\"_blank\" href=\"http://www.lixun.cn/search.aspx?keyword="+ escape("我想变白点") + "\" title=\"\">我想变白点</a> <span class=\"STYLE4\"><a target=\"_blank\" href=\"http://www.lixun.cn/search.aspx?keyword="+ escape("离婚成热点") + "\" title=\"\">离婚成热点</a></span> <span class=\"STYLE4\"><a target=\"_blank\" href=\"http://www.lixun.cn/search.aspx?keyword="+ escape("郁可伟的悲哀") + "\" title=\"\">郁可伟的悲哀</a></span></h2><span class=\"wbb\"><img src=\"http://www.lixun.cn/images/index_56.jpg\" width=\"23\" height=\"23\" alt=\"\" /></span><span class=\"wbbb\"><img src=\"http://www.lixun.cn/images/index_65.jpg\" width=\"18\" height=\"20\" alt=\"\" /></span><span class=\"wb\"><img src=\"http://www.lixun.cn/images/index_71.jpg\" width=\"33\" height=\"16\" alt=\"\" /></span>";
javaheadstr=javaheadstr+"	  <form action=\"http://ask.lixun.cn/qlist_0_0.htm\" method=\"POST\" onsubmit=\"return checkask()\" target=\"_blank\"><span class=\"STYLE5\"><label>";
javaheadstr=javaheadstr+"	  <input name=\"keyword\" type=\"text\" class=\"taa_extfield\" value=\"怎么使用面膜呢？\"  id=\"txtaskkeyword\" onfocus=\"clearDefault(this)\"; onblur=\"resetDefault(this);\"  />";
javaheadstr=javaheadstr+"	  </label>";
javaheadstr=javaheadstr+"	  </span>";
javaheadstr=javaheadstr+"	  <input name=\"Sf_ubmit\" type=\"submit\" class=\"Sf_ubmitt\" value=\"\" /></form>";
javaheadstr=javaheadstr+"	</div>";
javaheadstr=javaheadstr+"</div>";
javaheadstr=javaheadstr+"</div>";
if(!isLogin()) 
{
    document.write(javaheadstr);
}

//问题
function clearDefault(el) {//清空
  if (el.defaultValue==el.value) el.value = "";
}
function resetDefault(el){// 重设
  if (el.value == '') el.value=el.defaultValue;
}

function Search()
{
     var newskeyword = document.getElementById("txtnewkeyword").value;
    if(newskeyword == "")
    {
        alert("请输入资讯关键字");
        return false;
    }
    else
    {
        window.open("http://www.lixun.cn/search.aspx?keyword="+ escape(newskeyword)+"&p=1","_blank")
      //  location.href = "search.aspx?keyword="+ escape(newskeyword)+"&p=1"; 
    }
}

function DengLu()
{
    var username = $.trim($("#txtusername").val());
    var password = $.trim($("#txtpassword").val());
    
    if(username == "" || password == "")
    {
        alert("用户名或密码不能为空");
        return;
    }
    
    $.ajax({
        data:"username="+username+"&password="+password,
        type:"POST",
        url:"/XmlHandle/Login.aspx",
        success:function(data){    
             
            if(data == "")
            {
                alert("用户名或密码错误");
                return;
            }
            
            
            $("#txtusername").val("");
            $("#txtpassword").val("");
            $("#txtusername").hide();
            $("#txtpassword").hide();
            $("input[name='Su_bmit1']").hide();
            
            $("#labUseName").html("您好<b>"+data+"</b>，");
            $("#labPassWord").html("欢迎您来到丽讯网！&nbsp;&nbsp;&nbsp;&nbsp;<a  href=\"javascript:userlogout();\" >退出</a>");
            $("#btnUserCenter").css("margin-left","10px"); 
            
           var iframe = document.createElement("iframe");
           iframe.setAttribute("name", "iframebbslogin");
           iframe.setAttribute("id", "iframebbslogin");
           iframe.setAttribute("width","0");
           iframe.setAttribute("height", "0");
           iframe.setAttribute("frameborder", "0");
           
           
          document.body.appendChild(iframe);
         
           document.getElementById("iframebbslogin").src = "http://user.lixun.cn/BbsLogin.aspx?username="+username+"&password="+password;
            //document.body.removeChild(iframe);
        }
    })
}

function isLogin()
{
        $.ajax({
        data:"",
        type:"POST",
        url:"/XmlHandle/LoadCheckLogin.ashx",
        success:function(data){
            if(data != "")
            {
                $("#txtusername").val("");
                $("#txtpassword").val("");
                $("#txtusername").hide();
                $("#txtpassword").hide();
                $("input[name='Su_bmit1']").hide();
                
                $("#labUseName").html("您好<b>"+data+"</b>，");
                $("#labPassWord").html("欢迎您来到丽讯网！&nbsp;&nbsp;&nbsp;&nbsp;<a  href=\"javascript:userlogout();\" >退出</a>");
                $("#btnUserCenter").css("margin-left","10px");
            }
        }
    })

}



function userlogout()
{    
   $.ajax({
        data:"",
        type:"POST",
        url:"/XmlHandle/DelCookie.ashx",
        success:function(data){
            if(data == "1")
            {
                
                  $("#txtusername").show();
                    $("#txtpassword").show();
                    $("input[name='Su_bmit1']").show();
                    
                    $("#labUseName").html("用户名");
                    $("#labPassWord").html("密码");
            }
        }
    })    
}


function AddFavorite(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，请使用Ctrl+D进行添加");
        }
    }
}
function SetHome(obj,vrl){
        try{
                obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);
        }
        catch(e){
                if(window.netscape) {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
                        }  
                        catch (e)  { 
                                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将[signed.applets.codebase_principal_support]设置为'true'");  
                        }
                        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
                        prefs.setCharPref('browser.startup.homepage',vrl);
                 }
        }
}