// JavaScript Document

function setCookie (cookieName, cookieValue, days, path) {

    var expires = new Date();
    expires.setTime(expires.getTime()+(days*24*60*60*1000));
    document.cookie = 
    escape(cookieName) + '=' + escape(cookieValue) 
    + (days ? '; EXPIRES=' + expires.toGMTString() : '') 
    + (path ? '; PATH=' + path : '') 
}

function getCookie (cookieName) { 
    var cookieValue = null; 
    var posName = document.cookie.indexOf(escape(cookieName) + '='); 
    if (posName != -1) { 
        var posValue = posName + (escape(cookieName) + '=').length; 
        var endPos = document.cookie.indexOf(';', posValue); 
        if (endPos != -1) 
            cookieValue = unescape(document.cookie.substring(posValue, endPos)); 
        else 
           cookieValue = unescape(document.cookie.substring(posValue)); 
    } 

    return cookieValue; 
} 

function deleteCookie(name) {
    var expdate = new Date();
    expdate.setTime(expdate.getTime() - (1000 * 60 * 60 * 24 * 30 * 12 )); 
    setCookie(name, "", expdate); 
} 

function isPopup(cookieName) {
    var flag = getCookie(cookieName) ;
    if( flag == null || flag == "Y") {            
       return true ;
    } else {
       return false ;
    }
}

function logOut(){
	location.href = "/logOut.do?cmd=logOut";
}


function statistics(){

	var winName = "statistics";
	var win = window.open("/statistics.do?cmd=statistics" , winName ,"");
	win.focus();
}
