
function IAM_ajaxShowMore(postid, throbberurl, morepageurl, apea_fx, DEF_DUR, ter, permal) {

	try{
		Element.hide('show-inline-more-' + postid);
		$('inline-more-notification-' + postid).innerHTML = throbberurl;

	

		if ($('inline-more-' + postid).innerHTML.length > 1)

			IAM_ajaxDisplayWhenLoaded(postid, apea_fx, DEF_DUR);

		else {
				ajaxedMore = 
					new Ajax.Updater(
						'inline-more-' + postid,
						morepageurl,
						{
							method: 'post',
							postBody: 'id=' + postid + '&ter=' + ter,
							onComplete: IAM_ajaxWaitForHide(postid, apea_fx, DEF_DUR, permal)
						}
					);

		}


	}catch(err){
			//let the browser handle the click
			document.location.href = permal;
			return true;
  	}

	//signal browser to not follow link
	return false;

}



function IAM_ajaxWaitForHide(postid, apea_fx, DEF_DUR, permal) {
		Element.hide('inline-more-' + postid);
		setTimeout("IAM_ajaxDisplayWhenLoaded(" + postid + ",'" + apea_fx + "'," + DEF_DUR + ",'"+permal+"')", 600);

}



function IAM_ajaxHideMore(postid, fade_fx, DEF_DUR) {
	more = ('inline-more-' + (postid));
	try{
		switch(fade_fx){
			case 'BlindUp':
				Effect.BlindUp(more,{duration: DEF_DUR});
				break;
			case 'SlideUp':
				Effect.SlideUp(more,{duration: DEF_DUR});
				break;
			case 'Squish':
				Effect.Squish(more,{duration: DEF_DUR});
				break;
			case 'Fold':
				Effect.Fold(more,{duration: DEF_DUR});
				break;
			case 'Shrink':
				Effect.Shrink(more,{duration: DEF_DUR});
				break;
			case 'DropOut':
				Effect.DropOut(more,{duration: DEF_DUR});
				break;
			case 'Puff':
				Effect.Puff(more,{duration: DEF_DUR});
				break;
			case 'SwitchOff':
				Effect.SwitchOff(more,{duration: DEF_DUR});
				break;
			case 'Fade':
			default:
				Effect.Fade(more,{duration: DEF_DUR});
				break;
		}
		$(more).blur();
	
		setTimeout("Element.show('show-inline-more-" + postid + "')", (DEF_DUR*1000+100));

		Element.hide("hide-1-inline-more-" + postid);

		Element.hide("hide-2-inline-more-" + postid);

	}catch(err){
	  		txt="There was the following javascript error trying to hide the post: '"+ err.description +"'\n";
			txt+="Click OK to continue.\n\n";
			alert(txt);
  	}


}



function IAM_ajaxDisplayWhenLoaded(postid, apea_fx, DEF_DUR, permal) {
	try{

		if ($('inline-more-' + postid).innerHTML.length < 100)

			setTimeout("IAM_ajaxDisplayWhenLoaded(" + postid + ",'" + apea_fx + "',"+DEF_DUR + ",'"+permal+"')", 100);


		else{
		
			more = ('inline-more-' + (postid));
			switch(apea_fx){
				case 'BlindDown':
					Effect.BlindDown(more,{duration: DEF_DUR});
					break;
				case 'SlideDown':
					Effect.SlideDown(more,{duration: DEF_DUR});
					break;
				case 'Grow':
					Effect.Grow(more,{duration: DEF_DUR});
					break;
				case 'Appear':
				default:
					Effect.Appear(more,{duration: DEF_DUR});
					break;
			}
			
			$(more).blur();
			
			$('inline-more-notification-' + postid).innerHTML = '';

			setTimeout("Element.show('hide-1-inline-more-" + postid + "')", (DEF_DUR*1000+100));
			setTimeout("Element.show('hide-2-inline-more-" + postid + "')", (DEF_DUR*1000+100));
		}
	}catch(err){
	  		txt="There was the following javascript error trying to display the post: '"+ err.description +"'\n";
			txt+="Click OK to be forwarded to single post page.\n";
			if (confirm(txt))
				document.location.href = permal;
  	}
		

}