function ShowBlockSlow(te, se, ClsNameOn, ClsNameOff){
    if(document.getElementById(se)){
        seE = $('#' + se);
        if(te.className == ClsNameOn){
            seE.slideUp('slow');
            te.className = ClsNameOff;
        } else {
            seE.slideDown('slow');
            te.className = ClsNameOn;
        }
    }
}
function ShowBlock(te, se, ClsNameOn, ClsNameOff){
    if(document.getElementById(se)){
        seE = $('#' + se);
        if(te.className == ClsNameOn){
            seE.hide();
            te.className = ClsNameOff;
        } else {
            seE.show();
            te.className = ClsNameOn;
        }
    }
}

$(function(){
	$("#MailFormLink").click(function(){
	popupWin = window.open("/form/","popup","width=640,height=530");
	popupWin.focus();
	});
	$("#MailFormLink2").click(function(){
	popupWin = window.open("/form/?type=1","popup","width=640,height=530");
	popupWin.focus();
	});
	
	$(".index-toggle span").click(function(){
		$(".index-toggle span").removeClass('active');
		$(this).addClass('active');
		
		$('.index-chart').hide();
		$('#' + $(this).attr('id') + '-chart').show();
	});
})



function PopupBlock(b,c){this.container=$(b);this.link=$(c);this.keep=false;var d=this;if(this.container&&this.link){this.container.click(function(a){d.keep=true});this.link.click(function(a){d.toggle(a)})}}PopupBlock.prototype.toggle=function(a){a.preventDefault();a.stopPropagation();if(this.container.hasClass("hidden")){this.show(a)}else{this.hide(a)}return this};PopupBlock.prototype.show=function(b){this.container.removeClass("hidden");var c=this;this.documentClickHandler=function(a){c.hide(a)};this.documentKeyDownHandler=function(a){c.cancel(a)};$(document).click(this.documentClickHandler);$(document).keydown(this.documentKeyDownHandler)};PopupBlock.prototype.hide=function(a){if(this.keep){this.keep=false;return}this.container.addClass("hidden");$(document).unbind("click",this.documentClickHandler);$(document).unbind("keydown",this.documentKeyDownHandler)};PopupBlock.prototype.cancel=function(a){var b=a.keyCode?a.keyCode:a.which?a.which:null;if(b==27){this.hide(a)}};
