
// global vars
var resizeTimer = null;
var window_height = null;
var window_width = null;
var fl_width = 718;
var fl_height = 538;
var flashvars = { vid:"loop1.flv" };
var params = { bgcolor:"#000000", wmode:"transparent", scale: "exactFit" };
var attributes = {};
var previous_window_height = 0;
var previous_window_width = 0;

$(document).ready(function () {
	setSWF();
	$('input#email').click(function() { clearField(this); });
	$('form').submit(function(e) {
		if (!checkEmail($('input#email').attr('value'))) {
			e.preventDefault();
			$('input#email').css('color', '#f00');
			$('input#email').attr('value', 'Invalid Email Address!');
		}
	});
});

$(window).bind('resize', function() {
	resizeWrapper();
});

function resizeWrapper() {
	window_width = $(window).width();
	window_height = Math.ceil((fl_height/fl_width) * window_width);
	$('div#flashwrapper').css('width', window_width + 'px');
	$('div#flashwrapper').css('height', window_height + 'px');
}

function setSWF() {
	resizeWrapper();
	swfobject.embedSWF("flv/vid.swf", "flash", "100%", "100%", "8.0.0", false, flashvars, params, attributes);
}

function clearField(f) {
	$(f).attr('value', '');
	$(f).css('color', '#fff');
}

function checkEmail(inputvalue){	
    var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
    return pattern.test(inputvalue);
}

