
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}



function toggle_div(p_this, p_id)
{
	var ele = document.getElementById(p_id);
	if(ele != null) {
		if(ele.style.display == "none") {
			ele.style.display = "block";
			p_this.innerText = "-";
		} else {
			ele.style.display = "none";
			p_this.innerText = "+";
		}
	}
}

function removeoptions(p) {
    p.selectedIndex = 0;
    
    for(var i = p.options.length; i >= 0;i--)
    {
        var option = p.childNodes[i];
        p.removeChild(option);
    }	
}

function popup_tos()
{
	var pUrl = '/tos.php?window=popup';
	var wPopUp = window.open(pUrl,'PopUp','location=0,status=1,scrollbars=1,width=680,height=500');	
	if(wPopUp == null)
	{
		alert('Enable popups in your browser to use this feature!');	
		return true;
	}
	return false;
}

function popup_window(pUrl)
{
	var wPopUp = window.open(pUrl,'PopUp','location=0,status=1,scrollbars=1,width=680,height=500');	
	if(wPopUp == null)
	{
		alert('Enable popups in your browser to use this feature!');	
		return true;
	}
	return false;
}


function trim(str) {
    str = str.replace(/^[ ]+(.*)$/, '$1'); // Trims leading spaces
    str = str.replace(/^(.*)[ ]+$/, '$1'); // Trims trailing spaces
    return str;
}

function index_user_email_focus(p)
{
	p.style.color = 'black';	
	p.value = '';
}

function index_emailform_submit()
{
	var ele = document.getElementById('user_email');
	if(ele != null) {
		window.location.href = 'emailform.php?user_email=' + trim(ele.value);
	} else {
		window.location.href = 'emailform.php';
	}
	return false;
}

function index_emailform_checkvalue()
{
	var ele = document.getElementById('user_email');
	if(ele != null) {
		if(trim(ele.value) == 'got to give us your email here') {
			ele.value = '';
		}
	}
	return false;
}

