function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}

function emailExists(email) {
	exist = true;
	jQuery.ajax({
		type    : 'POST',
		async  	: false,
		url     : '/controler.php?ajax=registrace&stav=email-exists',
		data    : {mail : email},
		success : function(data) {if(data == 0) exist = false;},
		error 	: function(data) {}
	});	
	return exist;
}

function switchContent(fromId,toId) {
	$(fromId).fadeOut(function(){$(toId).fadeIn();});	
}

function setInvalid(id,message){
	$(id).addClass("invalid");
	$(id).after('<span class="invalid-message">' + message + '</span>');
}

function setAllValid(){
	$(".invalid-message").remove();	
	$(".invalid").removeClass("invalid");
}

function showInvalid() {
	$(".invalid-message").slideDown(600);	
}

function CreateBookmarkLink() {

 title = "Hanácká kyselka";
  // Blogger - Replace with <$BlogItemTitle$>
  // MovableType - Replace with <$MTEntryTitle$>

 url = "http://www.hanacka.cz";
  // Blogger - Replace with <$BlogItemPermalinkURL$>
  // MovableType - Replace with <$MTEntryPermalink$>
  // WordPress - <?php bloginfo('url'); ?>

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
