﻿function pluser()
{
    var ck=$F("Text1");
    if(ck=="")
    {
        alert("您还没有登陆，请您先登陆!");
        return;
    }
    else
    {
         var userId=ck;
        var xml="<NODE>";
        xml+="<userId>"+escape(userId)+"</userId>";
        xml+="</NODE>";
        
        
        var url = "ashx/PLGongHuo.ashx";
        var ajax = new Ajax.Request(
                        url,
                        {
                            method: "post",
                            postBody:xml,
                            onComplete: plusershow
                        });
    }
}
function plusershow(xmlhttp)
{
     var rs=xmlhttp.responseText;
     //alert(rs);
     if(rs=="NO")
     {
         window.location="index.html";
         return;
     }
     else
     {
         setCookie("pluser",rs,1); 
//         alert(getCookie("pluser"));
         plselect();
     }
}


function getCookie(cookiename)
{
    var result = '';
    var mycookie = document.cookie;
    var start2 = mycookie.indexOf(cookiename + "=");
    if(start2>-1)
    {
        start=mycookie.indexOf("=",start2)+1;
        var end = mycookie.indexOf(";",start);
        
        if (end == -1)
        {
            end = mycookie.length;
        }
        
        result = unescape(mycookie.substring(start,end));
        
    }
    return result;
}


function setCookie(cookiename, cookievalue, hours)
{
    var date=new Date();
    date.setTime(date.getTime() + Number(hours)*3600*1000);
    temp = escape(cookievalue);
    document.cookie = cookiename + "=" + temp  +"; path=/;expires = " + date.toGMTString();
}

function plqx()
{
    var user=getCookie("userInfo").split("|")[1];
   // alert(user);
   if(user=="")
   {
       alert("您还没有登录，请您先登录!");
       return;
   }
   else
   {
       if(user=="egcdl" || user=="chenyanghui")
       {
            window.location="PL_GongHuo.html";
       }
       else
       {
            alert("您没有权限登录这个页面!");
            return;
       }
   }
}
