	function openreview(url){
		window.open('pgpopup/'+url+'.html', 'null', 'height=500,width=1024,status=no,toolbar=noe,menubar=no,location=no,scrollbars=yes');
		return false;
	}
	
	function openpg(url){
		window.open(url, 'null', 'height=500,width=1024,status=no,toolbar=noe,menubar=no,location=no,scrollbars=yes');
		return false;
	}
	
	var tmpArr = Array('', '', 'First Name', 'Last Name', 'Email Address', 'Daytime Phone', 'Password');
	
	String.prototype.trim = function () {
	    return this.replace(/^\s*/, "").replace(/\s*$/, "");
	}
	
	function checkfieldform(){
		e = document.frmcfrm.elements;
		len = e.length;
		for(i=0; i<len; i++){
			if(e[i].value.trim() == ''){
				alert('Enter email address before clicking Submit.');
				return false;
			}
		}
		cfrmemail = document.frmcfrm.Contact0Email;
		if(checkemail(cfrmemail)){
			///JQuery Ajax Post data
			strCfrmEmail = document.frmcfrm.Contact0Email.value;
			$.post("resend-check.php", { apiEmail: strCfrmEmail},
			function(data){
				if(data.contructor == 'fail') {
					//alert('Sorry!' + data.errorcode Sorry! The email address is not available.);
					msgErrorPrint("The email address you entered not found!");
					$('#btsubmit').disabled = false;
					$('#btsubmit').removeAttr('disabled');
					return false;
				}else{
					//alert('Added ' + data.errorcode);
					msgErrorPrint("Email was resent.");
					document.frmcfrm.target = '_parent';
					document.frmcfrm.submit();
					return true;
				}
				//alert('Email was resent.');
			}, "json");
			
			return false;
		}
		return false;
		return true;
	}
	
	function checkaddpptrde(){
		
		e = document.frmprof.elements;
		len = e.length;
		
		for(i=0; i<len; i++){
			if(e[i].id != 'fP2C' && e[i].id != 'fstrke'){
				if(e[i].value.trim() == ''){
					e[i].focus();
					alert('Required fields have been left blank.');
					return false;
				}
			}
		}
	}
	
	function checkregs(){
		ctry = document.frmregs.Contact0_ipcountry.value;
		document.frmregs.Contact0Country.value = ctry;
		state = document.frmregs.Contact0_IpState.value;
		document.frmregs.Contact0State.value = state;
		
		e = document.frmregs.elements;
		len = e.length;
		
		pwrd = document.frmregs.Contact0Password.value;
		document.frmregs.Contact0_Password.value = pwrd;
		
		var strError = "Please Enter: ";
		var errlog = 0;
		clearErrField();
		
		for(i=0; i<len; i++){
			if(e[i].name != 'Contact0Country'){
				if(e[i].value.trim() == ''){
					strError = strError + "<b>" + tmpArr[i] + "</b>";
					e[i].focus();
					setErrField(e[i]);
					msgErrorPrint(strError);
					return false;
				}
			}
		}
		gemail = document.getElementById('emailaddr');
		f = document.getElementById('fonenumb');
		if(checkfone(f)){
			if(checkemail(gemail)){
				///JQuery Ajax Post data
				strEmail = $('#emailaddr').val();
				$.post("ajaxcheck.php", { apiEmail: strEmail},
				function(data){
					//alert(data.email); // 
					//alert(data.name);
					//console.log(data.time); //  2pm
					if(data.contructor == 'fail') {
						//alert('Sorry!' + data.errorcode Sorry! The email address is not available.);
						msgErrorPrint("The email address you entered has already been registered. <br />Either <a href='#' onclick=\"callPopUp(\'Login\', \'login.htm\'); return false;\" rel='login.htm'>login</a> using that address or register with a different address below.");
						$('#btsubmit').disabled = false;
						$('#btsubmit').removeAttr('disabled');
						return false;
					}else{
						//alert('Added ' + data.errorcode);
						document.frmregs.target = '_parent';
						document.frmregs.submit();
						return true;
					}
				}, "json");
				
				return false;
			}
			return false;
		}else{
			return false;
		}
	}
	
	function checkfone(fnb){
		//patern = /^[0-9]{1,3}\-[0-9]{3}\-[0-9]{3}\-[0-9]{3,4}$/;
		patern = /^[0-9\-]{10,20}$/;
		if(!fnb.value.match(patern)){
			setErrField(fnb);
			msgErrorPrint("Please enter valid phone number.");
			fnb.focus();
			return false;
		}
		return true;
	}
	function msgErrorPrint(strErr){
		err = document.getElementById('sperr');
		err.innerHTML = "<p>" + strErr + "</p>";
		//err.style.padding = "7px";
	}
	function clearErrField(){
		for(i=0; i<len; i++){
			e[i].removeAttribute('style');
		}
	}
	function setErrField(obj){
		obj.style.background = '#ff9b9b';//#
		obj.style.border = "1px #999 solid";//#e4e4e4
		obj.style.borderBottom = "1px #fff solid";
		obj.style.borderRight = "1px #fff solid";
		obj.style.padding = "2px";
	}
	
	function checkemail(emailadd){
		patern = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;///^([\w\-\.\+])+@+(([\w])+.+([.\w])+)$/; 
		if(!emailadd.value.match(patern)){
			//alert("The email entered is invalid!");
			setErrField(emailadd);
			msgErrorPrint("The email entered is invalid!");
			emailadd.focus();
			return false;
		}
		return true;
	}
	
	/*function trim(str) {
	     return str.replace(/^[\s]+/,'').replace(/[\s]+$/,'').replace(/[\s]{2,}/,' '); 
	}*/
