jQuery(document).ready(function(){

	if($(".container .sociable")){
		var htmlStr = $(".container .sociable").html();
	    $(".footer .sociable").html(htmlStr);
	    $(".container .sociable").remove();
    }

	/*=== CLICK EVENT LISTENER
	==================================================*/

	/*
	jQuery('body').bind("click", function(e){
		// Locate the html tag that was clicked.
		var tagElement = e.target;
		
		// Identifying the tag's classname to check if it has functions assigned to it.
		// If so, execute the assigned functions.
		
		if(jQuery(tagElement).hasClass('individualProf') || jQuery(tagElement).closest('a').hasClass('individualProf')){
			alert('you clicked on a profile item');
		}
		
	});
	*/

	// MODAL WINDOW: TRIGGER
	//========================================

	var modalUtil = {
		resizer: function (){
			if ((document.documentElement.clientHeight < document.body.clientHeight) || (window.innerHeight < document.body.clientHeight)){
				jQuery('.modalBkgd').css('height', document.body.clientHeight);
			} else {
				if(jQuery.browser.msie){
					jQuery('.modalBkgd').css('height', document.documentElement.clientHeight);
				} else {
					jQuery('.modalBkgd').css('height', '100%');
				}	
			}
		}
	};
		
	window.onresize = function(){
		modalUtil.resizer();
	};
	
	jQuery('.individualProf').click(function(){
		modalUtil.resizer();
		if(jQuery.browser.msie){
			jQuery('select').css('visibility', 'hidden');
		}
			
		var link = jQuery(this).attr("href") + "&mode=ajax";
		jQuery.post(link, {post_expander: 1}, function(data){
			jQuery(".ajaxDataArea").html($(data));
			jQuery('.profilesContentHolder').css("opacity", .5);
			jQuery('.modalWindow').slideDown('slow');
		});
		
		return false;
	});
	

	jQuery('.modalEnd').click(function(){
		jQuery('.profilesContentHolder').css("opacity", 1);
		jQuery('.modalWindow').slideUp();
		if(jQuery.browser.msie){
			jQuery('select').css('visibility', 'visible');
		}
	});
	
	



	
});