$(document).ready(function() {
	if ($('div.seenOn').length) {
		$("div.seenOn").smoothDivScroll({
			autoScroll:'always',
			autoScrollDirection:'endlessloop'
		});
	}

	$('.signupForm input[name=email]').each(function() {
		$(this).val('Insert Email Address').attr('color', $(this).css('color'));
	}).focus(function() {
		if (($(this).val() == 'Insert Email Address') || ($(this).val() == 'Invalid Email Address'))
		{
			$(this).val('').css({
				color:$(this).attr('color'),
				fontWeight:'normal'
			});
		}
	}).blur(function() {
		if (!$(this).val()) //if (!$(this).val().match(/.*?\@.*?\..*/))
		{
			$(this).val('Insert Email Address').css({
				color:$(this).attr('color'),
				fontWeight:'normal'
			});
		}
	}).parents('form').submit(function() {
		if (!$(this).find('.signupForm input[name=email]').val().match(/.*?\@.*?\..*/))
		{
			$(this).find('.signupForm input[name=email]').blur().val('Invalid Email Address').animate({
				color:'#ff0000',
				fontWeight:'bold'
			}, 250, 'linear', function() {
				$(this).animate({
					color:'#800000'
				}, 250, 'linear', function() {
					$(this).animate({
						color:'#ff0000'
					}, 250, 'linear');
				});
			});
			return false;
		}
		else {
			$.cookie('fields_email', $(this).find('.signupForm input[name=email]').val());
		}
	});
	
	
	if (($iFrame = $('#subIframe')) && ($iFrame.length)) {
		var $BDLID = 955;
		$src = 'http://valid1.net/default.aspx?bdlid='+$BDLID+'&redirect_url='+escape(window.location.href+'/offers');
		if (($email = $.cookie('fields_email'))) {
			$src += '&email='+escape($email);
		}
		$iFrame.attr('src', $src);
	}
});
