	$(document).ready(function(){
		$('#contact_frame').click(function(evt){
			evt.stopImmediatePropagation();
		});
		$('#say-hello').click(function(evt){
			evt.preventDefault();
			evt.stopImmediatePropagation();
			show_contact();
		});
		//if close button is clicked
		$('.close_contact').click(function (e) {
			hide_contact();
		});
		//if mask is clicked
		$('#mask_contact').click(function () {
			hide_contact();
		});			

		$('body').click(function(){
			hide_contact();
		});
	});
	var showing_contact = false;
	function show_contact(){
		if(!showing_contact){

			//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_contact').css({'width':maskWidth,'height':maskHeight});
	              

			showing_contact=true;
			var height = $(window).height();
			var scrollTop = $(window).scrollTop();
			var frame = $('#contact_frame');
			if(frame.height() < height){
				var end_top = (height - frame.height()) / 2;
			}else{
				var end_top = 0;
			}
			frame.css( {top:end_top+'px'});
			$('#mask_contact').fadeTo("fast",0.8);	
			frame.show('bounce',{times:6},500);
		}else{
			showing_contact=false;
			$('#contact_frame').hide();
		}
	}
	
	function hide_contact(){
		if(showing_contact){
			showing_contact=false;
			$('#mask_contact').hide();
			$('#contact_frame').hide();
		}
	}
	
