function ua() {
	var ppagree = document.getElementById( "p_ppagree" );
	var tcagree = document.getElementById( "p_tcagree" );
	
	if( !(ppagree.checked && tcagree.checked)) {
		alert( "You must agree to the Terms of Service and\n" +
			   "Privacy Policy before continuing." );
	}
	
	return ppagree.checked && tcagree.checked;
}

function validateSMSText(){
	var res = false;	
	var obj = document.getElementById("p_cmsg");
	
	if( obj != null ) {
		res = hasUC( obj.value );
		
		if( res ) {
			alert( "You have special characters in your error message.\nThese will cause the SMS not to be sent." );
			return false;
		}	
	}
	
	obj = document.getElementById("p_stex");
	if( obj != null ) {
		res = hasUC( obj.value );
		if( res ) {
			alert( "You have special characters in your SMS Text message.\nThese characters will cause the SMS not to be sent." );
			return false;		
		}	
	}
	
	obj = document.getElementById("p_cr");
	if( obj != null ) {
		res = hasUC( obj.value );
		if( res ) {
			alert( "You have special characters in your Response SMS Text.\nThese characters will cause the SMS not to be sent." );
			return false;		
		}	
	}
	
	obj = document.getElementById("p_ir");
	if( obj != null ) {
		res = hasUC( obj.value );
		if( res ) {
			alert( "You have special characters in your Response SMS Text.\nThese characters will cause the SMS not to be sent." );
			return false;		
		}	
	}
	
	return true;
}

function openHelp(str) { 
	
	var newwindow = window.open
		(str,"ImageWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,Width=450,Height=500");

	newwindow.focus();
	newwindow.moveTo(0,0);
}

function openCalculator(str) { 
	
	var newwindow = window.open
		(str,"CalcWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,Width=550,Height=550");

	newwindow.focus();
	newwindow.moveTo(0,0);
}

function openWindow(str) { 
	
	var newwindow = window.open
		(str,"NewWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,Width=650,Height=500");

	newwindow.focus();
	newwindow.moveTo(100,100);
}


function hasSelected( value, objname ) {
	
	var res = false;
	var radio = document.getElementsByName( value );
	
	if( radio != null ) {
	
		for( var i = 0; i < radio.length; i++ ) {
			if( radio[i].checked ) {
				res = true;
				break;
			}
		}
		
		if( !res )
			alert( "Please select a " + objname );
	}
	return res;
}


function hasUC(str){ 
	for (var i=0; i < str.length; i++) { 
		if (str.charCodeAt(i) > 255) 
			return true; 
	} 
	
	return false; 
}

function CharCount(objText,Limit)
{
    if(objText.value.length > Limit)
    {
        objText.value = objText.value.replace(/(.|\n)$/,"");
    }
    else
    {    
		document.all.item("lblCharCount").innerText = Limit - objText.value.length;
    }
}

