$(document).ready(function () {
	
	$('#open-map').live('click', function() {
		$('.be-map').html('<a id="close-map" href="#">close map</a>');
		$('#be-map').slideDown()
		    .delay(200)
		    .queue(function(n) {
		        $(this).html('<iframe src="http://bememorable.co.uk/themes/be-themes/iframe/google-map.html" width="940" height="350" style="overflow: hidden;" marginheight="0" marginwidth="0" frameborder="0"></iframe>');
		        n();
		    });
	    return false;
	});
	
	$('#close-map').live('click', function() {
		$('#be-map').slideUp();
		$('#be-map iframe').remove();
		$('.be-map').html('come to <a id="open-map" href="#">see us</a>');
		return false;
	});
	
	// EMAIL VALIDATION
	
	var besgnptxt = new LiveValidation('besgnptxt', {onlyOnSubmit: true });
	besgnptxt.add( Validate.Presence );
	besgnptxt.add( Validate.Email );
	
	var besrchtxt = new LiveValidation('besrchtxt', {onlyOnSubmit: true });
	besrchtxt.add( Validate.Presence );
	besrchtxt.add( Validate.Exclusion, { within: [ 'Type your request' ] } );
	
	// TWITTER
	
	if((document.all)&&(navigator.appVersion.indexOf("MSIE")!=-1)){
		
	} else {
		$("#twitter").tweet({
		    username: ['bememorable'],
		    join_text: 'auto',
		    avatar_size: 0,
		    count: 1,
		    auto_join_text_default: 'we said &mdash;', 
		    auto_join_text_ed: 'we',
		    auto_join_text_ing: 'we were',
		    auto_join_text_reply: 'we replied to',
		    auto_join_text_url: 'we were checking out',
		    loading_text: 'loading tweets...'
		});
	}
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {	
	   $('#be-container, #be-content').hide();
	   $('body').append('<div id="ie6" />');
	   $('#ie6').load('/themes/be-themes/assets/custom-page/ie6.html');
	}
		
});
