function initPopup(_this){
		var popID = $(_this).attr('rel'); //Get Popup Name
		var popURL = $(_this).attr('href'); //Get Popup href to define size
		var query= popURL.split('?');
		var dim= query[1].split('&');
		var popWidth = dim[0].split('=')[1]; //Gets the first query string value
		var retId = dim[1].split('=')[1]; //Gets the first query string value
		$('#returnelementId').val(retId);
		$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="/img/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>');
		var popMargTop = ($('#' + popID).height() + 80) / 2;
		var popMargLeft = ($('#' + popID).width() + 80) / 2;
		$('#' + popID).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft,
			'top':"50%"
		});
		$('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
		$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer 
}

$(document).ready(function(){
	$('a.poplight[href^=#]').click(function() {
	    initPopup(this);
		return false;
	});

	$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
	  	$('#fade , .popup_block').fadeOut(function() {
			$('#fade, a.close').remove();  
	}); //fade them both out
//         $('.popup_block').css();
		return false;

	});
});



