/**
 * HideReveal
 * @class
 * @version 1.0
 */
HideReveal = function (el) {

	var myHideRevealLink = el;
	var imgBackgroundHideSrc = '';
	var imgBackgroundRevealSrc = '';
	
	if (jQuery(myHideRevealLink).attr('class') == 'hide_reveal_link h_r_l_sidebar') {
       	imgBackgroundHideSrc = '/images/link_right_arrow_limegreen.png';
		imgBackgroundRevealSrc = '/images/link_down_arrow_limegreen.png';
    } else {
		imgBackgroundHideSrc = '/images/link_right_arrow.png';
		imgBackgroundRevealSrc = '/images/link_down_arrow.png';
	}
	
	this.initialize = function () {
        
        jQuery(myHideRevealLink).attr('style', 'padding-top:1px; background-repeat:no-repeat; background-position:2px 5px; padding-left:10px; background-image:url("'+imgBackgroundHideSrc+'") !important');
       	jQuery(myHideRevealLink).click(processContent);
		
	}
	
	var processContent = function () {
		
		jQuery(myHideRevealLink).removeAttr('style');
       	
        if (jQuery(myHideRevealLink).closest('.hide_reveal_link_holder').closest('.hide_reveal_holder').children('.hide_reveal_content').css("display") == "none") {
			jQuery(myHideRevealLink).attr('style', 'padding-top:1px; background-repeat:no-repeat; background-position:left 5px; padding-left:10px; background-image:url("'+imgBackgroundRevealSrc+'") !important');
			jQuery(myHideRevealLink).closest('.hide_reveal_link_holder').closest('.hide_reveal_holder').children('.hide_reveal_content').css("display", "block");
		} else {
			jQuery(myHideRevealLink).attr('style', 'padding-top:1px; background-repeat:no-repeat; background-position:2px 5px; padding-left:10px; background-image:url("'+imgBackgroundHideSrc+'") !important');
			jQuery(myHideRevealLink).closest('.hide_reveal_link_holder').closest('.hide_reveal_holder').children('.hide_reveal_content').css("display", "none");
		}
		
		return false;
	
	}
	
}

jQuery(document).ready(function () {
	jQuery(".hide_reveal_link").each(function () {
		var foo = new HideReveal(jQuery(this));
		foo.initialize();
	});
});
