function checklength(nextfield, chars, currfield) {
    x = document.phone[currfield.name].value.length
    if (x == chars) {
        eval('document.phone.' + nextfield + '.focus();');
    }
}

function displayOnOff(o) {
    var obj = document.getElementById(o);
    if (obj.style.display == "") {
        obj.style.display = "none";
    } else {
        obj.style.display = "";
    }
}

function acceptTerms(o) {
    var obj = document.getElementById(o);
    if (obj.checked) {
    	document.getElementById('submitButton').disabled=true;    
        return true;
    } else {
        alert("The following information is missing or invalid:\n\n- Terms & Conditions Acceptance.\n\nPlease make sure you have provided the above information correctly before submitting the data.");
        return false;
    }
}

function confirmOff(){
    var msg = "This confirms that you will be unsubscribed from this chat group?"
    var ans = confirm(msg);
    return ans?true:false;

}

function unloadPopup1(str) {
    //alert("popop");
    var Popup = window.open(str,'','height=600,width=800,status=0,toolbar=0,menubar=0,location=0,scrollbars=1');
    Popup.focus();
}

function typeSubmit() {
    document.body.onunload = function em(){return true;}
    if ( validateForm_phone() ){   
    	document.getElementsByName('submitButton')[0].disabled = true;
	}
}

function acceptTermsGoogle(o) {
    var obj = document.getElementById(o);
    if (obj.checked) {
    	document.getElementById('submitButton').disabled=true;
    	document.getElementById('alert').style.display = 'none';
        return true;
    } else {
        document.getElementById('alert').style.display = '';
        return false;
    }
}

function typeSubmitGoogle(obj) {
	var checked = document.getElementById( obj.id + '_terms');
    if ( checked.checked==false) {
       document.getElementById('alert').style.display = '';
       return false;
    } else {
        document.getElementById('alert').style.display = 'none';
        typeSubmit();
        return validateForm_phone();
    }
}