
function poptastic(url)
{
	newwindow=window.open(url,'name', 'height=500,width=400,location=false');
	if (window.focus) {newwindow.focus()}
}

function popadmin(url)
{
	newwindow=window.open(url,'name','height=500,width=400,left=100, top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
	if (window.focus) {newwindow.focus()}
}

function checkphone(e){
	var goodphone="";
	var phone=String(e.value);
	phone=phone.replace(/[^0-9]/g,'');
	var vlen=phone.length;

	if (phone)
		{

		if (vlen=='10' && !isNaN(phone))
			{
			goodphone="("+phone.slice(0,3)+") "+phone.slice(3,6)+"-"+phone.slice(6);
			e.value=goodphone;
			}
		else
			{
			alert("The phone number you have entered is invalid. Please enter only 10 numbers including the area code.");
			globalvar = e;
			setTimeout("globalvar.focus();", 1);
			setTimeout("globalvar.select();", 1);
			}
		}
	else
		{
		e.value=phone;
		}
}

function checkemail(e){
	var email=String(e.value);
	if (email){
		if(!email.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)) {
			alert("The email address you have entered is invalid.");
			globalvar = e;
			setTimeout("globalvar.focus();", 1);
			setTimeout("globalvar.select();", 1);
		}
	}
}

function checkssn(e){
	var goodssn="";
	var ssn=String(e.value);
	ssn=ssn.replace(/[^0-9]/g,'');
	var vlen=ssn.length;
	if (ssn) 
		{ 
		if (vlen=='9' && !isNaN(ssn) && ssn!='') 
			{
			goodssn=ssn.slice(0,3)+"-"+ssn.slice(3,5)+"-"+ssn.slice(5);
			e.value=goodssn;
			} 
		else 
			{
			alert("The social security number you have entered is in an unrecognized format. Please us format 333-22-4444.");
			globalvar = e;
			setTimeout("globalvar.focus();", 1);
			setTimeout("globalvar.select();", 1);
			}
		} 
	else 
		{
		e.value=ssn;
		}
}

function checkcurrency(e){
	var num=String(e.value);
	num=num.replace(/[^0-9\.]/g,'');
	if (isNaN(num))
		{
		e.value='0';
		} 
	else 
		{
		e.value=num;
		}
}
    maxKeys = 255;
	var IE = (document.all) ? 1 : 0;
	var DOM = 0; 
	if (parseInt(navigator.appVersion) >=5) {DOM=1};
   
function txtshow( txt2show ) {
	
	// Detect Browser

	if (DOM) {
var viewer = document.getElementById("txtmsg");
		viewer.innerHTML=txt2show;
	}
	else if(IE) {
		document.all["txtmsg"].innerHTML=txt2show;
	}
}

function keyup(txtDesc) 
{
    //PxN - Aug-31-2006 - Start - team track issue id:120000500
    //txtDesc.value = desc_text.substring(0, maxKeys);
  var desc_text=txtDesc.value;
  if (desc_text.length > maxKeys)
    txtDesc.value = desc_text.substring(0, maxKeys);
    //PxN - Aug-31-2006 - End
  var str = new String(txtDesc.value);
  var len = str.length;
  var total = maxKeys - len
  var showstr = total + " characters left.";
  txtshow( showstr );
}

