function showImage(id){
	$$('#image img').invoke('hide');
	$(id).show();
}

function dominateEvent(e){
	if(!e){
		e=window.event;
	}
  	if(e.stopPropagation){
   		e.stopPropagation();
	} else {
		e.cancelBubble = true;
	}
}

function showTab(num, elm) {
	$$('#tabarea td').each(function(item){
		if(item.hasClassName('tab')){
			item.hide();
		}
	});
	$('tab'+num).show();
	
	$$('#selectors .current').each(function(item){
		item.removeClassName('current');
	});
	Element.addClassName(elm, 'current');
}

function showGroupRow(name, elm){

	show = (elm.getElementsBySelector('img[class|="down-'+name+'"]')[0].style.display!=''?true:false);

	target = elm.up(1);
	target.getElementsBySelector('tr[class|="row"]').each(function(item){
		item.hide();
	});

	target.getElementsBySelector('img[class|="up"]').each(function(item){
		if(item.hasClassName('up-'+name) && show){
			item.hide();
		}else{
			item.show();
		}
	});

	target.getElementsBySelector('img[class|="down"]').each(function(item){
		item.hide();
	});

	if(show){
		target.getElementsBySelector('tr[class="row-'+name+'"]').each(function(item){
			item.show();
		});

		elm.getElementsBySelector('img[class|="down-'+name+'"]')[0].show();
	}
}

Event.observe(window, 'load', function() {
	$$('input[type=submit]', 'a.submit').each(function(item){
		Event.observe(item, 'mouseover', function(){
			this.addClassName('hover');
		});
		Event.observe(item, 'mouseout', function(){
			this.removeClassName('hover');
		});
	});
});

function showMenu(parent){
	$(parent).getElementsBySelector('ul')[0].show();
}

function hideMenu(parent){
	$(parent).getElementsBySelector('ul')[0].hide();
}

function activate(id){
	$$('#locations div[id^=type]').invoke('hide');
	$$('#locations div[id^=type] input', '#locations div[id^=type] select').each(function(item){
		$(item).setAttribute('disabled', 1);
	});
	$$('#locations div[id=type_'+id+'] input', '#locations div[id=type_'+id+'] select').each(function(item){
		$(item).removeAttribute('disabled');
	});
	$$('#locations div a[id^=tab]').invoke('removeClassName', 'active');
	$('tab_'+id).addClassName('active');
	$('type_'+id).show();
}
