function CheckField( e )
{
    var f = $( id+"_"+e ), fc = $( id+"_"+e+"Check" );
    if( f.value == "" ) fc.style.display = "block";
    else fc.style.display = "none";
    return fc.style.display == "none";
}

function CheckPostalCodeField( e )
{
    var codePPattern = new RegExp( "^[0-9]{5}$" );
    var c = $( id+"_"+e ), cv = $( id+"_"+e+"Valid" );
    if( c.value != "" && !codePPattern.test( c.value ) ) cv.style.display = "block";
    else cv.style.display = "none";
    return cv.style.display == "none";
}

function CheckEmailField( e )
{
    var emailPattern = new RegExp( "^([0-9a-zA-Z]([-_.\\w]*[0-9a-zA-Z])*@(([0-9a-zA-Z])+([-\\w]*[0-9a-zA-Z])*\\.)+[a-zA-Z]{2,9})$" );
    var f = $( id+"_"+e ), fc = $( id+"_"+e+"Valid" );
    if( f.value != "" && !emailPattern.test( f.value ) ) fc.style.display = "block";
    else fc.style.display = "none";
    return fc.style.display == "none";
}

function Compare( e, ec )
{
    var f = $( id+"_"+e ), fc = $( id+"_"+ec ), fcc = $( id+"_"+e+"Compare" );
    if( f.value != "" && f.value != fc.value ) fcc.style.display = "block";
    else fcc.style.display = "none";
    return fcc.style.display == "none";
}

function CheckEmail( e )
{
	return CheckField( e ) && CheckEmailField( e );
}

function CheckPostalCode( e )
{
	return CheckField( e ) && CheckPostalCodeField( e );
}

function CheckPasswordConfirm( e, ec )
{
	return CheckField( e ) && Compare( e, ec );
}

function SetOtherVisible( list, index, text )
{
	var radio = $(id + "_" + list + "_" + index);
	var box = $(id + "_" + text );

	if(radio.checked)
		box.style.display = 'block';
	else {
		box.value = '';
		box.style.display = 'none';
	}
}