// MEGAUPLOAD MAIN JAVASCRIPT 






function checkMail(email)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)) 
	{
		return false;
	}
	else
	{
		return true;
	}
}

function check_register()
{	
	if (document.forms[0].nickname.value == "")
	{
		alert('Please enter a nickname!');
		return false;
	}
	if (document.forms[0].email.value == "")
	{
		alert('Please enter your emailaddress!');
		return false;
	}
	if (checkMail(document.forms[0].email.value))
	{
		alert('Your email address is not valid.');
		return false;
	}
	if (document.forms[0].password.value == "")
	{
		alert('Please choose a password!');
		return false;
	}
	if (document.forms[0].passwordconfirm.value == "")
	{
		alert('Please confirm your password!');
		return false;
	}

	if (document.forms[0].firstname.value == "")
	{
		alert('Please enter your first name!');
		return false;
	}	
	if (document.forms[0].lastname.value == "")
	{
		alert('Please enter your last name!');
		return false;
	}
	if (document.forms[0].address1.value == "")
	{
		alert('Please enter your address!');
		return false;
	}
	if (document.forms[0].city.value == "")
	{
		alert('Please enter your city!');
		return false;
	}
	if (!document.forms[0].accept.checked)
	{
		alert('You need to accept our terms of service!');
		return false;
	}
	return true;
}

function check_editdetails()
{
	if (document.changeform.email.value == "")
	{
		alert('Please enter your emailaddress!');
		return false;
	}
	if (checkMail(document.changeform.email.value))
	{
		alert('Your email address is not valid.');
		return false;
	}


	if (document.changeform.firstname.value == "")
	{
		alert('Please enter your first name!');
		return false;
	}
	
	if (document.changeform.lastname.value == "")
	{
		alert('Please enter your last name!');
		return false;
	}
	if (document.changeform.address1.value == "")
	{
		alert('Please enter your address!');
		return false;
	}
	if (document.changeform.city.value == "")
	{
		alert('Please enter your city!');
		return false;
	}
	return true;
}


function show(url, width, height)
{
  open(url,"displayWindow","width="+width+",height="+height+",status=no,toolbar=no,menubar=no,scrollbars=no");
}



