//----------------------------------------------------------------------------------
// File: stayingcool.js 
//
// Copyright (c) 2008 Engage Interactive Ltd

//----------------------------------------------------------------------------------
// FORM VALIDATION
       
$(document).ready(function() { 
	$('#validation').hide();
	$('#confirmation').hide();
	$('#send_to_a_friend p.error').hide();
    var options = { 
        target:        '#confirmation',   // target element(s) to be updated with server response 
        beforeSubmit:  validate,  // pre-submit callback 
        success:       function() { 
        	$('#send_to_a_friend p.error').hide();
        	$('#validation').fadeOut('slow');
        	$('#send_to_friend_form').fadeOut('slow');
            $('#confirmation').fadeIn('slow'); 
        }  
    }; 
    $('#send_to_friend_form').ajaxForm(options); 
}); 
 
function validate(formData, jqForm, options) { 
    
 	$("#validation").html('');
    var form = jqForm[0]; 
    err="";
    if (!form.name.value)
    {
    	$('#error_name').fadeIn('slow');
    	err="true";
    } else
    {
    	$('#error_name').hide();
    }
    if (!form.email.value)
    { 
    	$('#error_email').fadeIn('slow');
    	err="true";
    } else
    {
    	$('#error_email').hide();
    }
    
    if (err>'')
    {
        return false; 
    }
     
}
//BOOKMARK
function bookmark(address,sitename) {
  if (window.sidebar) {
    window.sidebar.addPanel(sitename, address,"");
  } else if( document.all ) {
    window.external.AddFavorite(address, sitename);
  } else if( window.opera && window.print ) {
    return true;
  }
  return false;
}
//APARTMENT PAGE
function changeImage(src)
	{
		document['mainImage'].src=src;
	}
$(function() {
	$('#google_map').hide();
	$('a[@rel*=lightbox_gallery]').lightBox(); 
	$('a[@rel*=lightbox_floor]').lightBox();
	$('a#open_map').click(function(){
		$('div#google_map').slideToggle("fast");
		load();
		return false;
	});
});

//EXTRAS
$(document).ready(function(){
		$("h4.menu + div").hide();
		$("h4.menu").click(function(){
			$(this).next("div").slideToggle("fast")
		});
		
});