var dt='';
//-----------------
$(document).ready(function() {
	//-------
	$("#aj").css('top','40');
	//-------
	$.ajax({
		type:		"POST",
		url:		"../development/scripts/date_time.php",
		data:		"task=date_time_2",
		success:	function(msg) {
			i=$("#insert_time_date_here").html(msg);
		}
	});
	//-------
	$("#submit").click(function() {
		layer_submit_click();
	});
	$("#submit").mouseover(function() {
		$(this).css('cursor','pointer');
	});
	//-------
	fitPic();
	//-------
});
//-----------------
function go_to_ss() {
		parent.location.href="../landing_page_3_successpage.php?complete=1"+dt;
}
//-----------------
function layer_submit_click() {
	if(layer_check_data()) {
		data=layer_make_data();
		$("#aj").show();
		dt=data;
		$.ajax({
			type:		"POST",
			url:		"../development/scripts/freegift.php",
			data:		"task=send_3"+data,
			success:	function(msg) {
				$("#aj").hide();
				if(msg!='good') {
					alert(msg);
				} else {
					alert('A link to download Song Surgeon will appear on the next page.');
					location.href="http://songsurgeon.com/landing_page_2_successpage.php?complete=1"+dt;
					//$("#for_sth_gift_signup").html('<IFRAME src="../fg_signup_3.php?'+Math.random()+'" scrolling="No" frameborder="no"></IFRAME>');
				}
			}
		});
	} else {
		alert('Fill empty fields, please.');
	}
}
//-----------------
function layer_check_data() {
	if($("#la_fn").val()!='') {
		if($("#la_eml").val()!='') {
			flag=true;
		} else {
			flag=false;
		}
	} else {
		flag=false;
	}
	return flag;
}
//-----------------
function layer_make_data() {
	data='';
	data=data+'&fn='+$("#la_fn").val();
	data=data+'&eml='+$("#la_eml").val();
	return data;
}
//-----------------
function fitPic() {
	if (window.innerWidth) {
		iWidth = window.innerWidth;
		iHeight = window.innerHeight;
	} else {
		iWidth = document.body.clientWidth;
		iHeight =document.body.clientHeight;
	}
	iWidth = 755 - iWidth;
	iHeight = 575 - iHeight;
	window.resizeBy(iWidth, iHeight);
}
//-----------------
