﻿var googleMap;

function Load(){
	if(isdefined(googleMap)){
		ShowMap();
		//alert('True');
	}
	else{
		//alert('False');
	}
	setupPage();
}

function isdefined(variable)
{
	return typeof(variable) != "undefined";
}

function ShowGoogleDirections(start, finish){
	start = start.replace(" ", "");
	finish = finish.replace(" ", "");
	window.open("http://maps.google.co.uk/maps?f=d&hl=en&saddr=" + start + "&daddr=" + finish, "GoogleMapsDirections");
}

//var objDocument = document.getElementById('document');

//objDocument.ready(function(){

//$('document').ready(function(){
    
function setupPage(){
    
	var expanded = false;
						   
     $('.Expand, .QuickEnquiry').click(function () { 
	 if (expanded)
	 {
     	$('.ContactForm').stop().animate( { marginLeft:"365px" }, 500);
		$('.Expand').removeClass("Expanded");
		expanded = false;
	 }
	 else
	 {
     	$('.ContactForm').stop().animate( { marginLeft:"180px" }, 500);
		$('.Expand').addClass("Expanded");
		expanded = true; 
	 }
	  return false;
    });
    $('.FullName').click(function() {
        if ($('this').val() == 'full name...')
        {
            $('this').val('');
        }
    });
    $('.FullName').blur(function() {
        if ($(this).val() == '')
        {
            $('this').val('full name...');
        }
    });
    
    $('.EmailAddress').click(function() {
        if ($('this').val() == 'email address...')
        {
            $('this').val('');
        }
    });
    $('.EmailAddress').blur(function() {
        if ($('this').val() == '')
        {
            $('this').val('email address...');
        }
    });
    
    $('.Contact').click(function() {
        if ($('this').val() == 'contact number...')
        {
            $('this').val('');
        }
    });
    $('.Contact').blur(function() {
        if ($('this').val() == '')
        {
            $('this').val('contact number...');
        }
    });
    
    $('.Enquiry').click(function() {
        if ($('this').val() == 'enquiry...')
        {
            $('this').val('');
        }
    });
    $('.Enquiry').blur(function() {
        if ($('this').val() == '')
        {
            $('this').val('enquiry...');
        }
    });
    
};
