function $(elid){return document.getElementById(elid);}
function block(id,hdn){
    this.blockcheck = null;
    this.check = function(){
        if(!this.blockcheck)
        	if(this.v == 1)	this.h();
        	else			this.w();
        else
            return;
    }
    this.w = function(){
    	this.v = 1;
    	if($(this.i+'_div'))$(this.i+'_div').style.display = 'block';
    	for(var j=2; j<20; j++ )
    		if($(this.i+'_div'+j))$(this.i+'_div'+j).style.display = 'block';
    	if($(this.i+'_a'))	$(this.i+'_a').className = '';
    	this.l('block_'+this.i,this.v);
    }
    this.h = function(){
    	this.v = 0;
    	if($(this.i+'_div'))$(this.i+'_div').style.display = 'none';
    	for(var j=2; j<20; j++ )
    		if($(this.i+'_div'+j))$(this.i+'_div'+j).style.display = 'none';
    	if($(this.i+'_a'))	$(this.i+'_a').className = 's';
    	this.l('block_'+this.i,this.v);
    }
    this.l = function(name,value,flag){
    	var x;
    	if(flag)x = name + "=" + value + ";domain=" + location.protocol + "//" + location.hostname;
      	else 	x = name + "=" + value + ";";
    	var date = new Date();
    	date.setTime(date.getTime()+(31*24*60*60*1000));
    	var expires = "; expires="+date.toGMTString();
      	document.cookie = x+expires;
    }
    this.g = function(name) {
    	var x = " " + document.cookie;var d = " " + name + "=";var a = null;var o = 0;var end = 0;
    	if(x.length > 0){
    		o = x.indexOf(d);
    		if(o != -1){
    			o += d.length;
    			end = x.indexOf(";", o)
    			if (end == -1)	end = x.length;
    			a = unescape(x.substring(o,end));
    		}
    	}
    	return(a);
    }

  	this.i = id;
   	if(this.g('block_'+this.i)) this.v = this.g('block_'+this.i);
   	else this.v = (hdn)?0:1;
   	if(this.v == 1) this.w();
   	else			this.h();
}
