// Check whether string s is empty.

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

/*
 *  This function will verify that the supplied field has the format of a
 *  valid email address.
 */
function checkEmail( theField )
{
 	var normalizedEmail = formatAsEmailAddress( theField );
   	var theFieldLength = normalizedEmail.length;
   	var i = 1;
   	var errorString = "The e-mail address you entered does not appear to be " +
                      "valid.  A valid e-mail address would be similar to " +
                      "webdeveloper@firsthealth.com";
    theField.value = normalizedEmail;
    if( theFieldLength == 0 ) return true;
  	while((i < theFieldLength) && (normalizedEmail.charAt(i) != "@")) {
   		i++;
   	}
   	if( (i >= theFieldLength) || (normalizedEmail.charAt(i) != "@") ) {
   		alert( errorString );
   		theField.focus();
   		return false;
   	}
   	else {
   		i += 2;
   	}
   	while( (i < theFieldLength) && (normalizedEmail.charAt(i) != ".") ) {
   		i++;
   	}
   	if( (i >= theFieldLength - 1) || (normalizedEmail.charAt(i) != ".") ) {
   		alert( errorString );
   		theField.focus();
   		return false;
   	}
   	else {
   		return true;
   	}
}

/*
 *  This function will format the field so that it appears as a valid email
 *  address.
 */
function formatAsEmailAddress( theField )
{
    theField.value = stripCharsInBag( theField.value, " :;,/" );
    return theField.value;
}

function stripCharsInBag( s, bag )
{
  	var i;
   	var returnString = "";
   	for (i = 0; i < s.length; i++)
   	{
   		var c = s.charAt(i);
   		if(bag.indexOf(c) == -1)
   		{
   		    returnString += c;
   		}
   	}
   	return returnString;
}

function popup(url, width, height) {
	
	//if(!popup.arguments[1]) { var width = 720; }
	//if(!popup.arguments[2]) { var height = 540; }
	var winWidth = 720;
    var winHeight =	540; 
	var xOffset = (800-720-40)*(1/2);
    var yOffset = (600-540)*(1/2);
    myWindow=window.open(url,'myWindow','location=yes,menubar=yes,personalbar=yes,resizable=yes,height='
        			+ winHeight+',width='+winWidth 
        			+',scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,'
        			+ 'innerheight='+winWidth +
        			',innerWidth = '+winHeight+
        			',left=' + xOffset + 
                    ',screenX=' + xOffset + 
                    ',top=' + yOffset + 
                    ',screenY=' + yOffset);  
    myWindow.focus();
}

function openWindow1(record){
	 
	  var winWidth = 720;
        var winHeight =	540;
        var xOffset = (800-720-40)*(1/2);
    	var yOffset = (600-540)*(1/2);
    	    	
        myWindow=window.open('','myWindow','location=yes,menubar=yes,personalbar=yes,resizable=yes,height=\"'
        			+ winHeight+'\",width=\"'+winWidth 
        			+'\",scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,'
        			+ 'innerheight='+winHeight+
        			',innerWidth = '+winWidth+
        			',left=' + xOffset + 
                    ',screenX=' + xOffset + 
                    ',top=' + yOffset + 
                    ',screenY=' + yOffset);
        myWindow.focus();
 }

//jump menu for quick links
 function MM_jumpMenu(targ,selObj,restore){ //v3.0
  var i=0;
  i=selObj.selectedIndex;
  if (restore) selObj.selectedIndex=0;
  eval(targ+".location='"+selObj.options[i].value+"'");
 
}

// For claims status for MHBP
function createNewWindowForClaimStatus( url, windowName, toolbarStatus )
{
    var winWidth = screen.availWidth*.9;
    var winHeight = screen.availHeight*.75;
    var xOffset = (screen.availWidth-winWidth-40)*(1/2);
    var yOffset = (screen.availHeight-winHeight-140)*(1/2);
    var today = new Date();
    var time = today.getTime();

    if ( url.lastIndexOf("?") == -1 )
    {
        url = url + "?uniqueURI=" + time;
    }
    else
    {
        url = url + "&uniqueURI=" + time;
    }

    theWindow = window.open( url,
                             windowName,
                             "dependent," +
                             "directories=no," +
                             "location=no," +
                             "menubar=yes," +
                             "personalbar=no," +
                             "resizable=yes," +
                             "scrollbars=yes," +
                             "status=yes," +
                             "toolbar="+toolbarStatus+"," +
                             "height=" + winHeight + "," +
                             "innerheight=" + winHeight + "," +
                             "width=" + winWidth + "," +
                             "innerWidth=" + winWidth + "," +
                             "left=" + xOffset + "," +
                             "screenX=" + xOffset + "," +
                             "top=" + yOffset + "," +
                             "screenY=" + yOffset );

    theWindow.focus();
}

// MHBP HBO Map
<!---hide-from-old-browsers-
function view_map()
{clickpop=window.open("/mhbp/hbo/java_map.html","popup","scrollbars=yes,resizable=no,top=80,left=115,width=608")}
//--end-->

function ccnHome(gCode)
{
	this.gCode = gCode;
	
	document.location ="/smfh/login.do?groupCode="+gCode;		
}

function goProspectHome()
{
	document.location ="/smfh/login.do?groupCode="+sGroupCode;	
}	