// Start code for mortgage rate box for ome Mortgage page

$(document).ready(function() {
	$(".hybrid, .close_link").click(function(){
	$("#ratebox_container").animate({ opacity: 'show' }, 'slow');
});
		 
$(".close_link").click(function(){
	$("#ratebox_container").animate({ opacity: 'hide' }, 'slow');
});

// End code for mortgage rate box for ome Mortgage page



//Start code for Modal Window on Home Mortgage page

//select all the a tag with name equal to modal
$('a[name=modal]').click(function(e) {
									  
	//Cancel the link behavior
	e.preventDefault();
		
	//Get the A tag
	var id = $(this).attr('href');
	
	//Get the screen height and width
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();
	
	//Set heigth and width to mask to fill up the whole screen
	$('#mask').css({'width':maskWidth,'height':maskHeight});
		
	//transition effect	and set display to block and opacity to 0 so we can use fadeTo   
	$('#mask').css({ 'display' : 'block', opacity : 0});   
  
	//fade in the mask to opacity 0.8   
	$('#mask').fadeTo(1000,0.33);   
  
	//Get the window height and width
	var winH = $(window).height();
	var winW = $(window).width();
              
	//Set the popup window to center
	$(id).css('top',  winH/2-$(id).height()/2);
	$(id).css('left', winW/2-$(id).width()/2);
	
	//transition effect
	$(id).fadeIn(1000); 
	
});
	
//if close button is clicked
$('.window .close').click(function (e) {
	//Cancel the link behavior
	e.preventDefault();
	$('#mask').hide();
	$('.window').hide();
});		
	
//if mask is clicked
	$('#mask').click(function () {
	$(this).hide();
	$('.window').hide();
});		
});
//End code for Modal Window on Home Mortgage page

