jQuery(document).ready(function() {
	jQuery.datepicker.setDefaults({	showOn: 'both', buttonImageOnly: true, buttonImage: 'http://www.medyanova.com/images/cal.jpg',buttonText: ''});
	jQuery("#reservationDate, #rReservationDate").datepicker({ 
			dateFormat: 'dd/mm/yy',
			showOn: 'both',
			minDate: new Date() 
	});
	
	jQuery(".ui-datepicker-trigger").attr("align","absmiddle").css("float","right"); 
	jQuery(".ui-datepicker-trigger").attr("align","absmiddle").css("padding-right","10px");
	
	jQuery('#reservationSubmit2').click(function() {
		  FormSend();
	});
});

//-- Faruk Start
//Reservation Form Send
function FormSend() {
	
	var reservationDate = jQuery('#reservationDate').val();
	var hours = jQuery('#reservationHour').val() + ':' + jQuery('#minute').val();
	var person = jQuery('#reservationPerson').val();
	var namesurname = jQuery('#reservationName').val();
	var phone = jQuery('#reservationPhone').val();
	var email = jQuery('#reservationEmail').val();
	var description = jQuery('#reservationDescription').val();
	
	jQuery.post("restaurant/reservation",{
		isSend: "OK",
		reservationDate: reservationDate,
		hours : hours,
		person : person,
		namesurname : namesurname,
		phone : phone,
		email : email,
		description : description
	}, function(data){
		if ( data=="OK" ) {
			jQuery("#reservationResponse").html("Rezervasyon Formunuz Gönderildi");
		} else {
			jQuery("#reservationResponse").html("Rezervasyon Formunuz Gönderilemedi");
		}
	});

}

// Share on Social Media Site
var strTitle = document.title;
var strURL = location.href;
var strThumb = "";
var strDesc = "";
var strKeyword = "";
var strTwit = "Bu mekana gözatmalısınız: " + strURL;
var mailSubject = "Bu mekana bakmalısın";
var mailBody = "İnternette gezinirken bu mekan ile karşılaştım. Seninde gözatmanda fayda var.%0D%0A" + strURL;

function recommendFriend() {
	location.href = 'mailto:?subject=' + mailSubject + '&body=' + mailBody;
}

function email(){
	window.open('mailto:?subject=' + mailSubject + '&body=' + mailBody,'sharer','toolbar=0,status=0,width=626,height=436');
}

function facebook() {
	window.open('http://www.facebook.com/sharer.php?s=100&p[medium]=100&p[title]='+strTitle+'&p[images][0]='+strThumb+'&p[url]='+strURL+'&p[summary]='+strDesc+'','sharer','toolbar=0,status=0,width=626,height=436');
}

function friendfeed() {
	window.open('http://www.friendfeed.com/share?title='+strTitle+'&link='+document.location.href,'sharer','toolbar=0,status=0,width=626,height=436');
}

function twitter() {
	window.open('http://twitter.com/home?status='+strTwit,'sharer','toolbar=0,status=0,width=626,height=436');										  
}

function addBookmark() {
	if (window.sidebar) { 
		window.sidebar.addPanel(strTitle, strURL,""); 
	} else if( document.all ) {
		window.external.AddFavorite( strURL, strTitle);
	}
}
//-- Faruk End
