/**
 * Установка Cookies
 */
function slSetCookie( sName, vValue, sExpires, sSecure, sDomain ) {
	if (typeof sExpires == "undefined") sExpires = 6*3600*1000; // 6 часов

	var oDate = new Date();
	oDate.setTime( oDate.getTime() + sExpires );

	document.cookie = 
			sName + "=" + escape(vValue) +
				( (sDomain) ? "; domain=" + sDomain : "" ) +
				"; expires=" + oDate.toGMTString() +
				( (sSecure) ? "; secure" : "");
} // end function slSetCookie( sName, vValue, sExpires, sSecure )

/**
 * Получение содержания Cookies
 */
function slGetCookie( sName ) {
 	var oCookie = document.cookie;
 	
 	var sSearch = " " + sName + "=";
 	var iOffset = 0;
 	var iEnd = 0;
	var vResult = null;
 
 	if ( oCookie.length ) {
 		iOffset = oCookie.indexOf( sSearch );
 		
 		if ( iOffset != -1 ) {
 			iOffset += sSearch.length;
 			
 			iEnd = oCookie.indexOf( ";", iOffset )
 			if ( iEnd == -1 ) {
 				iEnd = oCookie.length;
 			}
 			vResult = unescape( oCookie.substring(iOffset, iEnd) );
 		}
 	} // end if ( oCookie.length )

	return vResult;
} // end function slGetCookie( sName )