var login_hide_forgot_password=false;

function Login_ConfirmLogout() {
   return confirm("Do you really want to logout?");
}

function Login_HideLogout() {
  var obj = document.getElementById('pnlWelcome');
  if(!obj) return false;
  if (window.location.hostname.indexOf('opensourcealpha.com') != -1)
     obj.style.display = 'none'; 
  return false;	
}


function Login_HideForgotPassword() {
  var obj = document.getElementById('forgot_password');
  if(!obj) return false;
  obj.style.display = 'none'; 
}


function Login_RememberMe(Value) {
  var obj = document.getElementById('cbRemMe');
  if(!obj) return false;
  obj.checked = Value;
  return false;	
}

function Login_Upload() { 
  if(login_hide_forgot_password) Login_HideForgotPassword();

  var obj = document.getElementById('LoginUpload');
  if(!obj) return false;
  if(obj.value == '') return false;
  eval(obj.value);
  return false;	
}

function Login_You_Check_fp() {
    	var sEmail = document.getElementById("txtEmailfp");

	if (sEmail.value == "")  {
	alert("Please enter a value for the \"Email\" field.");
	return (false);
	}

	if(sEmail.value != "")
	{	
		if (!IsEmail(sEmail.value))
		{
			alert('Please specify correct \"Email\" value');
			return false;
		}	
	}
	return (true);
}

function Login_You_CheckFields() 
{
    	var sEmail = document.getElementById("login_email");
    	var sPassword = document.getElementById("login_password");

	if(sEmail.value == "")
	{
		alert('Please Enter Email');
 	      	return (false);
	}

	if(sPassword.value == "")
	{
		alert('Please Enter Password');
	      	return (false);
	}

    	return (true);
}

function Login_You_CheckLogin() 
{
    	var sUserName = document.getElementById("username");
    	var sPassword = document.getElementById("password");

	if(sUserName.value == "")
	{
		alert('Please Enter Account ID');
 	      	return (false);
	}

	if(sPassword.value == "")
	{
		alert('Please Enter Password');
	      	return (false);
	}

    	return (true);
}


function Login_Corpression_CheckFields() 
{
    	var sClientID = document.getElementById("login_email");
    	var sPassword = document.getElementById("login_password");

	if(sClientID.value == "")
	{
		alert('Please Enter Client ID');
 	      	return (false);
	}

	if(sPassword.value == "")
	{
		alert('Please Enter Password');
	      	return (false);
	}

    	return (true);
}

function Login_CheckFields() 
{
    	var sClientID = document.getElementById("client_id_input");
    	var sPassword = document.getElementById("password_input");

	if(sClientID.value == "")
	{
		alert('Please Enter Client ID');
 	      	return (false);
	}

	if(sPassword.value == "")
	{
		alert('Please Enter Password');
	      	return (false);
	}

    	return true;
}

function Check_FreeTrial(containerID) 
{
    var sEmail = document.getElementById("TrialEmail");
    var sTrialFirstLastName = document.getElementById("TrialFirstLastName");
    var sTrialOrganization = document.getElementById("TrialOrganization");
    var sServiceName = document.getElementById("hServiceName");
    if ( !IsEmail(sEmail.value) )
    {
	      alert ('Enter Valid Email Address Please!');
	      return (false);
    }
	else
  {
	    var params = "&Email=" + escape(sEmail.value) + "&hServiceName=" + escape(sServiceName.value) + "&FirstLastName=" + escape(sTrialFirstLastName.value) + "&Organization=" + escape(sTrialOrganization.value);
	    UpdateControlEx(containerID,containerID,GetControlParameters(containerID) + params,null,null,null);
	    document.getElementById("TrialEmail").value="";
	    document.getElementById("TrialFirstLastName").value="";
	    document.getElementById("TrialOrganization").value="";
 	    alert("Your request was sent. Thank you!");
	    return (false);
  }
}

function Authorisation_validate() 
{
        var sAuthorisationCode = document.getElementById("txtAuthorisationCode");
	var sCaptcha = document.getElementById("txtCaptcha");

	if (sAuthorisationCode.value == "")  
	{
		alert("Please enter a value for the \"Authorisation Code\" field.");
		return (false);
	}

	if (sCaptcha.value == "")  
	{
		alert("Please confirm the CAPTCHA code.");
		return (false);
	}

        return (true);
}

function Login_YouDialog_Callback()
{
	Dialog.hide(); 
	document.forms[0].submit();
}

