// JQuery Expand Code
$(document).ready(function() {
	$('#JQuery_Expand').click(function() {
  		$('#Global_Information').toggle("blind", {}, 1000);
	});
});

// JQuery Popup Code
function Show_Email(action, userid) {
$('#Global_Popup').fadeIn('fast');
	//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
	$('#Global_Popup').css({'width':maskWidth,'height':maskHeight});
$('#Global_Email').fadeIn('fast');
}
function Close_Email() {
$('#Global_Popup').fadeOut('fast');
$('#Global_Email').fadeOut('fast');
}

// Email Submit
$(document).ready(function() {
    $("#Global_Email_Form").css("display","block");
	$("#Booking_Error").css("display","none");
  });

$(function(){
	$('#Global_Email_Form').submit(function(e){
	e.preventDefault();
	var form = $(this);
	var post_url = form.attr('action');
	var post_data = form.serialize();
	
	var message = $('input[name=Message]');
	var email = $('input[name=Email]');
	var phone = $('input[name=Phone]');
	
	if (message.val()=='') {
            message.addClass('highlight');
            return false;
        } else message.removeClass('highlight');
		
	if (email.val()=='') {
            email.addClass('highlight');
            return false;
        } else email.removeClass('highlight');
	
	if (phone.val()=='') {
            phone.addClass('highlight');
            return false;
        } else phone.removeClass('highlight');
	
	$('#Loading', form).html('Please Wait...');
	$.ajax({
	type: 'POST',
	url: post_url,
	data: post_data,
	success: function(msg) {
	$('#Global_Email_Text').replaceWith("");
	$('#Global_Email_Form').fadeOut(500, function(){
	form.html('<div id="Global_Email_Message">'+msg+'</div>').fadeIn();
	$('#Global_Popup').delay(2000).fadeOut('fast');
	$('#Global_Email').delay(2000).fadeOut('fast');
	});
}
});
});
});

// Placeholder Creation
 $(function() {
	if(!$.support.placeholder) { 
		var active = document.activeElement;
		$(':text').focus(function () {
			if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
				$(this).val('').removeClass('hasPlaceholder');
			}
		}).blur(function () {
			if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
				$(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
			}
		});
		$(':text').blur();
		$(active).focus();
		$('form').submit(function () {
			$(this).find('.Global_Placeholder').each(function() { $(this).val(''); });
		});
	}
});
