var stateShowPref= 'stgr';
window.addEvent('domready', function(){
Element.implement({ 
show: function() { this.setStyle('display',''); },
hide: function() { this.setStyle('display','none'); }
});

$$('.showBlock').map(function(itm) {
   itm.onclick= function() { 
		if ($(itm.id+'1Box').hasClass('displayNone')) $(itm.id+'1Box').removeClass('displayNone'); else $(itm.id+'1Box').addClass('displayNone');
   }
   $(itm.id+'1').onclick= function() { $(itm.id+'1Box').addClass('displayNone'); }
   $(itm.id+'1Box').addClass('displayNone');
}); 
$('ajaxSearch_input').value= 'SEARCH';
$('ajaxSearch_input').addClass('clearDefault');

$$('.clearDefault').map(function(itm) { 
	if (itm.type == 'text') {
		itm.defaultText= itm.value;
		itm.onfocus= function() { 
			if ((this.value.length!=0)&&(this.value==this.defaultText)) this.value= ''; 
		};
		itm.onblur= function() { 
			if (this.value.length==0) this.value= this.defaultText; 
		};
	}
});
$$('.listjump').map(function(itm) { 
	itm.onchange= function() { 
		if (this.value.length!=0) jumpShowSlow(this.options[this.selectedIndex].value);
	};
});
$$('.aStateJump').map(function(itm) { 
	if (itm.href) {
		var tmp= itm.href.split('/');
		tmp= tmp[tmp.length-1].split('.');
		itm.value= stateShowPref+tmp[0];
		itm.href= 'javascript: ;';
		itm.onclick= function() { 
			if (this.value.length!=0) jumpShowSlow(this.value);
		};
	}
});
function jumpShow(tmp) {
	if ($(tmp)) {
		if ($(tmp).hasClass('showBlock')) {
			if ($(tmp+'1Box').hasClass('displayNone')) $(tmp+'1Box').removeClass('displayNone');
		}
		window.location.hash= tmp; 
	}
}

$$('.showSlow').map(function(itm) {
	initItem($(itm.id+'1Box'), false);
	itm.onclick= function() { $(itm.id+'1Box').showHideSlow(); }
   $(itm.id+'1').onclick= function() { $(itm.id+'1Box').hideSlow(); }
   $(itm.id+'1Box').hideSlow();
}); 
function jumpShowSlow(tmp) {
	if ($(tmp)) {
		if ($(tmp).hasClass('showSlow')) {
			if ($(tmp+'1Box').hasClass('displayNone')) $(tmp+'1Box').removeClass('displayNone');
			initItem($(tmp+'1Box'), true);
		}
		window.location.hash= tmp; 
	}
}
function initItem(el, show) {
	if (!el) return;
	if (!el.showSlow) {
		el.sh012= false;
		el.setStyles({
			'display': 'block'
		});
		if (el.hasClass('displayNone')) el.removeClass('displayNone');
		normalHeight = el.offsetHeight;
		el.setStyles({
			'height': 0,
			'overflow': 'hidden'
		});
//	elParent = $(el.parentNode);
		currentE = new Fx.Style(el, 'height');
		el.showSlow= function(elm, targetValue) {
					elm.sh012= true;
					elm.clearTimer();
					elm.custom(targetValue);
			}.pass([currentE, normalHeight]);
		el.hideSlow= function(elm,targetValue) {
					elm.sh012= false;
					elm.clearTimer();
					elm.custom(targetValue);
			}.pass([currentE, 0]);
		el.showHideSlow= function(elm) {
			if (elm.sh012) el.hideSlow(); else el.showSlow();
			}.pass([currentE]);
	}
	if (show) el.showSlow();
}
/*
$$('.jsjump').map(function(itm) { 
	itm.onclick= function() { if (this.value.length!=0) window.location.hash= this.value; };
});
$$('.jsjumpshow').map(function(itm) { 
	itm.onclick= function() { if (this.value.length!=0) { window.location.hash= this.value; $(this.value).onclick(); } };
});
*/
$$('.loadURL').map(function(itm) { 
	itm.onchange= function() { if (this.value.length!=0) window.location.href= escape(this.options[this.selectedIndex].value); };
});
});
