function getPHPSessionId() {
    var start=document.cookie.lastIndexOf('PHPSESSID=');
    var end=document.cookie.indexOf(';',start);
 
    if(end!=-1) {
        return document.cookie.substr(start+10,end);
    }else {
        return document.cookie.substr(start+10,document.cookie.length);
    }
}