The problem is that the second function isn't available in the global scope. Instead, you've passed a named function to the jQuery function, which will call the passed function when the document has been parsed.
Change the second function declaration to:
function ValidatePg() {
...
}