function makeFull(ClickedTab) {
	  	var alt = ClickedTab.attr("alt");
		var iframeContent = '<iframe class="SearchFrame" src="http://waldo.kwrealty.com/'+alt+'" name="main" style="overflow:auto" id="Full" height="625" width="990" frameborder="0" ></iframe>';
	  	$("#Search").html(iframeContent);
		$("#leftBox").css("display","none");
		$("#rightBox").css({
			width:"1000px",
			height:"627px",
			float: "left",
			background: "#FFF",
			border: "none",
		});
}
function restoreLeft(){
		$("#leftBox").css("display","inline-block");
		$("#rightBox").css({
			width:"620px",
			float: "right",
			border: "2px solid white",
			background: "#6f7783",
		});
}

function init() {
// standard site jQuery - 
	$("ul.SubTabs").tabs(".SubPanes > .SubPane", {effect: 'fade', fadeOutSpeed: 200});
	$("ul.ResourcesSubTabs").tabs(".ResourcesSubPanes > .ResourcesSubPane", {effect: 'fade', fadeOutSpeed: 200});
	$(".Tabs").tabs("div.Panes > div.Pane", {effect: 'fade', fadeOutSpeed: 400});
	$(".scrollable").scrollable({ vertical: true, mousewheel: true });	
	
	<!-- $("#header .Tabs li a").click(function() { -->
	$("a.menu").click(function() {
		var ClickedTab = $(this);
	  if ( ClickedTab.is(".SearchTab")) {
		  makeFull(ClickedTab);
	  } else {
		  restoreLeft();
	  }
	});
	$(".SearchTab").hasClass("current") ? makeFull($(".SearchTab")) : restoreLeft();

    $('.slideshow').cycle({
		fx: 'fade',
	});
	$('.banner').cycle({ 
		fx:      'scrollDown', 
		speedIn:  700, 
		speedOut: 500,
		easeIn:  'easeInCirc', 
		easeOut: 'easeOutBounce', 
		timeout: 5000,
	});
	
	
	
	

};

	var messageDelay = 2000;  // How long to display status messages (in milliseconds)
	
	// Init the form once the document is ready
	$( FormInit );

// Initialize the form

function FormInit() {

  // Hide the form initially.
  // Make submitForm() the form's submit handler.
  // Position the form so it sits in the centre of the browser window.
  $('#contactForm').hide().submit( submitForm ).addClass( 'positioned' );

  // When the "Send us an email" link is clicked:
  // 1. Fade the content out
  // 2. Display the form
  // 3. Move focus to the first field
  // 4. Prevent the link being followed

  $('a[href="#contactForm"]').click( function() {
    $('#content').fadeTo( 'slow', .2 );
    $('#contactForm').fadeIn( 'slow', function() {
      $('#senderName').focus();
    } )

    return false;
  } );
  
  // When the "Cancel" button is clicked, close the form
  $('#cancel').click( function() { 
    $('#contactForm').fadeOut();
    $('#content').fadeTo( 'slow', 1 );
  } );  

  // When the "Escape" key is pressed, close the form
  $('#contactForm').keydown( function( event ) {
    if ( event.which == 27 ) {
      $('#contactForm').fadeOut();
      $('#content').fadeTo( 'slow', 1 );
    }
  } );

}


// Submit the form via Ajax

function submitForm() {
  var contactForm = $(this);

  // Are all the fields filled in?

  if ( !$('#senderName').val() || !$('#senderEmail').val() || !$('#propertyAddress').val() ) {

    // No; display a warning message and return to the form
    $('#incompleteMessage').fadeIn().delay(messageDelay).fadeOut();
    contactForm.fadeOut().delay(messageDelay).fadeIn();

  } else {

    // Yes; submit the form to the PHP script via Ajax

    $('#sendingMessage').fadeIn();
    contactForm.fadeOut();

    $.ajax( {
      url: contactForm.attr( 'action' ) + "?ajax=true",
      type: contactForm.attr( 'method' ),
      data: contactForm.serialize(),
      success: submitFinished
    } );
  }

  // Prevent the default form submission occurring
  return false;
}


// Handle the Ajax response

function submitFinished( response ) {
  response = $.trim( response );
  $('#sendingMessage').fadeOut();

  if ( response == "success" ) {

    // Form submitted successfully:
    // 1. Display the success message
    // 2. Clear the form fields
    // 3. Fade the content back in

    $('#successMessage').fadeIn().delay(messageDelay).fadeOut();
    $('#senderName').val( "" );
    $('#senderPhone').val( "" );
    $('#propertyAddress').val( "" );
    $('#senderEmail').val( "" );
    $('#message').val( "" );

    $('#content').delay(messageDelay+500).fadeTo( 'slow', 1 );

  } else {

    // Form submission failed: Display the failure message,
    // then redisplay the form
    //$('#failureMessage').fadeIn().delay(messageDelay).fadeOut();
    $('#failureMessage').fadeIn().text(response);
    //$('#contactForm').delay(messageDelay+500).fadeIn();
  }
}
// JavaScript Document



