﻿var global = {
	
	facebook: function(){
		window.open(
			"http://www.facebook.com/sharer.php?u="+escape(window.parent.location), 
			"facebook_share",
			"width=626,height=440,scrollbars=no"
		);
		return false;
	},
	
	twitter: function(){
		window.open(
			"http://twitter.com/home?status=Go check out The Big Chill at the Big House site "+escape(window.parent.window.location), 
			"twitter"
		);
		return false;
	},
	
	send: function(){
	
		$("#send").dialog({ 
			//title: "SEND",
			resizable: false,
			modal: true,
			draggable: false,
			buttons: {
				send: global.sendtofriend
			}
		});
		
	},
	
	sendtofriend: function(){
		$.ajax({
			url: "global-sendtofriend.php",
			type: "POST",
			data: $("#send-tofriend").serialize() + "&url=" + window.location.href,
			success: function(data){
				$("#send-msg").html(data);
				$("#send-friendsemail, #send-friendsname").val("");
			}
		});
		return false;
	}
}
$(function(){

	$("[target=facebook]").click(global.facebook);
	$("[target=twitter]").click(global.twitter);
	$("#footer-btn-send").click(global.send);
	
});
