var aIds = Array( 'pg_9e84dc2d65' );
function ChangePage( to_hide, to_show )
{
   var tbl_hide = document.getElementById( aIds[to_hide] );
   var tbl_show = document.getElementById( aIds[to_show] );
   if ( typeof(tbl_hide)=='object' && tbl_hide!=null )
    if ( typeof(tbl_show)=='object' && tbl_show!=null )
    {
       tbl_hide.style.display = 'none';
       tbl_show.style.display = '';
    }
}
function NotEmpty( old_res, id, field_title )
{
   if ( old_res==0 )
   {
      var el = document.getElementById( id );
      if ( typeof(el)=='object' && el!=null )
        if ( el.value=='' )
        {
           alert( 'You should fill "' + field_title + '"' );
           return 1;
        }
   }
   return 0;
}
function Email( old_res, id, field_title )
{ // test
   if ( old_res==0 )
   {
      var el = document.getElementById( id );
      if ( typeof(el)=='object' && el!=null )
      {
         var re = /^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9][a-zA-Z0-9-]+\.)+[a-zA-Z]{2,4}$/;

         if (el.value.search(re) != -1 )  return 0;
         else
         {
            alert( '"'+field_title+'" must be email' );
            return 1;
         }
      }
   }
   return 0;
}

function CheckPage9e84dc2d65()
{
   var nResult = 0;
   nResult += NotEmpty( nResult, 'fld_c0294ef19a','Name' );
   nResult += NotEmpty( nResult, 'fld_97bd8b9594','Address' );
   nResult += NotEmpty( nResult, 'fld_cd4ccaf9ad','City' );
   nResult += NotEmpty( nResult, 'fld_c6c56766ed','Zip' );
   nResult += NotEmpty( nResult, 'fld_62f2bfb542','Phone' );
   nResult += Email( nResult, 'fld_6fecaa8e9a','Email' );
   nResult += NotEmpty( nResult, 'fld_e8c35a1849','Brick Text' );
   if ( nResult == 0 )
   {
      if (1)
      {
         var el = document.getElementById( 'frm_ae5cedebab' );
         if ( typeof(el)=='object' && el != null ) el.submit();
      }
      else ChangePage( 0, 1 );
   }
}


function petBrick(fullname, address, city, zip, phone, email, quantity, brick11, brick12, brick13, brick21, brick22, brick23, brick31, brick32, brick33, brick41, brick42, brick43, brick51, brick52, brick53){
	if (fullname.value=="" || fullname.value== null){
		alert("Please enter your name");
		return false;
	}
	else if (address.value == "" || address.value == null){
		alert("Please enter your address");
		return false;
	}
	else if (city.value == "" || city.value == null){
		alert("Please enter your city");
		return false;
	}
	else if (zip.value == "" || zip.value == null){
		alert("Please enter your zip code");
		return false;
	}
	else if (isNaN(zip.value) || !(zip.value.length == 5)){
		alert("Please enter a valid zip code");
		return false;
	}
	else if (phone.value == "" || phone.value ==  null){
		alert("Please enter your phone number");
		return false;
	}
	else if (email.value == "" || email.value == null){
		alert("Please enter your email address");
		return false;
	}
	else if (!echeck(email.value)){
		alert("Please enter a valid email address.");
		return false;
	}
	else if (quantity.value == 0){
		alert("Please select a quantity to order");
		return false;
	}
	else{
		return true;
	}
}

function s(test){
	alert(test);
}
