// methods to show/hide "AJAX" form divs. assumes you have _form, _busy, and _link divs
function show_busy_div(name) {
	if($(name+'_form')) { Element.hide(name+'_form'); };
	if($(name+'_link')) { Element.hide(name+'_link'); };
	if($(name+'_display')) { Element.hide(name+'_display'); };	
	if($(name+'_busy')) { Element.show(name+'_busy'); };
}
function show_form_div(name) {
	if($(name+'_link')) { Element.hide(name+'_link'); };
	if($(name+'_busy')) { Element.hide(name+'_busy'); };
	if($(name+'_form')) { Element.show(name+'_form'); };
}

function show_form_div_checkbox(name) {

	if (document.forms[0].link_partner.checked) {
	if($(name+'_link')) { Element.hide(name+'_link'); };
	if($(name+'_busy')) { Element.hide(name+'_busy'); };
	if($(name+'_form')) { Element.show(name+'_form'); };
}

   else {
	if($(name+'_link')) { Element.hide(name+'_link'); };
	if($(name+'_busy')) { Element.hide(name+'_busy'); };
	if($(name+'_form')) { Element.hide(name+'_form'); };
}

}
function show_link_div(name) {
	if($(name+'_busy')) { Element.hide(name+'_busy'); };
	if($(name+'_form')) { Element.hide(name+'_form'); };
	if($(name+'_link')) { Element.show(name+'_link'); };
}
function clear_form_div(name) {
	if($(name+'_form')) { $(name+'_form').innerHTML = ''; }
	if($(name+'_form')) { Element.hide(name+'_form'); };
	if($(name+'_busy')) { Element.hide(name+'_busy'); };
	if($(name+'_link')) { Element.show(name+'_link'); };
}



// methods to show/hide "AJAX" form spans in table rows.
function show_busy_row(name,id) {
	if($('tr_'+name+'_link_'+id)) { Element.hide('tr_'+name+'_link_'+id); };
	if($('tr_'+name+'_busy_'+id)) { Element.show('tr_'+name+'_busy_'+id); };
}
function show_link_row(name,id) {
	if($('tr_'+name+'_busy_'+id)) { Element.hide('tr_'+name+'_busy_'+id); };
	if($('tr_'+name+'_link_'+id)) { Element.show('tr_'+name+'_link_'+id); };
}
// methods to show/hide busy widgets
function show_busy_widget(name) {
	if($(name)) { Element.show(name); };
} 
function hide_busy_widget(name) {
	if($(name)) { Element.hide(name); };
}
// -------------------------------------------------------

function show_mls_import_busy() {
	Element.hide('mls_import_form');
	Element.show('mls_import_busy');
} // end show_mls_import_busy()

function show_email_to_friend_form() {
	Element.hide('email_to_friend_link');
	Element.show('email_to_friend_form');
	Element.hide('email_to_friend_busy');
	Element.hide('email_to_friend_response');
} // end show_email_to_Friend_form()
function show_email_to_friend_busy() {
	Element.hide('email_to_friend_link');
	Element.hide('email_to_friend_form');
	Element.show('email_to_friend_busy');
	Element.hide('email_to_friend_response');
} // end show_email_to_friend_busy()
function hide_email_to_friend_form() {
	Element.show('email_to_friend_link');
	Element.hide('email_to_friend_form');
	Element.hide('email_to_friend_busy');
	Element.hide('email_to_friend_response');
} // end hide_email_to_friend_form() 

// -------------------------------------------------------

function show_redcloth_help(url) {
	var features = 'width=600,height=500,resizable=yes,scrollbars=yes';
	window.open(url,'redcloth',features);
}

function manage_link_add_category() {
	var ajax_url = 	'/manage/links/add_link_category?name=' +
					escape($F('new_link_category_name'));
	new Ajax.Updater('link_category_select',ajax_url,{asynchronous:true, evalScripts:true}); 
	show_busy_div('add_link_category');
	return false;


}		

	
function manage_business_directory_add_industry_type() {
		var ajax_url = 	'/manage/business_directory/add_industry_type?name=' +
						escape($F('new_industry_type_name'));
		new Ajax.Updater('industry_type_select',ajax_url,{asynchronous:true, evalScripts:true}); 
		show_busy_div('add_industry_type');
		return false;

}

// methods for adding attachments in the management section
function show_add_attachment_form() {
	Element.hide( 'add_attachment_link' );
	Element.show( 'add_attachment_form' );
	Element.hide( 'add_attachment_busy' );
} // end show_add_attachment_form()
function hide_add_attachment_form() {
	Element.show( 'add_attachment_link' );
	Element.hide( 'add_attachment_form' );
	Element.hide( 'add_attachment_busy' );
} // end hide_add_attachment_form()
function show_add_attachment_busy() {
	Element.hide( 'add_attachment_link' );
	Element.hide( 'add_attachment_form' );
	Element.show( 'add_attachment_busy' );
} // end show_add_attachment_busy()
