<!--
var alphabet = "abcdefghijklmnopqrstuvwxyz";
var numeric  = "0123456789";

function isValidwithBag(name,Bag)
{
	var i;
	name = name.toLowerCase();
	for(i=0;i<name.length;++i)
		if (Bag.indexOf(name.charAt(i)) == -1) 
			return false;
	return true;
}		

function isEmpty(s)
{
	// if the string is null or having the length of zero
	// the function will return true
	return((s==null) || (s.length==0));
}

function isWhitespace(s)
{
	// 	Check if s is empty

	if (isEmpty(s)) return true;	

	// Checks for whitespace. If there is atleast a non-whitespace character
	// the function will return false.

	var spaces = " \n\t\r"
	var i;
	for(i=0;i<s.length;++i)
		if (spaces.indexOf(s.charAt(i)) == -1) 
			return false;
	return true;
}

function isLogin(s)
{
	if (s.length == 0)
	{
		alert("Please enter your Username");
		return false;
	}

	if (!isValidwithBag(s,alphabet + numeric + "-._"))

	{
		alert("Login id should contain only the characters from alphabet, numbers and '-._'");
		return false;
	}
	if (!isValidwithBag(s.charAt(s.length-1),alphabet + numeric))
	{
		alert("Login id should end with an alphanumeric characters.");
		return false;
	}
	if (!isValidwithBag(s.charAt(0),alphabet + numeric))
	{
		alert("Login id should start with an alphanumeric characters.");
		return false;
	}
	return true;
}

function isPassword(s)
{
	if (s.length < 6)
	{
		alert("Min. length of password is 6.");
		return false;
	}

	if (isWhitespace(s))
	{
		alert("Please enter the password without spaces.");
		return false;
	}
	return true;
}


function isEmail(s)
{
	var i = 1,Length = s.length,result;

	while((i<Length) && (s.charAt(i) != '@')) i++;
	
	if ((i == Length) || (s.charAt(i) != '@'))
	{
		alert("Email address don\'t have the character @ after the login name.");
		return false;
	}
	
	i+=2;
	
	while((i<Length) && (s.charAt(i) != '.')) i++;

	if ((i == Length) || (s.charAt(i) != '.'))
	{
		alert("Email address don\'t have the character . after the domain name.");
		return false;
	}

	if (i+1 >= Length)
	{
		alert("Email address should have atleast one character after . ");
		return false;
	}
	
	return true;
}

function validateInput(objForm)
{
	if(isWhitespace(objForm.ent_fname.value))
	{
		alert("Please enter your First name.");
		objForm.ent_fname.focus()
		return false;
	}
	if(isWhitespace(objForm.ent_lname.value))
	{
		alert("Please enter your last name.");
		objForm.ent_lname.focus()
		return false;
	}
	if(isWhitespace(objForm.ent_email.value))
	{
		alert("Please enter your email address.");
		objForm.ent_email.focus()
		return false;
	}
	if (!isEmail(objForm.ent_email.value))
	{
		objForm.ent_email.focus()
		return false;
	}
	if(!isPassword(objForm.ent_password.value))
	{
		objForm.ent_password.focus()
		return false;
	}
		var p1 = objForm.ent_password.value;
		var p2 = objForm.ent_confirm_password.value;

		if((p1.length) != (p2.length))
		{
			alert("Email or Password incorrect");
			objForm.ent_password.focus();
			return false;
		}


}

function checkAllIndustries(do_check) {      
  var inds     = document.inv_form.elements['ind_ids[]']
  var inds_cnt = (typeof(inds.length) != 'undefined')
                ? inds.length
                : 0;  
  if (inds_cnt) {
    for (var i = 0; i < inds_cnt; i++) {
      inds[i].checked = do_check;
    } // end for
  } else {
    inds.checked      = do_check;
  } // end if... else  
}

function checkAllRegions(do_check) {      
  var rgn     = document.inv_form.elements['rgn_ids[]']
  var rgn_cnt = (typeof(rgn.length) != 'undefined')
                ? rgn.length
                : 0;  
  if (rgn_cnt) {
    for (var i = 0; i < rgn_cnt; i++) {
      rgn[i].checked = do_check;
    } // end for
  } else {
    rgn.checked      = do_check;
  } // end if... else  
}


    var submitcount=0;    
    function checkSubmit() {
      if (submitcount == 0) {
        submitcount++;
        document.ProposalForm.submit();
      }
    }    
    function wordCounter(field, countfield, maxlimit) {
      wordcounter=0;
      for (x=0;x<field.value.length;x++) {
        if (field.value.charAt(x) == " " && field.value.charAt(x-1) != " ")  {
          wordcounter++
        }  
        // Counts the spaces while ignoring double spaces, usually one in between each word.
        if (wordcounter > 1000) {
          field.value = field.value.substring(0, x);
        } else {
          countfield.value = maxlimit - wordcounter;
        }
      }
    }    
    function textCounter(field, countfield, maxlimit) {
      if (field.value.length > maxlimit) {
        field.value = field.value.substring(0, maxlimit);
      } else {
        countfield.value = maxlimit - field.value.length;
      }
    }

function checkAllProposal(do_check) {      
  var ints     = document.interest.elements['int_ids[]']
  var ints_cnt = (typeof(ints.length) != 'undefined')
                ? ints.length
                : 0;  
  if (ints_cnt) {
    for (var i = 0; i < ints_cnt; i++) {
      ints[i].checked = do_check;
    } // end for
  } else {
    ints.checked      = do_check;
  } // end if... else  
} 

function deleteProposal(id)	{

	if(confirm('Proposal will be deleted permanently. Are you sure, Do you want to delete this proposal? ')) 
		location.href='ent_proposal_edit.php?pid=' + id + '&act=2';
}


function checkUserAgree_OLD()
{
	var capital_amt = document.ProposalForm.prop_capital_amt.value;
	var min_amt = document.ProposalForm.prop_min_amt.value;
	var prop_return = document.ProposalForm.prop_return.value;

	capital_amt = isNaN(capital_amt);
	min_amt = isNaN(min_amt);
	prop_return = isNaN(prop_return);

	if(capital_amt == true)
	{
		alert("Amount of capital should be in numbers.");
		document.ProposalForm.prop_capital_amt.focus();
		return false;
	}

	if(min_amt == true)
	{
		alert("Amount of minimum investment should be in numbers.");
		document.ProposalForm.prop_min_amt.focus();
		return false;
	}

	if(prop_return == true)
	{
		alert("Rate of interests must be in numbers.");
		document.ProposalForm.prop_return.focus();
		return false;
	}

	if (document.ProposalForm.prop_agree.checked == false)
	{
       alert ("Please check the terms of the disclaimer and certify to being a sophisticated investor.");
       return false;
    }

    else
    {
    	return true;
	}

}

function checkUrl(str)
{
 var myRegxp = /^http|https|www/;
 if(myRegxp.test(str)){
  return true;
 }
}
function checkEmail(str)
{
	var emailFilter=/^.+@.+\..{2,3}$/;
	if ((emailFilter.test(str))) {
         return true;
	 }
}
function movetoform(start,finish){
    if (document.inv_form.inv_fname.value == ''){
		alert("Please enter your First name.");
	}
	else if (document.inv_form.inv_lname.value == ''){
        alert("Please enter your Last name.");
    }
    else if (document.inv_form.inv_addr1.value == ''){
        alert("Please enter your Address.");
    }
    else if (document.inv_form.inv_city.value == ''){
        alert("Please enter your City/Town.");
    }
    else if (document.inv_form.inv_password.value.length < 6){
         alert("Minimum length of password is 6.");
    }
    else if (document.inv_form.inv_password.value.length > 10){
         alert("Maximum length of password is 10.");
    }
    else if ((document.inv_form.inv_password.value) != (document.inv_form.inv_confirm_password.value)){
         alert("Password and confirm password is not same");
    }
    else if (!checkEmail(document.inv_form.inv_email.value)){
         alert("Please enter a valid email address.");
    }


    else {
        document.getElementById("form_page_" + start).style.display="none";
    	document.getElementById("form_page_" + finish).style.display="inline";
    }
}

function movetoform1(start,finish)
{

	var inv_min = document.inv_form.inv_min.value;
	var inv_max = document.inv_form.inv_max.value;
	var ext_roi_percent = document.inv_form.ext_roi_percent.value;

	if(isNaN(inv_min) == true || (isNaN(inv_max) == true ))
    {
    	 alert("Investment range should be in numbers");
	}

	 else if(isNaN(ext_roi_percent) == true)
    {
    	 alert("Return on investment objects should be in numbers");
	}

	else {
        document.getElementById("form_page_" + start).style.display="none";
    	document.getElementById("form_page_" + finish).style.display="inline";
    }
}


function checkUserAgree(){
    if (document.inv_form.useragreed.checked == true){
       document.inv_form.action = 'inv_register.php';
       document.inv_form.submit();
    }
    else {
       alert ("Please check the terms of the disclaimer and certify to being a sophisticated investor.");
    }
}
function UpdateInvProfile()
 {
    document.inv_form.action = 'inv_edit.php';
    document.inv_form.submit();
}

function check_proposal_terms(){

    if (document.proposal_payment_form.prop_agree.checked == true){
       document.proposal_payment_form.submit();
    }
    else {
       alert ("Read the terms of the disclaimer and check the box to agree.");
    }
}

function stripAlphaChars(pstrSource) 	{ 

	var m_strOut = new String(pstrSource); 
	m_strOut = m_strOut.replace(/[^0-9]/g, ''); 

	return m_sOut; 
}

function makeNumber(ele)	{


//var stripped = strng.replace(/[\(\)\.\-\ ]/g, "");

	var v = new String(ele.value);
	ele.value = v.replace(/[^0-9\.]/g, '');	
}


//-->

