// JavaScript Document
$(document).ready(function(){
	$(".findPhysician").click(function(){
		$('body').prepend('<div id="box"></div>');
		$('#box').animate({opacity: "0.95",top:($(document).height()/2), left: ($(document).width()/2)}, 0)
			.animate({opacity: "0.65", top:0, left: 0, height: $(document).height(),width: $(document).width() }, 1000, function(){
				$('#light').css('display','block').animate({ top:250, left: (($(document).width()-779)/2), height: 663,width: 779 }, 1000);
				$('#closePoPup').click(function(){
					closeDiv();
				});
		});
	});
	$(".findPhysicianLocation").click(function(){
		var mailTo = $(this).attr('href');
		var url = window.location.href;
		var MBaseUrl = url.substring(0,url.indexOf('/', 14)).replace('CreativeBlinds/','')+'/';
		mailTo = mailTo.replace(MBaseUrl,'');
		var popupHeader = $(this).attr('rel');
		$('body').prepend('<div id="box"></div>');
		$('#box').animate({opacity: "0.95",top:($(document).height()/2), left: ($(document).width()/2)}, 0)
			.animate({opacity: "0.65", top:0, left: 0, height: $(document).height(),width: $(document).width() }, 1000, function(){
				$('#HID_Email').val(mailTo);
				$('#popupHeader').html(popupHeader);
				$('#light').css('display','block').animate({ top:250, left: (($(document).width()-779)/2), height: 663,width: 779 }, 1000);
				$('#closePoPup').click(function(){
					closeDiv();
				});
		});
		return false;
	});
	function closeDiv(){
			$('#light').css('display','none').css('height','0px').css('width','0px');
			$('#box').animate({ height: 10, width: 10, top:($(document).height()/2), left: ($(document).width()/2) }, 1000, "linear", function(){ 
			$(this).remove(); 
		});
	}
});