function popupDoc(){
	var myHeight = document.body.scrollHeight;
	
	var viewportwidth;
	var viewportheight;
	// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof window.innerWidth != 'undefined'){
		viewportwidth = window.innerWidth,
		viewportheight = window.innerHeight
	}	else if(typeof document.documentElement != 'undefined'
						&& typeof document.documentElement.clientWidth !=
						'undefined' && document.documentElement.clientWidth != 0){
		viewportwidth = document.documentElement.clientWidth,
		viewportheight = document.documentElement.clientHeight
	}	else{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
		viewportheight = document.getElementsByTagName('body')[0].clientHeight
	}
	
	var leftborder;
	var poptop = (viewportheight / 2);
	
	vpwidth = viewportwidth / 2;
	leftborder = (vpwidth - 260);
	J("#docPopup").css("top", (poptop - 100));
	J("#docPopup").css("left", leftborder);
	J("#docPopupClose").css("left", (leftborder + 470));
	J("#docPopupClose").css("top", (poptop - 110));
	
	J("#docPopup").fadeIn();
	J("#docPopupClose").fadeIn();
	//J("#shadows").fadeIn();
	//J("#shadows").css("height", (myHeight + 20));
}

function closePopup(close){
	document.getElementById('docPopup').style.display = 'none';
	document.getElementById('docPopupClose').style.display = 'none';
	//document.getElementById('shadows').style.display = 'none';
  if (close != true){
	  //Get the data from all the fields
	  if (J("#category1").attr("checked") == "checked"){
	  	var cat1 = J("#category1").val();
	  } else {
	  	var cat1 = "0";
	  }
	  if (J("#category2").attr("checked") == "checked"){
	  	var cat2 = J("#category2").val();
	  } else {
	  	var cat2 = "0";
	  }
	  if (J("#category3").attr("checked") == "checked"){
	  	var cat3 = J("#category3").val();
	  } else {
	  	var cat3 = "0";
	  }
	  //alert(cat1.val());
	  var phone = J('input[name=telephone]');
	
	  //organize the data properly
	  var data = 'phone=' + phone.val() + '&cat1=' + cat1 + '&cat2=' + cat2 + '&cat3=' + cat3;
	 
	  //start the ajax
	  J.ajax({
	      //this is the php file that processes the data and send mail
	      url: "/message_sent.php",
	       
	      //GET method is used
	      type: "GET",
	
	      //pass the data        
	      data: data,    
	       
	      //Do not cache the page
	      cache: false,      
	  });
	  
	  J("#sms").html("<p>Thank you for your commitment to our community. You will receive a text message shortly asking you to confirm your volunteer team sign-up.</p><p>Please continue the sign-up process by replying as directed in the text message.</p>"); 
	  //cancel the submit button default behaviours
	}

}
