/*** pg-events ***/
$(document).ready(function(){
						   
	var target = 'body.pg-events div.s_singleEvent';			
	var whichLink = 'span.s_venue a:eq(0)';	
	
	/* make div clickable; put hover class & status bar */	
	  $(target).each(function() {
		  $(this).hover(
		  function() {
			$(this).addClass('hoveredEvent');
			status=$(whichLink, this).attr('href');
			$('div.btn_wrapper a.btn' ,this).css({'marginTop':'0px', 'lineHeight':'100%'});
			$('div.btn_wrapper a.btn span' ,this).css({'height':'13px'});
			
			$('div.btn_wrapper' ,this).show();
		  },
		  function () {
			 $(this).removeClass('hoveredEvent');
			 $('div.btn_wrapper' ,this).hide();
		  }); //end:hover event
	
		$(this).click(function(event) {
			if (event.target == this) {
		   	location = $(whichLink, this).attr('href');
			}
		}); //end:click event
	  }); // end:each
 


    attendeesLink.init();

});   // end:DOM ready


attendeesLink = {
    init: function() {
        var page = $("body.pg-events");
        if (page.length >= 1) {
            var el = $("#s_attendees_summary .s_items");
            if (el.length >= 1) {
                try {
                    $('<a class="view-all" href="">view all attendee\'s comments</a>').appendTo(el);
                    var target = $("#s_attendees_summary a.view-all");
                    var currenturl = window.location.href;
                    var eid_param = getURLParam('eid', currenturl);
                    var arch_param = getURLParam('arch', currenturl);
                    arch_param == '' ? target.attr('href', 'attendees.aspx?eid=' + eid_param) : target.attr('href', 'attendees.aspx?eid=' + eid_param + '&arch=arch');  
                }
                catch (e) {
                    return false;
                }
            } // end:if target
        } // end:if page
    } //end:init
} // end:obj


    function getURLParam(strParamName, ourLink) {
        var strReturn = "";
        var strHref = ourLink;
        if (strHref.indexOf("?") > -1) {
            var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
            var aQueryString = strQueryString.split("&");
            for (var iParam = 0; iParam < aQueryString.length; iParam++) {
                if (
        aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1) {
                    var aParam = aQueryString[iParam].split("=");
                    strReturn = aParam[1];
                    break;
                }
            }
        }
        return unescape(strReturn);
    }        
        

