  function emailUsEmail(email)
  {
  	isMissingName = checkName(document.emailus.name.value);
  	isMissingCompany = checkName(document.emailus.company.value);

  	isMissingEmail = checkMissingEmail(email);
  	isEmailInvalid = validateEmail(email);
  	
  	if ( isMissingName )
  	{
  		alert("Please Provide Your name.");
		document.getElementById('name').focus();
  		return;
  	}
  	
  	if ( isMissingCompany )
  	{
  		alert("Please Provide Your company name.");
  		document.getElementById('company').focus();
  		return;
  	}
  	
	if ( isMissingEmail || isEmailInvalid )
	{
		alert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('email').focus();
	}
	else
	{
		var cookieVars = SCCommon.getAssociativeCookieArray();
		
		if( cookieVars[ 'corp_refer' ] )
		{
			document.getElementById( 'message' ).value += "\n\nReferring URL: " + cookieVars[ 'corp_refer' ];
		}
		
		document.emailus.submit();
	}
  }
  
  function checkName(thename)
  {
	if ( thename == '')
  	{
        return true;
  	}
  	else
  	{
  		return false;
  	}
  }
  	
  function demoEmail(email)
  {
  	isMissingName = checkName(document.demo.nameDemo.value);
  	isMissingCompany = checkName(document.demo.companyDemo.value);
  	
  	if ( isMissingName )
  	{
  		alert("Please Provide Your name.");
		document.getElementById('nameDemo').focus();
  		return;
  	}
  	
  	if ( isMissingCompany )
  	{
  		alert("Please Provide Your company name.");
  		document.getElementById('companyDemo').focus();
  		return;
  	}
  	
  	isMissingEmail = checkMissingEmail(email);
  	isEmailInvalid = validateEmail(email);
  	
	if ( isMissingEmail || isEmailInvalid )
	{
		alert("Invalid E-mail Address! Please re-enter.");
        document.getElementById('emailDemo').focus();
    }
	else
	{
		var cookieVars = SCCommon.getAssociativeCookieArray();
		
		if( cookieVars[ 'corp_refer' ] )
		{
			document.getElementById( 'messageDemo' ).value += "\n\nReferring URL: " + cookieVars[ 'corp_refer' ];
		}
		
		document.demo.submit();
	}
  }
  
  function checkMissingEmail(email)
  {
  	if ( email == '')
  	{
        return true;
  	}
  	else
  	{
  		return false;
  	}
  }
  
  function validateEmail(email) 
  {
  	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))
    {
       return false;
    }
    else
    {
         return true;
     }
  }
  
function getQueryString()
{
	var query_string = unescape(location.search.substr(1));
    a_get = new Array();
    a_get_pairs = query_string.split( '&' );
    for( i = 0; i < a_get_pairs.length; i++ )
    {
        a_pair = a_get_pairs[ i ].split( '=' );
        if( a_pair.length == 2 )
        {
            a_get[ a_pair[ 0 ] ] = unescape( a_pair[ 1 ].replace( /\+/g,' ' ) );
                        
            if ( a_pair[ 0 ] == 'emailRecieved' )
            {
            	if ( unescape( a_pair[ 1 ].replace( /\+/g,' ' ) ) == 'yes' )
            	{
            		document.getElementById('emailConfirm').innerHTML="Thank you for your interest. We will be in touch shortly.";
            	}
            }
        }
    }


}
