jQuery(document).ready(function ($) {
/*	jQuery("body").after('<a href="http://www.weddingideasawards.com" title="Click here to vote in the Wedding Ideas Awards 2012"><div id="awardsLink"><p>VOTE NOW</p></div></a>');*/
	jQuery(".easy_img_caption + p").css("margin-top", "15px");
    jQuery("p + h2").css("margin-top", "1.5em");
    jQuery(".labels-label-list + .latest_issue_caption").css("margin-top", "20px");
    jQuery(".counter + .pageNavHolder").css("margin-top", "10px");
    jQuery(".counter").css("margin-top", "20px");
    jQuery(".latest_issue_caption + h2").css("margin-top", "20px");
    jQuery('.menu ul li ul').prepend('<div id=\"menutop\"></div>');
    $('.menu ul li ul').append('<div id=\"menubottom\"></div>');
    jQuery('a[name]=gallery').addClass("gallery-start");
    jQuery("#real-weddings-map img[title]").tooltip({
        tipClass: 'witooltip shadow',
        offset: [0, 50],
        effect: 'slide'
    });
    jQuery('.slide-out-div').tabSlideOut({
        tabHandle: '.handle',
        pathToTabImage: '/templates/evenflow/images/style1/twitter-feed-button.png',
        imageHeight: '150px',
        imageWidth: '35px',
        tabLocation: 'left',
        speed: 300,
        action: 'click',
        topPos: null,
        fixedPosition: false,
        onLoadSlideOut: false
    });
    jQuery('.tab2 a.handle').css("background-image", "url(/templates/evenflow/images/style1/facebook-feed-button.png)");
    jQuery('.tab1 a.handle').one('click', function () {
        jQuery('#jTweetsAnywhereFeed').jTweetsAnywhere({
            username: 'photovisionuk',
            count: 15,
            showTweetFeed: {
                expandHovercards: true,
                showSource: true,
                showProfileImages: true,
                showUserScreenNames: true,
                paging: {
                    mode: 'prev-next'
                }
            },
            onDataRequestHandler: function (stats) {
                if (stats.dataRequestCount < 11) {
                    return true
                } else {
                    alert("To avoid struggling with Twitter's rate limit, we stop loading data after 10 API calls.")
                }
            }
        })
    });
    jQuery('.tab2 a.handle').one('click', function () {
        jQuery("#FacebookFeed").empty().html('<div id="FacebookFeedLoader"></div>');
        jQuery('#FacebookFeed').load('/templates/evenflow/html/facebook-feed.php')
    })
	
	
	jQuery("#competition-success").overlay({
		top: 260, // custom top position
		mask: { // some mask tweaks suitable for facebox-looking dialogs
			color: '#fff', // you might also consider a "transparent" color for the mask
			loadSpeed: 200, // load mask a little faster
			opacity: 0.5 // very transparent
		},
		closeOnClick: false, // disable this for modal dialog-type of overlays
		load: true // load it immediately after the construction
	});




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 prefillClear(field) {
	if (field.defaultValue==field.value) {field.value = 'ergerggx';}
	else if (field.value == 'sdvsdv') {field.value = field.defaultValue;}
}


		jQuery("#emailaddress").keyup(function(){
			var email = jQuery("#emailaddress").val();
			if(email != 0)
			{
				if(isValidEmailAddress(email))
				{
					jQuery("#emailaddress").css({
						"background-image": "url('/templates/evenflow/images/style1/validYes.png')",
						"background-position": "97% 50%",
						"background-repeat": "no-repeat"
					});
				} else {
					jQuery("#emailaddress").css({
						"background-image": "url('/templates/evenflow/images/style1/validNo.png')",
						"background-position": "97% 50%",
						"background-repeat": "no-repeat"
					});
				}
			} else {
				jQuery("#emailaddress").css({
					"background-image": "none"
				});			
			}
		});
	





}); /* END OF DOCUMENT READY */


