// GLOBAL VALUES FOR SIC CODE
	var SICDIV=new Array(12);
	SICDIV[0]='';
	SICDIV[1]='Agriculture, forestry, and fisheries';
	SICDIV[2]='Construction Industries';
	SICDIV[3]='Finance, Insurance, and Real Estate';
	SICDIV[4]='Manufacturing';
	SICDIV[5]='Mineral Industries';
	SICDIV[6]='Nonclassifiable establishments';
	SICDIV[7]='Public Administration';
	SICDIV[8]='Retail Trade';
	SICDIV[9]='Service Industries';
	SICDIV[10]='Transportation, Communication, and Utilities';
	SICDIV[11]='Wholesale Trade';

	var SICSEC = new Array();

	SICSEC[0]= new Array(1);
	SICSEC[0][0]='';

	SICSEC[1]= new Array(6);
	SICSEC[1][0]='';
	SICSEC[1][1]='Agricultural production - crops';
	SICSEC[1][2]='Agricultural production - livestock';
	SICSEC[1][3]='Agricultural services';
	SICSEC[1][4]='Fishing, hunting, and trapping';
	SICSEC[1][5]='Forestry';

	SICSEC[2]= new Array(4);
	SICSEC[2][0]='';
	SICSEC[2][1]='General building contractors';
	SICSEC[2][2]='Heavy construction contractors';
	SICSEC[2][3]='Special trade contractors';

	SICSEC[3]= new Array(8);
	SICSEC[3][0]='';
	SICSEC[3][1]='Depository institutions';
	SICSEC[3][2]='Holding and other investment offices';
	SICSEC[3][3]='Insurance agents, brokers, and service';
	SICSEC[3][4]='Insurance carriers';
	SICSEC[3][5]='Nondepository credit institutions';
	SICSEC[3][6]='Real estate';
	SICSEC[3][7]='Security, commodity brokers, and services';

	SICSEC[4]= new Array(21);
	SICSEC[4][0]='';
	SICSEC[4][1]='Apparel and other textile products';
	SICSEC[4][2]='Chemicals and allied products';
	SICSEC[4][3]='Electrical and electronic equipment';
	SICSEC[4][4]='Fabricated metal products';
	SICSEC[4][5]='Food and kindred products';
	SICSEC[4][6]='Furniture and fixtures';
	SICSEC[4][7]='Industrial machinery and equipment';
	SICSEC[4][8]='Instruments and related products';
	SICSEC[4][9]='Leather and leather products';
	SICSEC[4][10]='Lumber and wood products';
	SICSEC[4][11]='Miscellaneous manufacturing industries';
	SICSEC[4][12]='Paper and allied products';
	SICSEC[4][13]='Petroleum and coal products';
	SICSEC[4][14]='Primary metal industries';
	SICSEC[4][15]='Printing and publishing';
	SICSEC[4][16]='Rubber and miscellaneous plastics products';
	SICSEC[4][17]='Stone, clay, glass, and concrete products';
	SICSEC[4][18]='Textile mill products';
	SICSEC[4][19]='Tobacco manufactures';
	SICSEC[4][20]='Transportation equipment';

	SICSEC[5]= new Array(5);
	SICSEC[5][0]='';
	SICSEC[5][1]='Coal Mining';
	SICSEC[5][2]='Metal Mining';
	SICSEC[5][3]='Nonmetallic minerals, except fuels';
	SICSEC[5][4]='Oil and gas extraction';

	SICSEC[6]= new Array(2);
	SICSEC[6][0]='';
	SICSEC[6][1]='Nonclassifiable establishments';

	SICSEC[7]= new Array(8);
	SICSEC[7][0]='';
	SICSEC[7][1]='Administration of economic programs';
	SICSEC[7][2]='Administration of human resources';
	SICSEC[7][3]='Environmental quality and housing';
	SICSEC[7][4]='Executive, legislative, and general government';
	SICSEC[7][5]='Finance, taxation, and monetary policy';
	SICSEC[7][6]='Justice, public order, and safety';
	SICSEC[7][7]='National security and international affairs';

	SICSEC[8]= new Array(9);
	SICSEC[8][0]='';
	SICSEC[8][1]='Apparel and accessory stores';
	SICSEC[8][2]='Automotive dealers and gasoline service stations';
	SICSEC[8][3]='Building materials, hardware, garden supply, and mobile';
	SICSEC[8][4]='Eating and drinking places';
	SICSEC[8][5]='Food stores';
	SICSEC[8][6]='Furniture, home furnishings and equipment stores';
	SICSEC[8][7]='General merchandise stores';
	SICSEC[8][8]='Miscellaneous retail';

	SICSEC[9]= new Array(17);
	SICSEC[9][0]='';
	SICSEC[9][1]='Amusement and recreational services';
	SICSEC[9][2]='Automotive repair, services, and parking';
	SICSEC[9][3]='Business services';
	SICSEC[9][4]='Educational services';
	SICSEC[9][5]='Engineering and management services';
	SICSEC[9][6]='Health services';
	SICSEC[9][7]='Hotels, rooming houses, camps, and other lodging places';
	SICSEC[9][8]='Legal services';
	SICSEC[9][9]='Membership organizations';
	SICSEC[9][10]='Miscellaneous repair services';
	SICSEC[9][11]='Miscellaneous services';
	SICSEC[9][12]='Motion pictures';
	SICSEC[9][13]='Museums, art galleries, botanical and zoological garden';
	SICSEC[9][14]='Personal services';
	SICSEC[9][15]='Private households';
	SICSEC[9][16]='Social services';

	SICSEC[10]= new Array(11);
	SICSEC[10][0]='';
	SICSEC[10][1]='Communications';
	SICSEC[10][2]='Electric, gas, and sanitary services';
	SICSEC[10][3]='Local and interurban passenger transit';
	SICSEC[10][4]='Motor freight transportation and warehousing';
	SICSEC[10][5]='Pipelines, except natural gas';
	SICSEC[10][6]='Railroads';
	SICSEC[10][7]='Transportation by air';
	SICSEC[10][8]='Transportation services';
	SICSEC[10][9]='U.S. Postal Service';
	SICSEC[10][10]='Water transportation';

	SICSEC[11]= new Array(3);
	SICSEC[11][0]='';
	SICSEC[11][1]='Wholesale trade - durable goods';
	SICSEC[11][2]='Wholesale trade - nondurable goods';

// field1=division option
// field2=sector option
// field3=division_hidden
// field4=sector_hidden
// field5=divisionText_hidden
// field6=sectorText_hidden
function insertNewDIVOption(field1, field2, field3, filed4, field5) {
     deleteOptions(field1);
     for (i=0; i < SICDIV.length; i++) {
  	   var myOption=new Option();
  	   myOption.text=SICDIV[i];
  	   myOption.value=i;

  	   if (field1.selectedIndex>0)
  		insertIndex=field1.selectedIndex;
  	   else
  		insertIndex=field1.options.length;

  	   field1.options[insertIndex]=myOption;
     }

     field1.selectedIndex = field3.value;
     insertNewSECOption(field1, field2, field3, filed4, field5);
  }

function insertNewSECOption(field1, field2, field3, field4, field5) {
	
	deleteOptions(field2);
	var selectNum = field1.selectedIndex;
	//alert('selectNum='+selectNum);
	  for (i=0; i < SICSEC[selectNum].length; i++) {
	   var myOption=new Option();
	   myOption.text=SICSEC[selectNum][i];
	   myOption.value=i;
	
	   if (field2.selectedIndex>0)
		insertIndex=field2.selectedIndex;
	   else
		insertIndex=field2.options.length;
	
	   field2.options[insertIndex]=myOption;
	  }
	  // SET VALUE FOR DIVISION
	  field3.value = selectNum;
	  field5.value = field1.options[selectNum].text
	  field2.selectedIndex = field4.value;
	  
}

function reloadNewSECOption(field1, field2, field3, field4, field5) {
	
	deleteOptions(field2);
	var selectNum = field1.selectedIndex;
	//alert('selectNum='+selectNum);
	  for (i=0; i < SICSEC[selectNum].length; i++) {
	   var myOption=new Option();
	   myOption.text=SICSEC[selectNum][i];
	   myOption.value=i;
	
	   if (field2.selectedIndex>0)
		insertIndex=field2.selectedIndex;
	   else
		insertIndex=field2.options.length;
	
	   field2.options[insertIndex]=myOption;
	  }
	  field3.value = selectNum;
	  field5.value = field1.options[selectNum].text;
	  field4.value = '0';
	  
}
		
function updateHiddenOptionValue(field2, field4, field6) {
	field4.value = field2.selectedIndex;
	field6.value = field2.options[field2.selectedIndex].text;
}

 function deleteOption(field){
   if (field.selectedIndex>0)
    deleteIndex=field.selectedIndex;
   else
     deleteIndex=field.options.length-1;

   field.options[deleteIndex]=null;
  }

 function deleteOptions(field){
   while (field.options.length>0){
	 deleteIndex=field.options.length-1;
	 field.options[deleteIndex]=null;
	}
  }


// USE IN LOGOUT FUNCTION
function logout(id) {
	var answer =  confirm('You are going to logout, do you want to continue?');
	if (answer) {
		window.location = "../security/Logon.jsf?logout=1&loginId=" + id;
	}
}

function isEcommNumericsOnly(s) {
	var valid = "0123456789";
	return numberTest(s, valid);
}

function isEcommCurrencyOnly(s) {
	var valid = "0123456789.";
	return numberTest(s, valid);
}

function acceptECommNumericsOnly(field) {
	if (!isEcommNumericsOnly(field.value)) {
		var s = field.value;
		field.value = stripCharsNotInBag(s, "0123456789");
	}
}
function acceptECommNumericsAndNegativeOnly(field) {
	if (!isEcommNumericsOnly(field.value)) {
		var s = field.value;
		field.value = stripCharsNotInBag(s, "-0123456789");
	}
}

function isDateFormat(dateStr) {

	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?

	if (matchArray == null) {
		//alert("Please enter date as either mm/dd/yyyy or mm-dd-yyyy.");
		return false;
	}

	month = matchArray[1]; // p@rse date into variables
	day = matchArray[3];
	year = matchArray[5];

	if (month < 1 || month > 12) { // check month range
		// alert("Month must be between 1 and 12.");
		return false;
	}

	if (day < 1 || day > 31) {
		// alert("Day must be between 1 and 31.");
		return false;
	}

	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		// alert("Month "+month+" doesn`t have 31 days!")
		return false;
	}

	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day > 29 || (day==29 && !isleap)) {
			// alert("February " + year + " doesn`t have " + day + " days!");
			return false;
		}
	}
	return true; // date is valid
}

function maskECommZipCode(fld) {
	acceptECommNumericsOnly(fld);
}

function maskECommPhone(fld,e) {
	if (fld.value.length > 0 && fld.value.indexOf('(') == -1) {
		fld.value = "(" + fld.value.substring(0);
	}
	if (fld.value.length >5 && fld.value.indexOf(')') == -1) {
			fld.value = fld.value.substring(0,4) + ")" + fld.value.substring(5);
	}
	if (fld.value.length >9 && fld.value.indexOf('-') == -1) {
		fld.value = fld.value.substring(0,8) + "-" + fld.value.substring(9);
	}
}

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function findSelectedRadio() {
 	var inputs = document.getElementsByTagName('input');
 	for (var x = 0; x < inputs.length; x++) {
 		var input = inputs[x];
       		if (input.type != null && input.type == 'radio' ) {			 		
			if (input.checked) {											
				return input;			
			}					
		}
	}
}
	
function getDropDownValue(qId){
	var questionIndex = getElementByIdEnding(qId);
	var question = "";
	try {
		question = questionIndex.options[questionIndex.selectedIndex].value;
	} catch (e){
		return "";
	}
	return question; 
}
function xGetDropDownValue(qId){
	var questionIndex = xGetElementById(qId);
	var question = "";
	try {
		question = questionIndex.options[questionIndex.selectedIndex].value;
	} catch (e){
		return "";
	}
	return question; 
}
function getDropDownText(qId){
	var questionIndex = getElementByIdEnding(qId);
	var question = "";
	try {
		question = questionIndex.options[questionIndex.selectedIndex].text;
	} catch (e){
		return "";
	}
	return question; 
}
function xGetDropDownText(qId){
	var questionIndex = xGetElementById(qId);
	var question = "";
	try {
		question = questionIndex.options[questionIndex.selectedIndex].text;
	} catch (e){
		return "";
	}
	return question; 
}
function isDropDownValid(qId) {
	var question = getDropDownValue(qId);
	if (isEmpty(question)) {
		return false;
	}
	return true;			
}		
function xIsDropDownValid(qId) {
	var question = xGetDropDownValue(qId);
	if (isEmpty(question)) {
		return false;
	}
	return true;			
}		
function isEmpty(str) {
	if (str != null && str.trim() != "") {
		return false;
	} 
	return true;		
}

function isEmail(s) { 
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = s.length;
	if(sLength == 0) {
		return true;
	}
	// look for empty quotation marks in the email
    var x;
	var found = 0;
	for (x = 0; x < sLength; x++) {
		if (s.charAt(x) == '\"') {
	 		found = 1;
	 		break;
	  	}
	}
	if (found == 1) return false;
	// end looking for quotation remarks
	
    // look for @
    while ((i < sLength) && (s.charAt(i) != '@')) {
    	i++
    }

    if ((i >= sLength) || (s.charAt(i) != '@')) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != '.')) {
 		i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != '.')) return false;
    else return true;
}

function format(field) {
	var s = field.value;
	if (!isEcommNumericsOnly(s)) {				
		var s1 = stripCharsNotInBag(s, "0123456789");
	} else {
		var s1 = s;
	}
	var amount = CommaFormatted(replaceComma(s1));
	if (amount != s) {
		field.value = amount;
	}
}

function formatNegative(field) {
	var s = field.value;
	if (!isEcommNumericsOnly(s)) {				
		var s1 = stripCharsNotInBag(s, "-0123456789");
	} else {
		var s1 = s;
	}
	var amount = CommaFormatted(replaceComma(s1));
	if (amount != s) {
		field.value = amount;
	}
}

function CommaFormatted(amount) {
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return amount; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	amount = minus + a.join(delimiter);
	return amount;
}
// SAVE THE DROPDOWN VALUE FOR CONFIRMATION PAGE
function updateDropdownValue(id) {		 
 	var selobj = getElementByIdEnding(id);			
	var selected = selobj.options[selobj.selectedIndex].value;
	var label='';
	try {
		label = selobj[selobj.selectedIndex].firstChild.nodeValue;
	} catch (e){
	}
	
	var hiddenField = getElementByIdEnding(id+'_hidden');
	hiddenField.value = label;
 }

// UPDATE THE VALUE AND LABEL TO VALUE=ID_HIDDENVALUE, LABEL=ID_HIDDEN
function updateDropdownValueAndId(id) {		 
 	var selobj = getElementByIdEnding(id);			
	var selected = selobj.options[selobj.selectedIndex].value;
	var label='';
	try {
		label = selobj[selobj.selectedIndex].firstChild.nodeValue;
	} catch (e){
	}
	
	var idHiddenField = getElementByIdEnding(id+'_hiddenValue');
	idHiddenField.value = selected;
	var labelHiddenField = getElementByIdEnding(id+'_hidden');
	labelHiddenField.value = label;
 }

//HIGHLIGHT INPUT FIELD
function highlightActiveInput() {
  if(currentlyActiveInputRef) {
    currentlyActiveInputRef.className = currentlyActiveInputClassName;
  }
  currentlyActiveInputClassName = this.className;
  this.className = 'inputHighlighted ' + this.className;
  currentlyActiveInputRef = this;
}

function blurActiveInput() {
  this.className = currentlyActiveInputClassName;
}

function initInputHighlightScript() {
  var tags = ['INPUT','TEXTAREA'];
  for(tagCounter=0;tagCounter<tags.length;tagCounter++){
    var inputs = document.getElementsByTagName(tags[tagCounter]);
    for(var no=0;no<inputs.length;no++){
      if(inputs[no].className && inputs[no].className.indexOf('doNotHighlightThisInput')>-1)continue;
      if(inputs[no].tagName.toLowerCase()=='textarea' 
      	|| (inputs[no].tagName.toLowerCase()=='input' 
		&& inputs[no].type.toLowerCase()=='text')){
        	inputs[no].onfocus = highlightActiveInput;
        	if (inputs[no].onblur) {
        	} else {
        		inputs[no].onblur = blurActiveInput;
        	}
      }
    }
  }
}

function timeIsOutEC(id) { 
    jAlert ("Your session has timed out. Please sign in if you would like to continue.");
    //window.parent.header.document.getElementById("test").value = "close";
    //window.close();
    window.location='../security/Logon.jsf?logout=1&loginId=' + id;
} 

function doCleanUpEC() {

    if (_myKey != "") {
        var url = _mlmBaseHref + "/cleanup?id=" + escape(_myKey);
        var loader = new mlmAjx.ContentLoader(url,null,null,"GET");
    }   
}

//SHOW/HIDE POPUP //////////////////////////////////////
function insertDIVOption() {
	var field1=getElementByIdEnding('division');
     deleteOptions(field1);
     for (i=0; i < SICDIV.length; i++) {
  	   var myOption=new Option();
  	   myOption.text=SICDIV[i];
  	   myOption.value=i;

  	   if (field1.selectedIndex>0)
  		insertIndex=field1.selectedIndex;
  	   else
  		insertIndex=field1.options.length;

  	   field1.options[insertIndex]=myOption;
     }
  }

function insertSECOption() {
	var field1=getElementByIdEnding('division');
	var field2=getElementByIdEnding('sector');
	deleteOptions(field2);
	var selectNum = field1.selectedIndex;
	//alert('selectNum='+selectNum);
	  for (i=0; i < SICSEC[selectNum].length; i++) {
	   var myOption=new Option();
	   myOption.text=SICSEC[selectNum][i];
	   myOption.value=i;
	
	   if (field2.selectedIndex>0)
		insertIndex=field2.selectedIndex;
	   else
		insertIndex=field2.options.length;
	
	   field2.options[insertIndex]=myOption;
	  }
	  // CLEAR INDUSTRY OPTION AND SICCODE FIELD
	  clearIndustryOption();
}

function clearIndustryOption() {
	var field3=getElementByIdEnding('industry');
	deleteOptions(field3);
	var field4=getElementByIdEnding('industrysic');
	field4.value='';
}






function ShowPopup(hoveritem)
{
	hp = getElementByIdEnding(hoveritem);
/*	
	tempX = event.clientX + document.body.scrollLeft;
	tempY = event.clientY + document.body.scrollTop;
	
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;} 

	//document.Show.MouseX.value = tempX;
	//document.Show.MouseY.value = tempY;
	
	// Set position of hover-over popup
	hp.style.top = tempY + 2;
	hp.style.left = tempX + 10;
*/	
	// Set popup to visible
	hp.style.visibility = "visible";
	setOptions();

	return true;
}

function ShowPopupWithOption(hoveritem)
{
	hp = getElementByIdEnding(hoveritem);
/*	
	tempX = event.clientX + document.body.scrollLeft;
	tempY = event.clientY + document.body.scrollTop;
	
	if (tempX < 0){tempX = 0;}
	if (tempY < 0){tempY = 0;} 

	//document.Show.MouseX.value = tempX;
	//document.Show.MouseY.value = tempY;
	
	// Set position of hover-over popup
	hp.style.top = tempY + 2;
	hp.style.left = tempX + 10;
*/	
	// Set popup to visible
	hp.style.visibility = "visible";
	//setOptions();

	return true;
}

function HidePopupWithOption(hoveritem)
{
	hp = getElementByIdEnding(hoveritem);
	hp.style.visibility = "hidden";
	//setOptions();
}

function HidePopup(hoveritem)
{
	hp = getElementByIdEnding(hoveritem);
	hp.style.visibility = "hidden";
	setOptions();
}

function setOptions() {
	fields = document.getElementsByTagName("SELECT");
    for (var i = 0; i < fields.length; i++)  {
    	if (!excludeFromPopupCheck(fields[i].name)) {  
    		fields[i].disabled = !fields[i].disabled;
    	}
    }
}

function excludeFromPopupCheck(id) {
	if (isUndefined(id)) {
		return false;
	} else if ((id.indexOf('division') > 0) || (id.indexOf('sector') > 0) || (id.indexOf('industry') > 0)){
		return true;
	} else {
		return false;
	}
}

function grayOut(vis, options) {
  // Pass true to gray out screen, false to ungray
  // options are optional.  This is a JSON object with the following (optional) properties
  // opacity:0-100         // Lower number = less grayout higher = more of a blackout 
  // zindex: #             // HTML elements with a higher zindex appear on top of the gray out
  // bgcolor: (#xxxxxx)    // Standard RGB Hex color code
  // grayOut(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
  // Because options is JSON opacity/zindex/bgcolor are all optional and can appear
  // in any order.  Pass only the properties you need to set.
  var options = options || {}; 
  var zindex = options.zindex || 50;
  var opacity = options.opacity || 40;
  var opaque = (opacity / 100);
  var bgcolor = options.bgcolor || '#000000';
  var dark=getElementByIdEnding('darkenScreenObject');
  if (!dark) {
    // The dark layer doesn't exist, it's never been created.  So we'll
    // create it here and apply some basic styles.
    // If you are getting errors in IE see: http://support.microsoft.com/default.aspx/kb/927917
    var tbody = document.getElementsByTagName("body")[0];
    var tnode = document.createElement('div');           // Create the layer.
        tnode.style.position='absolute';                 // Position absolutely
        tnode.style.top='0px';                           // In the top
        tnode.style.left='0px';                          // Left corner of the page
        tnode.style.overflow='hidden';                   // Try to avoid making scroll bars            
        tnode.style.display='none';                      // Start out Hidden
        tnode.id='darkenScreenObject';                   // Name it so we can find it later
    tbody.appendChild(tnode);                            // Add it to the web page
    dark=getElementByIdEnding('darkenScreenObject');  // Get the object.
  }
  if (vis) {

    if (window.innerHeight && window.scrollMaxY) {// Firefox
    	var pageHeight = window.innerHeight + window.scrollMaxY;
		var pageWidth = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
		var pageHeight = document.body.scrollHeight;
		var pageWidth = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		var pageHeight = document.body.offsetHeight;
		var pageWidth = document.body.offsetWidth;
  	}

    //set the shader to cover the entire page and make it visible.
    dark.style.opacity=opaque;                      
    dark.style.MozOpacity=opaque;                   
    dark.style.filter='alpha(opacity='+opacity+')'; 
    dark.style.zIndex=zindex;        
    dark.style.backgroundColor=bgcolor;  
    dark.style.width= pageWidth +'px';
    dark.style.height= pageHeight +'px';
    dark.style.display='block';                          
  } else {
     dark.style.display='none';
  }
}
function isCompletePhone(str){
	if (str != null && str.trim() != "") {
		var s1 = stripCharsNotInBag(str, "0123456789");
		if (s1.length > 0 && s1.length != 10) {
			return false;
		}
	} 
	return true;
}


function parsePhone(name) {
	var fld = getElementByIdEnding(name) 
	if (fld != null) {
		var value = stripCharsNotInBag(fld.value, "0123456789"); 
		if (value != null && !isEmpty(value) && value.length > 1) {
			if (value.length > 2) {
				getElementByIdEnding(name+'1').value = value.substring(0, 3);
				if (value.length > 3) {
					getElementByIdEnding(name+'2').value = value.substring(3, 6);
					if (value.length == 10) {
						getElementByIdEnding(name+'3').value = value.substring(6, 10);
					} else if (value.length > 6) {
						getElementByIdEnding(name+'3').value = value.substring(7);
					}
				} else if (value.length > 4) {
					getElementByIdEnding(name+'2').value = value.substring(3);
				}
			} else {
				getElementByIdEnding(name+'1').value = value.substring(0);
			}
		}
	}
}
// END SHOW/HIDE POPUP //////////////////////////////////////


function open_loadingpopup(id){
	jLoadMess();
}

function showDisabled(activeBtn) {
	activeBtn.style.display='none';	
	var disabledBtn = xGetElementById(activeBtn.id+"Disabled");
	disabledBtn.style.display='block';
}

function jq(myid)
{ return '#'+myid.replace(/:/g,"\\:").replace(/\./g,"\\.");}

//////////////////////////////////////////////
//COOKIE
/////////////////////////////////////////////
function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
	endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name)  {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	//alert('cookie='+unescape(document.cookie));
	var i = 0;
	while (i < clen)  {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
		return getCookieVal (j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}
function SetCookie (name, value, expires)  {
	document.cookie = name + "=" + escape (value) +
	((expires == null) ? "" : ("; expires=" + expires.toGMTString()));
}
function DeleteCookie (name) {
	if (GetCookie(name)) {
		document.cookie = name + "= ; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

//////////////////////////////////////////////
//TEST DATA
/////////////////////////////////////////////
function initNewSubInsure() {
if (getElementByIdEnding('product').selectedIndex==0) {
getElementByIdEnding('product').focus();		
} else {
getElementByIdEnding('organization').focus();
}
// UPDATE PHONE, FAX
parsePhone('phone');
parsePhone('fax');
}
function initNewSubQuestionAPL() {
getElementByIdEnding('hasPriorCarrier_PreSelect').value = getElementByIdEnding('hasPriorCarrier').value;
}
function initNewSubQuestionEPL() {

}
function initNewSubQuestionClaimEPL() {

}
function initNewSubQuestionSBU() {

}
function initNewSubQuestionFEPL() {

}
function initNewSubQuestionClaimFEPL() {

}
function initNewSubQuestionLPL() {

}
function initNewSubQuestionClaimLPL() {

}
function initNewSubQuestionML() {

}
function initNewSubQuestionClaimML() {

}
function initNewSubQuestionNP() {

}
function initRequestAccess() {

}
function initMarketingEvent() {

}
function initPortalNP() {

}
function initPortalEPL() {

}
function initPortalAPL() {

}

 
