function activate() {
	document.getElementById('hiddenSubmit').click();
}

function reg(form) {
	var promo_code = document.promoForm.acp1.value + '-' + document.promoForm.acp2.value + '-' + document.promoForm.acp3.value;
	document.location = '/registration/?promo_code=' + promo_code;
}

function setFocus() {
	document.getElementById("acp2").focus();
}

function moveFocus(source, targetId) {
	if (source.value.length >= source.size) {
		document.getElementById(targetId).focus();
	}
}

function getDemoDimensions() {
	if (screen.width > 1366 && screen.height > 800) {
		videoHeight = 351; //702;
		videoWidth = 624; //1248;
	} else if (screen.width > 1366) {
		videoHeight = 351; //526.5;
		videoWidth = 624; //936;
	} else if (screen.width > 800 && screen.width <= 1366 && screen.height > 768) {
		videoHeight = 351; //526.5;
		videoWidth = 624; //936;
	} else {
		videoHeight = 351;
		videoWidth = 624;
	}

	var notChrome = ( $.browser.safari && /chrome/.test(navigator.userAgent.toLowerCase()) ) ? false : true;
	if (notChrome == false) {
		videoHeight = videoHeight + 6;
	}
	
	if ($.browser.safari == true && notChrome == true) {
		videoHeight = videoHeight + 4;
	}
}

$(document).ready(function() {
	var sprytextfield1 = new Spry.Widget.ValidationTextField("acp1val");
	var sprytextfield2 = new Spry.Widget.ValidationTextField("acp2val", "none", {minChars:4});
	var sprytextfield3 = new Spry.Widget.ValidationTextField("acp3val", "none", {minChars:3});
	setFocus();
	
	getDemoDimensions();
	$('area.SDCdemoLink').fancybox({
		'type': 'iframe',
		'transitionIn': 'elastic',
		'transitionOut': 'elastic',
		'speedIn': '300',
		'speedOut': '300',
		'hideOnContentClick': false,
		'titleShow': false,
		'overlayColor': '#83a1d1', 
		'width': videoWidth + 5,
		'height': videoHeight + 5
	});	

});
