// JavaScript Document

function downloadFile(){

	var tempIFrame = document.createElement('iframe');
	var holderdiv=document.getElementById('fdownload');

	tempIFrame.src='The_Fear.mp3.zip';
	tempIFrame.width=0;
	tempIFrame.height=0;
	holderdiv.appendChild(tempIFrame);
}

function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}

function isNumeric(form_value) 
{ 
    if (form_value.match(/^\d+$/) == null) 
        return false; 
    else 
        return true; 
} 


function submitForm(){
	var email=$('#email').val();
	if(isValidEmail(email)){
		$.ajax({
			type: "GET",
			url: "submit.php",
			data: "email="+email,
			success: function(msg){
				if(msg=='true'){
				
					downloadFile();
					$('.FormContainer').fadeOut('fast',function(){
										 $('.FormContainer').html('<br/><br/><br/>&nbsp;&nbsp;THANKS FOR DOWNLOADING');
										 $('.FormContainer').fadeIn('fast');
															 });
					
				}else{
				
					alert('All fields must be filled out correctly.');
					
				}
			}
		});
	}else{
		alert('All fields must be filled out correctly.');
	}
	return false;
	
}


$(document).ready(function(){

	$("#cover").click(function(){
		window.location='http://loverslabel.com';
	});

});