	var nav = 'IE';
	if (navigator.appName == 'Microsoft Internet Explorer')
		nav = 'IE';
	else if (navigator.appName == 'Netscape')
		nav = 'moz';


	function $(id) {
        return document.getElementById(id);
    }

    function cashePut(key, value) 
	{
		if (nav == 'IE')
		{
			xx_storage.setAttribute(key, value)
		    xx_storage.save("namespace")
		}
		else
		{
        	xx_storage[key] = value;
		}
    }
    
    function casheGet(key) {
		if (nav == 'IE')
		{
			return xx_storage.getAttribute(key)
		}
		else
		{
			if (typeof(xx_storage) != 'undefined' && typeof(xx_storage[key]) != 'undefined')
				return xx_storage[key];
		}
		return null;
    }
    
    function casheRemove(key) 
	{
		if (nav == 'IE')
		{
		    xx_storage.removeAttribute(key)
		    xx_storage.save("namespace")
		}
		else
		    delete xx_storage[key];
    }
    
    function init() {        
	
		if(nav == 'IE')
		{
		 // <span id="storageElement"></span>
		    xx_storage = document.getElementById('storageElement');
			
			if (!xx_storage.addBehavior) {
				// alert("userData not available Please use Internet Explorer 6.0 (or Hi) or Firefox 3.0 (or Hi).")
			} 
			else 
			{
				// поставить userData behavior
				xx_storage.addBehavior("#default#userData")
				// загрузить пространство имен
				xx_storage.load("namespace")    
            }		
		}
	
		else
		{
			try{
				xx_storage = globalStorage[document.domain];
			}catch(e){
				//alert("DOM Storage not available. Please use Internet Explorer 8.0 or Firefox 3.0")
			}
		}
    }
    
    
    function casheListAll() {
        var list = [];
        
		if (nav == 'IE')
		{
			var attrs = xx_storage.XMLDocument.documentElement.attributes
 
			for(var i=0; i<attrs.length; i++) {
				list.push(attrs[i].name+':'+attrs[i].value);
			}
		}
		else
		   	for(i in xx_storage) list.push(i+':'+xx_storage[i]);
        
        return list;
    }
    
    function casheRemoveAll() {
        for(i in xx_storage) delete xx_storage[i];
    }


	init();
//    onload = init

