var Path = 'http://www.myshow.com.au/';

function validation_login()

{	

	if(document.getElementById("txt_email").value	==	'')

	{

		alert('Please Insert User Email ID');

		document.getElementById("txt_email").focus();

		return false;		

	}	

	if(validateEmailv2(document.getElementById("txt_email").value) == false)

	{

		alert("Please Enter a Valid Current Email Address !");

		document.getElementById("txt_email").focus();

		return false;



	}

	if(document.getElementById("txt_password").value	==	'')

	{

		alert('Please Insert Password');document.getElementById("txt_password").value='';

		document.getElementById("txt_password").focus();

		return false;		

	}	

}









function validateEmailv2(email)

{

// a very simple email validation checking. 

// you can add more complex email checking if it helps 

    if(email.length <= 0)

	{

	  return true;

	}

    var splitted = email.match("^(.+)@(.+)$");

    if(splitted == null) return false;

    if(splitted[1] != null )

    {

      var regexp_user=/^\"?[\w-_\.]*\"?$/;

      if(splitted[1].match(regexp_user) == null) return false;

    }

    if(splitted[2] != null)

    {

      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;

      if(splitted[2].match(regexp_domain) == null) 

      {

	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;

	    if(splitted[2].match(regexp_ip) == null) return false;

      }// if

      return true;

    }

return false;

}



function addVideo()
{
	var userid;
	var success;
	try{
		
		userid = document.getElementById('iduser').value;
	
	}catch(e){
	  	
		userid ="";

	}	
	
	

	if(userid=="")

	{	

				alert("You are not logged in user.Please login first to upload the video.\nIf you are not existing user click on New User link displaying on top of the page.");
  				success=1;

	}

	else

	{

  		location.href= Path+"uploadVideo";

	}

	if(success=='1')

	{

		location.href=Path+"front/login.php";

	}

	

}



function validation_login_front()

{	

	

	if((document.getElementById("txt_email").value	==	'') || (trim(document.getElementById("txt_email").value)=='User Name or Email'))

	{

		alert('Please Insert User Name or Email ID');

		document.getElementById("txt_email").focus();

		return false;		

	}	

	

	if(document.getElementById("txt_password").value	==	'')

	{

		alert('Please Insert Password');

		document.getElementById("txt_password").focus();

		return false;		

	}	

}

function LTrim( value )

{

	var re = /\s*((\S+\s*)*)/;

	return value.replace(re, "$1");

}



// Removes ending whitespaces

function RTrim( value )

{

	var re = /((\s*\S+)*)\s*/;

	return value.replace(re, "$1");

}



// Removes leading and ending whitespaces

function trim( value )

{

	return LTrim(RTrim(value));

}

