var news_id;
var checked1 = '';
var checked2 = '';
var next = '/portal.php';
var vn_row_counter = 1000;
var vr_row_counter = 1000;
var suffix_html = '';
var relation_html = '';
var js_cache_div = '';
var yearList_html = '';

function createDropDown(){
	suffix_html = '';
	relation_html = '';

	var suffix = ["Sr.", "Jr.", "I", "II", "III", "IV", "V", "VI", "VII", "VII", "XI"];
	for (i=0; i<suffix.length ; i++ ){
		suffix_html += '<option value="' + suffix[i] + '">' + suffix[i] + '</option>';	
	}
	var relation = [['spouse', 'Spouse'],
					['partner','Partner'],
					['parent','Parent'],
					['child','Child'],	
					['grandchild','Grandchild'],
					['other','Other']];
	for (i=0; i<relation.length ; i++ ){
		relation_html += '<option value="' + relation[i][0] + '">' + relation[i][1] + '</option>';	
	}
}

function createYearDropdown(type){
	var date_obj = new Date();
	var year = date_obj.getFullYear();

	yearList_html = '<option value="0">Year</option>';
	
	switch (type){
		case 'haveRemovedFraudAlerts':
		case 'editFraudAlertsPlacedDate':
		case 'editFraudAlertsRemovedDate':
		case 'havePlacedFraudAlerts':
			/*for (i=year-2; i<=year; i++ ){
				yearList_html += '<option value="'+i+'">'+i+'</option>';
			}*/
			yearList_html += '<option value="'+year+'">'+year+'</option>';
		break;
	}
}

function queryNewsLetter_status(aJaX_obj, AJX_response){
	//alert(AJX_response);
	AJX_response = eval(AJX_response);

	if (AJX_response[0] == '1') {
		checked1 = 'checked';
	} else {
		checked1 = '';
	}

	if (AJX_response[1] == '1'){
		checked2 = 'checked';
	} else {
		checked2 = '';
	}
	
	var news_letter_html = '<form name="news_letter" id="news_letter" onsubmit="return false;"><table cellpadding="0" border="0" cellspacing="0"'+
		'<tr><td valign="top"><input type="checkbox" value="1" name="upCheck1" id="upCheck1" onclick="saveNewsLetter()" ' + checked1 + '></td>'+
		'<td style="vertical-align:top;padding-left:2px;">YES, I would like to receive Identity Theft Prevention Tips occasionally.</td>'+
		'</tr><tr><td valign="top"><input type="checkbox" value="1" name="upCheck2" id="upCheck2" onclick="saveNewsLetter()" ' + checked2 + '></td><td style="vertical-align:top;padding-left:2px;">'+
		'YES, I would like Other Offers that help protect my identity.</td></tr></table></form>';
		popInfoBox(news_id ,news_letter_html, 'Update Newsletter Subsciptions');
}

function queryNewsLetter(){
	var ajaxSave = new aJaX(queryNewsLetter_status);
	ajaxSave.modeGET('/ajax/newsLetter.php?query=1');	
	return false;
}

/*function saveNewsLetter_status(aJaX_obj, AJX_response){
	//alert(AJX_response);
}*/

function saveNewsLetter(){
	var ajaxSave = new aJaX();
	try{
		var postContent = encodeForm('news_letter');
	} catch(e){alert(e);}
	ajaxSave.modePOST('/ajax/newsLetter.php', postContent); 
	return false;
}

function showNewsLetter(obj){
	news_id = obj;
	queryNewsLetter();	
	return false;
}

function appendData(type, str){	
	switch (type){
		case 'add_BankAcc':
			var bank_div = document.createElement('div');
			bank_div.innerHTML = unescape(str);
			if (elementById('no_bank_record') != null) {
				elementById('no_bank_record').style.display = 'none';
			}
			elementById('add_new_bank').appendChild(bank_div);
			if(elementById('bacc_ttl')){
				var val = parseInt(elementById('bacc_ttl').innerHTML);
				val++;
				elementById('bacc_ttl').innerHTML = val.toString();
			}
			try{
				elementById('usr_bank').className = 'displayed';
				elementById('disp_ctrl_bank').className = 'btn_hide';
			} catch(e){}
		break;

		case 'add_Card':
			var card_div = document.createElement('div');
			card_div.innerHTML = unescape(str);
			if (elementById('no_card_record') != null) {
				elementById('no_card_record').style.display = 'none';
			}
			elementById('add_new_card').appendChild(card_div);
			if(elementById('cc_ttl')){
				var val = parseInt(elementById('cc_ttl').innerHTML);
				val++;
				elementById('cc_ttl').innerHTML = val.toString();
			}
			try{
				elementById('usr_card').className = 'displayed';
				elementById('disp_ctrl_card').className = 'btn_hide';
			} catch(e){}
		break;

		case 'add_Insurance':
			var insur_div = document.createElement('div');
			insur_div.innerHTML = unescape(str);
			if (elementById('no_insurance_record') != null) {
				elementById('no_insurance_record').style.display = 'none';
			}
			elementById('add_new_insurance').appendChild(insur_div);
			if(elementById('ins_ttl')){
				var val = parseInt(elementById('ins_ttl').innerHTML);
				val++;
				elementById('ins_ttl').innerHTML = val.toString();
			}
			try{
				elementById('usr_insur').className = 'displayed';
				elementById('disp_ctrl_insur').className = 'btn_hide';
			} catch(e){}
		break;
	}
	if(arguments[2] != null){
		var id = arguments[2];
			if(elementById('js_display_'+id)){				
			setTimeout(function() {Effect.Fade('js_display_'+id);},5000);			
		}
	}	
}

function updateData(type, id, str){
	switch (type){
		case 'bank':
			elementById('bnk_'+id).innerHTML = unescape(str);
			setTimeout(function() {Effect.Fade('js_display_'+id);},5000);
		break;

		case 'card':
			elementById('cdc_'+id).innerHTML = unescape(str);
			setTimeout(function() {Effect.Fade('js_display_'+id);},5000);
		break;

		case 'insurance':
			elementById('ins_'+id).innerHTML = unescape(str);
			setTimeout(function() {Effect.Fade('js_display_'+id);},5000);
		break;
	}
}


function saveStatus(aJaX_obj, AJX_response){
	elementById('saving_status').className = 'hidden';
	elementById('save_button').style.display = 'block';
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'ERR':
			printErrors(AJX_response);
			break;
		case 'OK':
			if(next != ''){
				window.location=next;
			} else {
				window.location.reload();
			}
			close_box(AJX_response[1]);
			/*
			if( AJX_response[3]){
				appendData(AJX_response[1], AJX_response[2], AJX_response[3]);
			} else {
				appendData(AJX_response[1], AJX_response[2]);
			}
			close_box(AJX_response[1]);
			if (navigator.userAgent.search('MSIE 6.0;') != '-1') {
				window.location.reload();
			}
			*/
	}
	busy = false;
}

function editStatus(aJaX_obj, AJX_response){
	elementById('saving_status').className = 'hidden';
	elementById('save_button').style.display = 'block';
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'ERR':
			printErrors(AJX_response);
			break;
		case 'OK':
		case 'NC':
			updateData(AJX_response[1], AJX_response[3], AJX_response[4]);
			close_box(AJX_response[2]);
	}
	busy = false;
}

function save(s_type){
	if(busy == false){
		busy = true;
		elementById('saving_status').className = 'displayed';
		elementById('save_button').style.display = 'none';
		var ajaxSave = new aJaX(saveStatus);
		var postContent = encodeForm('add_'+s_type);
		ajaxSave.modePOST('/ajax/popup_save.php', postContent);		
	}
	return false;
}

function saveEdit(s_type){
	if(busy == false){
		busy = true;
		elementById('saving_status').className = 'displayed';
		elementById('save_button').style.display = 'none';
		var ajaxSave = new aJaX(editStatus);
		var postContent = encodeForm('edit_'+s_type);
		ajaxSave.modePOST('/ajax/popup_edit.php', postContent);
	}
	
	return false;
}

var fade_bckg = function(){
	if(elementById('background_faded') == null){
		var background_faded = document.createElement('div');
		background_faded.setAttribute('id', 'background_faded');				
		
		document.body.appendChild(background_faded);
		var pageDimensions = getPageSize();		
		background_faded.style.height = pageDimensions[1] + 'px';
		background_faded.style.width = pageDimensions[0] + 'px';
		
		change_opacity(0); 	
	} else {
		document.body.removeChild(elementById('background_faded'));
		fade_bckg();
	}
}

var opacityTimer;
function change_opacity(i){ 
	if( i<20 ){ 
		try{ 
			var object = elementById('background_faded').style; 
		} catch(e) {
			try{
				var object = window.parent.elementById('background_faded').style; 
			} catch(e){}
		}
		if(object){
			elementById('background_faded').style.opacity = i/100; 
			object.filter = "alpha(opacity=" + i + ")"; 
			opacityTimer = setTimeout(function() {change_opacity(i);}, 0); 
			i += 1.5;
		}
	} else { 
		clearTimeout(opacityTimer); 
	} 
}

function close_box(id){
	if (!arguments[1]){
		Effect.Fade(id);
	} else {
		switch(arguments[1]){
			case 'slideup':
				Effect.SlideUp(id);
			break;
		}
	}
	try{
		document.body.removeChild(elementById('background_faded'));
	} catch(e){}
	return false;
}

function showSanaPopup(){
	fade_bckg();
	if (elementById('sana_popup') != null){
		document.body.removeChild(elementById('sana_popup'));
		showSanaPopup();
	} else {
		var pop_sana = document.createElement('div');
			pop_sana.setAttribute('id', 'sana_popup');
			document.body.appendChild(pop_sana);
			var html =  '<div class="add_popup" style="width:735px;height:840px;">'
						+ '<div class="header">'
						+ 	'<div class="title">Secure Scan</div>'
						+		'<div class="close" onclick="return close_box(\'sana_popup\')"></div>'
						+ '</div>'
						+ '<div id="portal_sana_download" style="position:relative;">'
						+ '<div style="position:absolute;top:104px;left:574px;width:93px;height:17px;cursor:pointer;" onclick="window.location=\'/download/TrustedID_IP_setup_1yr_en.exe\'"></div>'
						+ '<div style="position:absolute;top:126px;left:6px;width:78px;height:17px;cursor:pointer;" onclick="window.location=\'/download/TrustedID_IP_setup_1yr_en.exe\'"></div>'
						+ '<div style="position:absolute;width:169px;height:19px;top:556px;left:218px;color:#ff0000;font-family:courier;font-weight:bold;font-size:19px;">5KX6YSRGRCJ93DDQNDNS</div>'
						+ '</div>'
						+'</div>';
			pop_sana.innerHTML = html;
			floatDiv("sana_popup",30).floatIt();
	}
}


function showPop(type){
	//appendData();
	fade_bckg();
	switch (type){
		case 'bankAcc':
			if (elementById('add_BankAcc') != null)
			{
				document.body.removeChild(elementById('add_BankAcc'));
				showPop(type);
			} else {
				var pop_bankAcc = document.createElement('div');
				pop_bankAcc.setAttribute('id', 'add_BankAcc');
				document.body.appendChild(pop_bankAcc);
				pop_bankAcc.innerHTML =	'<form id="add_bankAccc" name="add_bankAccc" onsubmit="return false;">'
					+ '<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Add Bank Account</div>'
					+		'<div class="close" onclick="return close_box(\'add_BankAcc\')"></div>'
					+ '</div>'
					+ '<div class="pad_5">We monitor your bank accounts and notify you if we ever find the information being bought, traded, or sold on the Internet. Add a new account by completing the form below and be sure to click &ldquo;Save&rdquo; when you are done.</div>'
					+ '<table border="0" cellspacing="0" cellpadding="5">'
						+ '<tr>'
						+ 	'<td class="w_150">Account Holder: *</td>'
						+ 	'<td><select class="field" name="acc_holder_name" id="acc_holder_name" style="width:136px;">'
						+	'<option value="">--</option>'
						+	accHolderList_html
						+	'</select><div class="input_err" id="acc_holder_name_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Bank Name:&nbsp;*</td>'
						+ 	'<td><input class="field" name="acc_name" id="acc_name" type="text" maxlength="50"><div class="input_err" id="acc_name_err"></div></td>'
						+ 	'<td>(e.g. Chase, Citibank)</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Account Nickname:</td>'
						+ 	'<td><input class="field" name="acc_nick_name" id="acc_nick_name" type="text" maxlength="50"></td>'
						+ 	'<td>(e.g. My Savings Account)</td>'
						+ '</tr>'
					
						+ '<tr>'
						+ 	'<td class="w_150">Routing Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="route_num" id="route_num" type="text" maxlength="9" validate="numerical"><div class="input_err" id="route_num_err"></div></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'
				 
						+ '<tr>'
						+ 	'<td class="w_150">Account Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="bank_acc_num" id="bank_acc_num" type="text" maxlength="30" validate="numerical"><div class="input_err" id="bank_acc_num_err"></div><input type="hidden" name="type" value="bankAcc"></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150" style="vertical-align:top;">Bank Phone Number:&nbsp;</td>'
						+ 	'<td>1&nbsp;-&nbsp;<input class="field" style="width:20px;" name="bank_phone_num1" id="bank_phone_num1" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:20px;" style="width:10px;" name="bank_phone_num2" id="bank_phone_num2" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:26px;" name="bank_phone_num3" id="bank_phone_num3" type="text" maxlength=4 validate="numerical"><div>Toll-Free Customer Service number</div><div class="input_err" id="bank_phone_err"></div></td>'
						+ '</tr>'

					+ '</table>'
					
					+	'<table border="0" cellspacing="0" cellpadding="5">'+
							'<tr>'+
								'<td class="w_150">&nbsp;</td>'+
								'<td>'+
									'<div id="save_button" class="btn_med_silver w_75" onclick="save(\'bankAccc\')"><div class="bl"><div class="br">SAVE</div></div></div>'+
									'<div id="saving_status" class="hidden" style="text-align:center;width:75px"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'+
								'</td>'+
								'<td style="padding-left:10px"><a href="#" onclick="return close_box(\'add_BankAcc\')">Cancel</a></td>'+
							'</tr>'+
						'</table>'
					+'</div></form>';
					init('add_bankAccc');
					floatDiv("add_BankAcc",220).floatIt();
			}
		break;

		case 'addCard':
			if (elementById('add_Card') != null)
			{
				document.body.removeChild(elementById('add_Card'));
				showPop(type);
			} else {
				var pop_card = document.createElement('div');
				pop_card.setAttribute('id', 'add_Card');
				document.body.appendChild(pop_card);
				pop_card.innerHTML = '<form id="add_addCard" name="add_addCard" onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Add Credit/Debit Card</div>'
					+		'<div class="close" onclick="return close_box(\'add_Card\')"></div>'
					+ '</div>'
					+ '<div class="pad_5">We monitor your credit and debit accounts and notify you if we ever find the information being bought, traded, or sold on the Internet. Add a new account by completing the form below and be sure to click &ldquo;Save&rdquo; when you are done.</div>'
					+ '<table border="0" cellspacing="0" cellpadding="5">'
						+ '<tr>'
						+ 	'<td class="w_150">Account Holder: *</td>'
						+ 	'<td><select class="field" name="acc_holder_name" id="acc_holder_name" style="width:136px;">'
						+	'<option value="">--</option>'
						+	accHolderList_html
						+	'</select><div class="input_err" id="acc_holder_name_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Bank Name:&nbsp;*</td>'
						+ 	'<td><input class="field" name="cd_acc_name" id="cd_acc_name" type="text" maxlength="50"><div class="input_err" id="cd_acc_name_err"></div></td>'
						+ 	'<td>(e.g. Chase, Citibank)</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Account Nickname:</td>'
						+ 	'<td><input class="field" name="acc_nick_name" id="acc_nick_name" type="text" maxlength="50"></td>'
						+ 	'<td>(e.g. My Checking)</td>'
						+ '</tr>'
					
						+ '<tr>'
						+ 	'<td class="w_150">Account Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="acc_num" id="acc_num" type="text" maxlength="16" validate="numerical"><div class="input_err" id="acc_num_err"></div></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'
				 
						+ '<tr>'
						+ 	'<td class="w_150">Re-Enter Account Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="re_acc_num" id="re_acc_num" type="text" maxlength="16" validate="numerical"><input type="hidden" name="type" value="addCard">'
						+		'<div class="input_err" id="re_acc_num_err"></div></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150" style="vertical-align:top;">Bank Phone Number:&nbsp;</td>'
						+ 	'<td>1&nbsp;-&nbsp;<input class="field" style="width:20px;" name="bank_phone_num1" id="bank_phone_num1" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:20px;" style="width:10px;" name="bank_phone_num2" id="bank_phone_num2" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:26px;" name="bank_phone_num3" id="bank_phone_num3" type="text" maxlength=4 validate="numerical"><div style="width:200px;">Toll-Free Customer Service number located on back of credit/debit card</div><div class="input_err" id="bank_phone_err"></div></td>'
						+ '</tr>'

					+ '</table>'

					+	'<table border="0" cellspacing="0" cellpadding="5">'+
							'<tr>'+
								'<td class="w_150">&nbsp;</td>'+
								'<td>'+
									'<div id="save_button" class="btn_med_silver w_75" onclick="save(\'addCard\')"><div class="bl"><div class="br">SAVE</div></div></div>'+
									'<div id="saving_status" class="hidden" style="text-align:center;width:75px"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'+
								'</td>'+
								'<td style="padding-left:10px"><a href="#" onclick="return close_box(\'add_Card\')">Cancel</a></td>'+
							'</tr>'+
						'</table>'
					+'</div></form>';
					init('add_addCard');
					floatDiv("add_Card",220).floatIt();
			}
		break;

		case 'addInsurance':
			if (elementById('add_Insurance') != null)
			{
				document.body.removeChild(elementById('add_Insurance'));
				showPop(type);
			} else {
				var pop_Insurance = document.createElement('div');
				pop_Insurance.setAttribute('id', 'add_Insurance');
				document.body.appendChild(pop_Insurance);
				pop_Insurance.innerHTML = '<form id="add_addInsurance" name="add_addInsurance" onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Add Health Insurance</div>'
					+		'<div class="close" onclick="return close_box(\'add_Insurance\')"></div>'
					+ '</div>'
					+ '<div class="pad_5">To add a new insurance company, please complete the form below and click &ldquo;Save&rdquo; when you are done.</div>'
					
					+ '<table border="0" cellspacing="0" cellpadding="5">'
						
						+ '<tr>'
						+ 	'<td class="w_150">Account Holder: *</td>'
						+ 	'<td><select class="field" name="acc_holder_name" id="acc_holder_name" style="width:210px;">'
						+	'<option value="">--</option>'
						+	accHolderList_html
						+	'</select><div class="input_err" id="acc_holder_name_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Health Insurance Provider: *</td>'
						+ 	'<td><input class="field w_200" name="com_name" id="com_name" type="text" maxlength="50"><div class="input_err" id="com_name_err"></div></td>'
						+ '</tr>'
					
						+ '<tr>'
						+ 	'<td class="w_150">Address: *</td>'
						+ 	'<td><input class="field w_200" name="address1" id="address1" type="text" maxlength="200"><div class="input_err" id="address1_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">&nbsp;</td>'
						+ 	'<td><input class="field w_200" name="address2" id="address2" type="text" maxlength="200"></td>'
						+ '</tr>'
						+ '<tr>'	
						+ 	'<td class="w_150">City, State & Zip: *</td>'
								+ '<td>'
								+ '<input class="field w_75" name="city" id="city" type="text" maxlength="50" validate="literal">&nbsp&nbsp'
									+ '<select class="field w_45" name="state" id="state" style="width:56px;">'
										+ statesList_html
									+ '</select>&nbsp&nbsp'
								+ '<input class="field w_55" name="zip" id="zip" maxlength="5" type="text" validate="numerical"><div class="input_err" id="ins_address_err"></div></td>'
							+ '</tr>'
						+ '<tr>'
						+ 	'<td class="w_150">Account/ID Number: *</td>'
						+ 	'<td><input class="field w_200" name="accID_num" id="accID_num" type="text" maxlength="50"><div class="input_err" id="accID_num_err"></div></td>'
						+ '</tr>'
				 
						+ '<tr>'
						+ 	'<td class="w_150">Group Number: *</td>'
						+ 	'<td><input class="field w_200" name="group_num" id="group_num" type="text" maxlength="50"><div class="input_err" id="group_num_err"></div><input type="hidden" name="type" value="addInsurance"></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150" style="vertical-align:top;">Member Services Phone Number:&nbsp;</td>'
						+ 	'<td>1&nbsp;-&nbsp;<input class="field" style="width:20px;" name="insur_phone_num1" id="insur_phone_num1" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:20px;" style="width:10px;" name="insur_phone_num2" id="insur_phone_num2" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:26px;" name="insur_phone_num3" id="insur_phone_num3" type="text" maxlength=4 validate="numerical"><br><div style="width:300px;">Health Insurance Provider Toll-Free Customer Service number located on Health Insurance card</div><div class="input_err" id="insur_phone_err"></div>'
						+ '</td></tr>'

					+ '</table>'

					+	'<table border="0" cellspacing="0" cellpadding="5">'+
							'<tr>'+
								'<td class="w_150">&nbsp;</td>'+
								'<td>'+
									'<div id="save_button" class="btn_med_silver w_75" onclick="save(\'addInsurance\')"><div class="bl"><div class="br">SAVE</div></div></div>'+									
									'<div id="saving_status" class="hidden" style="text-align:center;width:75px"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'+
								'</td>'+
								'<td style="padding-left:10px"><a href="#" onclick="return close_box(\'add_Insurance\')">Cancel</a></td>'+
							'</tr>'+
						'</table>'
					+'</div></form>';
					init('add_addInsurance');
					floatDiv("add_Insurance",150).floatIt();
			}
		break;
	}
	return false;
}

	function show_hide_content(obj, id){
		toggle_box_display(obj);
		var div_obj = document.getElementById(id);
			div_obj.style.display = (div_obj.style.display == 'none')? '' : 'none';
	}

	/* portal_new.js */
	function toggle_box_display(obj){
		switch(obj.className){
			case 'btn_show_all':
				obj.className = 'btn_hide_all';
				all_fields('show');
				break;
			case 'btn_hide_all':
				obj.className = 'btn_show_all';
				all_fields('hide');
				break;
			default:
				obj.className = obj.className == 'btn_show'?'btn_hide':'btn_show';
				if (elementById('usr'+obj.getAttribute('id').substr(9))) {
					elementById('usr'+obj.getAttribute('id').substr(9)).className = obj.className == 'btn_show'?'hidden':'displayed';
				}
				check_all(obj.className);
				
		}
	}
	
	/* portal_new.js */
	function all_fields(action){
		var divs = document.getElementsByTagName('div');
		for(var i=0; i<divs.length; i++){
			if(divs[i].getAttribute('id') != null){
				if(divs[i].getAttribute('id').indexOf('disp_ctrl') != -1){
					elementById(divs[i].getAttribute('id')).className = action=='show'?'btn_hide':'btn_show';
				}
				if(divs[i].getAttribute('id').indexOf('usr_') != -1){
					elementById(divs[i].getAttribute('id')).className = action=='show'?'displayed':'hidden';
				}
			}
		}	
	}
	
	/* portal_new.js */
	function check_all(class_name){
		var divs = document.getElementsByTagName('div');
		var modify = true;
		for(var i=0; i<divs.length; i++){
			if(divs[i].getAttribute('id') != null){
				if(divs[i].getAttribute('id').indexOf('disp_ctrl') != -1){
					switch(class_name){
						case 'btn_show':
							if(elementById(divs[i].getAttribute('id')).className == 'btn_hide'){
								modify = false;
								break;
							}
							break;
						default:
							if(elementById(divs[i].getAttribute('id')).className == 'btn_show'){
								modify = false;
								break;
							}
					}
				}
			}
		}
		if(modify && elementById('main_display_ctrl')){
			elementById('main_display_ctrl').className = class_name=='btn_show'?'btn_show_all':'btn_hide_all';
		}	
	}
	
	function editAccount(type,id){
		var ajaxEditAccount = new aJaX(populateEditForm);
		var postContent = 'populate='+encodeURIComponent(populate)+'&type='+encodeURIComponent(type)+'&id='+encodeURIComponent(id);
		ajaxEditAccount.modePOST('/ajax/popup_edit.php', postContent);
		return false;
	}
	
	function populateEditForm(aJaX_obj, AJX_response){
		//alert(AJX_response);
		AJX_response = eval(AJX_response);
		switch(AJX_response[0]){
			case 'NA':
			case 'ERR':
				break;
			case 'OK':
				showEditPop(AJX_response[1],AJX_response[2]);
		}
	}
	
	function showEditPop(type,HTML){
		fade_bckg();
		switch(type){
			case 'bank':
				if (elementById('add_BankAcc') != null){
					document.body.removeChild(elementById('add_BankAcc'));
					showEditPop(type,HTML);
				} else {
					var pop_bankAcc = document.createElement('div');
					pop_bankAcc.setAttribute('id', 'add_BankAcc');
					document.body.appendChild(pop_bankAcc);
					pop_bankAcc.innerHTML =	unescape(HTML);
					init('edit_bankAcc');
					floatDiv("add_BankAcc",220).floatIt();
				}
				break;

			case 'card':
			if (elementById('add_Card') != null){
				document.body.removeChild(elementById('add_Card'));
				showEditPop(type,HTML);
			} else {
				var pop_card = document.createElement('div');
				pop_card.setAttribute('id', 'add_Card');
				document.body.appendChild(pop_card);
				pop_card.innerHTML =	unescape(HTML);
				/*attach('acc_num','checkNumerical');
				attach('re_acc_num','checkNumerical');
				attach('bank_phone_num1','checkNumerical');
				attach('bank_phone_num2','checkNumerical');
				attach('bank_phone_num3','checkNumerical');*/
				floatDiv("add_Card",220).floatIt();
			}
			break;

			case 'insurance':
			if (elementById('add_Insurance') != null){
				document.body.removeChild(elementById('add_Insurance'));
				showEditPop(type,HTML);
			} else {
				var pop_Insurance = document.createElement('div');
				pop_Insurance.setAttribute('id', 'add_Insurance');
				document.body.appendChild(pop_Insurance);
				pop_Insurance.innerHTML =	unescape(HTML);
				/*attach('city','checkLiteral');
				attach('zip','checkNumerical');
				attach('insur_phone_num1','checkNumerical');
				attach('insur_phone_num2','checkNumerical');
				attach('insur_phone_num3','checkNumerical');*/
				floatDiv("add_Insurance",150).floatIt();
			}
			break;
		
		}
	}
	
function saveStatus_email(aJaX_obj, AJX_response) {

	busy = false;
	elementById('saving_status').className = 'hidden';
	elementById('save_button').style.display = 'block';
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'OK':
			myInnerHTML('','new_email_address_err');
			clearFieldError('new_email_address');
			myInnerHTML('','current_password_err');
			clearFieldError('current_password');
			elementById('current_email_address').innerHTML = unescape(AJX_response[1]);
			elementById('new_email_address').value = '';
			elementById('current_password').value = '';
			elementById('status_display_js').style.display = 'block';
			elementById('status_display_js').innerHTML = 'Email Address has been updated.';
			elementById('status_display_js').className = 'bg_g';
			setTimeout(function() {Effect.Fade('status_display_js');},10000);
		break;
		case 'ERR':
			printErrors(AJX_response);
		break;
		case 'INVALID':
			window.location = '/'+AJX_response[1];
		break;

	}
}

function saveStatus_password(aJaX_obj, AJX_response) {
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'OK':
			myInnerHTML('','old_password_err');
			clearFieldError('old_password');
			myInnerHTML('','new_password_err');
			clearFieldError('new_password');
			myInnerHTML('','re_new_password_err');
			clearFieldError('re_new_password');
			elementById('old_password').value = '';
			elementById('new_password').value = '';
			elementById('re_new_password').value = '';
			elementById('status_display_js').style.display = 'block';
			elementById('status_display_js').innerHTML = 'Password has been updated.';
			elementById('status_display_js').className = 'bg_g';
			setTimeout(function() {Effect.Fade('status_display_js');},10000);
		break;		
		case 'ERR':
			printErrors(AJX_response);
			break;
	}
}

function save_email() {	
	if(busy == false){
		busy = true;
		elementById('saving_status').className = 'displayed';
		elementById('save_button').style.display = 'none';
		var ajaxSave_email = new aJaX(saveStatus_email);
		var postContent = encodeForm('saveEmail');
		ajaxSave_email.modePOST('/ajax/email_save.php', postContent);	
	}	
	return false;
}

function save_password() {
	var ajaxSave_password = new aJaX(saveStatus_password);
	var postContent = encodeForm('savePassword');
	ajaxSave_password.modePOST('/ajax/password_save.php', postContent);	
	return false;
}

function printErrors(errorArray) {
	var arrayLength = errorArray.length;
	for(i=1; i<arrayLength; i+=2){
		myInnerHTML(errorArray[i],errorArray[i+1]+'_err');
		if(errorArray[i] == ''){
			try{
				clearFieldError(errorArray[i+1]);
			} catch(e){}
		} else {
			try{
				displayFieldError(errorArray[i+1]);
			} catch(e){}
		}
	}
}

function toggle_contact(type, id){
	elementById( type +'_lw_input_' + id).className = 'displayed';
	elementById( type +'_lw_display_' + id).className = 'hidden';
}

function edit_contact(type, id){
	elementById(type + '_lw_display_' + id).className = 'hidden';
	elementById(type + '_lw_input_' + id).className = 'displayed';
}

function saveContactStatus(aJaX_obj, AJX_response){
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'ERR':	
			elementById(AJX_response[1] + '_lw_saving_status_' + AJX_response[2]).className = 'hidden';
			elementById(AJX_response[1] + '_lw_input_' + AJX_response[2]).className = 'displayed';
			var errorsArray = new Array('ERR');
			var arrayLength = AJX_response.length;
			for (i=3 ; i<arrayLength ; i++ ){
				errorsArray.push(AJX_response[i]); 
			}
			printErrors(errorsArray);
		break;
		
		case 'OK':
	
			elementById(AJX_response[3] + '_lw_saving_status_' + AJX_response[2]).className = 'hidden';
			elementById(AJX_response[3] + '_lw_input_' + AJX_response[2]).className = 'hidden';
			if (AJX_response[1] != '') {
				elementById(AJX_response[3] + '_lw_display_' + AJX_response[2]).innerHTML = AJX_response[1] + '<a onclick="edit_contact(\''+AJX_response[3]+'\','+AJX_response[2]+');" style="cursor:pointer;padding-left:69px;">Edit</a>';
			} else {
				elementById(AJX_response[3] + '_lw_display_' + AJX_response[2]).innerHTML = '<a onclick="toggle_contact(\''+AJX_response[3]+'\','+AJX_response[2]+');" style="cursor:pointer;">Add Phone Number</a>';
			}
			elementById(AJX_response[3] + '_lw_display_' + AJX_response[2]).className = 'displayed';
				
			if (AJX_response[1] != '') {
				var lw_phone = AJX_response[1].split('-');
				elementById(AJX_response[3] + '@phone_num1@' + AJX_response[2]).value = lw_phone[1];
				elementById(AJX_response[3] + '@phone_num2@' + AJX_response[2]).value = lw_phone[2];
				elementById(AJX_response[3] + '@phone_num3@' + AJX_response[2]).value = lw_phone[3];
			} else {
				elementById(AJX_response[3] + '@phone_num1@' + AJX_response[2]).value = '';
				elementById(AJX_response[3] + '@phone_num2@' + AJX_response[2]).value = '';
				elementById(AJX_response[3] + '@phone_num3@' + AJX_response[2]).value = '';
			}
			
			myInnerHTML('', AJX_response[3] + '@phone_num@' + AJX_response[2] + '_err');
			clearFieldError(AJX_response[3] + '@phone_num1@' + AJX_response[2]);
			clearFieldError(AJX_response[3] + '@phone_num2@' + AJX_response[2]);
			clearFieldError(AJX_response[3] + '@phone_num3@' + AJX_response[2]);
			clearFieldError(AJX_response[3] + '@phone_num@' + AJX_response[2]);
		break;
	}
}

function save_creditCard() {
	if(busy == false){
		busy = true;		
		elementById('saving_status').className = 'displayed';
		elementById('update_cc').style.display = 'none';
		
		var ajaxSave_cc = new aJaX(saveStatus_creditCard);
		var postContent = encodeForm('saveCreditCard');
		if(arguments[0]){
			postContent += '&check=true';	
		}
		ajaxSave_cc.modePOST('/ajax/billing_save.php', postContent);
	}
	return false;
}

function saveStatus_creditCard(aJaX_obj, AJX_response) {	
	busy = false;
	elementById('saving_status').className = 'hidden';
	elementById('update_cc').style.display = 'block';
	/* alert(AJX_response); */
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'P_OK': // processing OK
			elementById('status_display_js').style.display = 'block';
			elementById('status_display_js').innerHTML = 'Your billing info has been updated.';
			elementById('status_display_js').className = 'bg_g';
			setTimeout(function() {Effect.Fade('status_display_js');},10000);	
			break;		
		case 'P_ERR': // processing ERR
			elementById('status_display_js').style.display = 'block';
			elementById('status_display_js').innerHTML = AJX_response[1];
			elementById('status_display_js').className = 'bg_r';
			setTimeout(function() {Effect.Fade('status_display_js');},10000);
			printErrors(AJX_response);	
			break;
		case 'C_OK': // check OK
			printErrors(AJX_response);
			save_creditCard();
			break;
		case 'C_ERR': // check ERR
			printErrors(AJX_response);
			break;
		case 'NC': // check ERR
			elementById('status_display_js').style.display = 'block';
			elementById('status_display_js').innerHTML = 'You did not change any information.';
			elementById('status_display_js').className = 'bg_y';
			setTimeout(function() {Effect.Fade('status_display_js');},10000);	
			printErrors(AJX_response);
			break;	
	}
}

function billing_init() {
	attach('card_holder_name','checkLiteral');
	attach('zip','checkNumerical');
	attach('city','checkLiteral');	
	elementById('credit_card_num').onfocus = numberProcess;
}

function numberProcess(event) {
	if (elementById('credit_card_num').value.indexOf("*") != -1 || elementById('credit_card_num').value == ''){
		elementById('credit_card_num').value = '';
	}
	attach('credit_card_num','checkNumerical');		
	elementById('credit_card_num').onblur = numberProcessEnd;
}

function numberProcessEnd(event) {
	detach('credit_card_num');
	checkNumerical('credit_card_num');	
	if (elementById('credit_card_num').value == ''){
		elementById('credit_card_num').value = ccc;
	}
}

function showPop2(type){		
	fade_bckg();
	switch (type){
		case 'bankAcc':
			next = '/portal.php?show=bank#_bank';			
			if (elementById('add_BankAcc') != null)
			{
				document.body.removeChild(elementById('add_BankAcc'));
				showPop(type);
			} else {
				var pop_bankAcc = document.createElement('div');
				pop_bankAcc.setAttribute('id', 'add_BankAcc');
				document.body.appendChild(pop_bankAcc);
				pop_bankAcc.innerHTML =	'<form id="add_bankAccc" name="add_bankAccc" onsubmit="return false;">'
					+ '<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Add Bank Account</div>'
					+		'<div class="close" onclick="return close_box(\'add_BankAcc\')"></div>'
					+ '</div>'
					+ '<div class="pad_5">We monitor your bank accounts and notify you if we ever find the information being bought, traded, or sold on the Internet. Add a new account by completing the form below and be sure to click &ldquo;Save&rdquo; when you are done.</div>'
					+ '<table border="0" cellspacing="0" cellpadding="5">'
						
						+ '<tr>'
						+ 	'<td class="w_150">Account Holder: *</td>'
						+ 	'<td><select class="field" name="acc_holder_name" id="acc_holder_name" style="width:136px;">'
						+	'<option value="">--</option>'
						+	accHolderList_html
						+	'</select><div class="input_err" id="acc_holder_name_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Bank Name:&nbsp;*</td>'
						+ 	'<td><input class="field" name="acc_name" id="acc_name" type="text" maxlength="50"><div class="input_err" id="acc_name_err"></div></td>'
						+ 	'<td>(e.g. Chase, Citibank)</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Account Nickname:</td>'
						+ 	'<td><input class="field" name="acc_nick_name" id="acc_nick_name" type="text" maxlength="50"></td>'
						+ 	'<td>(e.g. My Savings Account)</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Routing Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="route_num" id="route_num" type="text" maxlength="9" validate="numerical"><div class="input_err" id="route_num_err"></div></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'
				 
						+ '<tr>'
						+ 	'<td class="w_150">Account Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="bank_acc_num" id="bank_acc_num" type="text" maxlength="30" validate="numerical"><div class="input_err" id="bank_acc_num_err"></div><input type="hidden" name="type" value="bankAcc"></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150" style="vertical-align:top;">Bank Phone Number:&nbsp;</td>'
						+ 	'<td>1&nbsp;-&nbsp;<input class="field" style="width:20px;" name="bank_phone_num1" id="bank_phone_num1" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:20px;" style="width:10px;" name="bank_phone_num2" id="bank_phone_num2" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:26px;" name="bank_phone_num3" id="bank_phone_num3" type="text" maxlength=4 validate="numerical"><div>Toll-Free Customer Service number</div><div class="input_err" id="bank_phone_err"></div></td>'
						+ '</tr>'

					+ '</table>'
					
					+	'<table border="0" cellspacing="0" cellpadding="5">'+
							'<tr>'+
								'<td class="w_150">&nbsp;</td>'+
								'<td>'+
									'<div id="save_button" class="btn_med_silver w_75" onclick="save2(\'bankAccc\')"><div class="bl"><div class="br">SAVE</div></div></div>'+
									'<div id="saving_status" class="hidden" style="text-align:center;width:75px"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'+
								'</td>'+
								'<td style="padding-left:10px"><a href="#" onclick="return close_box(\'add_BankAcc\')">Cancel</a></td>'+
							'</tr>'+
						'</table>'
					+'</div></form>';
					init('add_bankAccc');
					floatDiv("add_BankAcc",220).floatIt();
			}
		break;

		case 'addCard':			
			next = '/portal.php?show=cc#_card';
			if (elementById('add_Card') != null)
			{
				document.body.removeChild(elementById('add_Card'));
				showPop(type);
			} else {
				var pop_card = document.createElement('div');
				pop_card.setAttribute('id', 'add_Card');
				document.body.appendChild(pop_card);
				pop_card.innerHTML = '<form id="add_addCard" name="add_addCard" onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Add Credit/Debit Card</div>'
					+		'<div class="close" onclick="return close_box(\'add_Card\')"></div>'
					+ '</div>'
					+ '<div class="pad_5">We monitor your credit and debit accounts and notify you if we ever find the information being bought, traded, or sold on the Internet. Add a new account by completing the form below and be sure to click &ldquo;Save&rdquo; when you are done.</div>'
					+ '<table border="0" cellspacing="0" cellpadding="5">'

						+ '<tr>'
						+ 	'<td class="w_150">Account Holder: *</td>'
						+ 	'<td><select class="field" name="acc_holder_name" id="acc_holder_name" style="width:136px;">'
						+	'<option value="">--</option>'
						+	accHolderList_html
						+	'</select><div class="input_err" id="acc_holder_name_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Bank Name:&nbsp;*</td>'
						+ 	'<td><input class="field" name="cd_acc_name" id="cd_acc_name" type="text" maxlength="50"><div class="input_err" id="cd_acc_name_err"></div></td>'
						+ 	'<td>(e.g. Chase, Citibank)</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">Account Nickname:</td>'
						+ 	'<td><input class="field" name="acc_nick_name" id="acc_nick_name" type="text" maxlength="50"></td>'
						+ 	'<td>(e.g. My Checking)</td>'
						+ '</tr>'
					
						+ '<tr>'
						+ 	'<td class="w_150">Account Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="acc_num" id="acc_num" type="text" maxlength="16" validate="numerical"><div class="input_err" id="acc_num_err"></div></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'
				 
						+ '<tr>'
						+ 	'<td class="w_150">Re-Enter Account Number:&nbsp;*</td>'
						+ 	'<td><input class="field" name="re_acc_num" id="re_acc_num" type="text" maxlength="16" validate="numerical"><input type="hidden" name="type" value="addCard">'
						+		'<div class="input_err" id="re_acc_num_err"></div></td>'
						+ 	'<td>&nbsp;</td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150" style="vertical-align:top;">Bank Phone Number:&nbsp;</td>'
						+ 	'<td>1&nbsp;-&nbsp;<input class="field" style="width:20px;" name="bank_phone_num1" id="bank_phone_num1" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:20px;" style="width:10px;" name="bank_phone_num2" id="bank_phone_num2" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:26px;" name="bank_phone_num3" id="bank_phone_num3" type="text" maxlength=4 validate="numerical"><div style="width:200px;">Toll-Free Customer Service number located on back of credit/debit card</div><div class="input_err" id="bank_phone_err"></div></td>'
						+ '</tr>'

					+ '</table>'

					+	'<table border="0" cellspacing="0" cellpadding="5">'+
							'<tr>'+
								'<td class="w_150">&nbsp;</td>'+
								'<td>'+
									'<div id="save_button" class="btn_med_silver w_75" onclick="save2(\'addCard\')"><div class="bl"><div class="br">SAVE</div></div></div>'+
									'<div id="saving_status" class="hidden" style="text-align:center;width:75px"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'+
								'</td>'+
								'<td style="padding-left:10px"><a href="#" onclick="return close_box(\'add_Card\')">Cancel</a></td>'+
							'</tr>'+
						'</table>'
					+'</div></form>';
					init('add_addCard');
					floatDiv("add_Card",220).floatIt();
			}
		break;

		case 'addInsurance':			
			next = '/portal.php?show=ins#_insur';
			if (elementById('add_Insurance') != null)
			{
				document.body.removeChild(elementById('add_Insurance'));
				showPop(type);
			} else {
				var pop_Insurance = document.createElement('div');
				pop_Insurance.setAttribute('id', 'add_Insurance');
				document.body.appendChild(pop_Insurance);
				pop_Insurance.innerHTML = '<form id="add_addInsurance" name="add_addInsurance" onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Add Health Insurance</div>'
					+		'<div class="close" onclick="return close_box(\'add_Insurance\')"></div>'
					+ '</div>'
					
					+ '<div class="pad_5">To add a new insurance company, please complete the form below and click &ldquo;Save&rdquo; when you are done.</div>'
					
					+ '<table border="0" cellspacing="0" cellpadding="5">'

						+ '<tr>'
						+ 	'<td class="w_150">Account Holder: *</td>'
						+ 	'<td><select class="field" name="acc_holder_name" id="acc_holder_name" style="width:210px;">'
						+	'<option value="">--</option>'
						+	accHolderList_html
						+	'</select><div class="input_err" id="acc_holder_name_err"></div></td>'
						+ '</tr>'


						+ '<tr>'
						+ 	'<td class="w_150">Health Insurance Provider: *</td>'
						+ 	'<td><input class="field w_200" name="com_name" id="com_name" type="text" maxlength="50"><div class="input_err" id="com_name_err"></div></td>'
						+ '</tr>'
					
						+ '<tr>'
						+ 	'<td class="w_150">Address: *</td>'
						+ 	'<td><input class="field w_200" name="address1" id="address1" type="text" maxlength="200"><div class="input_err" id="address1_err"></div></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150">&nbsp;</td>'
						+ 	'<td><input class="field w_200" name="address2" id="address2" type="text" maxlength="200"></td>'
						+ '</tr>'
						+ '<tr>'	
						+ 	'<td class="w_150">City, State & Zip: *</td>'
								+ '<td>'
								+ '<input class="field w_75" name="city" id="city" type="text" maxlength="50" validate="literal">&nbsp&nbsp'
									+ '<select class="field w_45" name="state" id="state" style="width:56px;">'
									+ statesList_html
									+ '</select>&nbsp&nbsp'
								+ '<input class="field w_55" name="zip" id="zip" maxlength="5" type="text" validate="numerical"><div class="input_err" id="ins_address_err"></div></td>'
							+ '</tr>'
						+ '<tr>'
						+ 	'<td class="w_150">Account/ID Number: *</td>'
						+ 	'<td><input class="field w_200" name="accID_num" id="accID_num" type="text" maxlength="50"><div class="input_err" id="accID_num_err"></div></td>'
						+ '</tr>'
				 
						+ '<tr>'
						+ 	'<td class="w_150">Group Number: *</td>'
						+ 	'<td><input class="field w_200" name="group_num" id="group_num" type="text" maxlength="50"><div class="input_err" id="group_num_err"></div><input type="hidden" name="type" value="addInsurance"></td>'
						+ '</tr>'

						+ '<tr>'
						+ 	'<td class="w_150" style="vertical-align:top;">Member Services Phone Number:&nbsp;</td>'
						+ 	'<td>1&nbsp;-&nbsp;<input class="field" style="width:20px;" name="insur_phone_num1" id="insur_phone_num1" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:20px;" style="width:10px;" name="insur_phone_num2" id="insur_phone_num2" type="text" maxlength=3 validate="numerical">'
						+	'&nbsp;-&nbsp;<input class="field" style="width:26px;" name="insur_phone_num3" id="insur_phone_num3" type="text" maxlength=4 validate="numerical"><br><div style="width:300px;">Health Insurance Provider Toll-Free Customer Service number located on Health Insurance card</div><div class="input_err" id="insur_phone_err"></div>'
						+ '</td></tr>'
					+ '</table>'

					+	'<table border="0" cellspacing="0" cellpadding="5">'+
							'<tr>'+
								'<td class="w_150">&nbsp;</td>'+
								'<td>'+
									'<div id="save_button" class="btn_med_silver w_75" onclick="save2(\'addInsurance\')"><div class="bl"><div class="br">SAVE</div></div></div>'+									
									'<div id="saving_status" class="hidden" style="text-align:center;width:75px"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'+
								'</td>'+
								'<td style="padding-left:10px"><a href="#" onclick="return close_box(\'add_Insurance\')">Cancel</a></td>'+
							'</tr>'+
						'</table>'
					+'</div></form>';
					init('add_addInsurance');
					floatDiv("add_Insurance",150).floatIt();
			}
		break;
	}
	return false;
}

function save2(s_type) {
	if(busy == false){
		busy = true;
		elementById('saving_status').className = 'displayed';
		elementById('save_button').style.display = 'none';
		var ajaxSave = new aJaX(saveStatus);
		var postContent = encodeForm('add_'+s_type);
		ajaxSave.modePOST('/ajax/popup_save2.php', postContent);
	}
	return false;
}

function save_contact(type, id, form){
	elementById(type + '_lw_saving_status_' + id).className = 'displayed';
	elementById(type + '_lw_input_' + id).className = 'hidden';
	var ajaxSave = new aJaX(saveContactStatus);
	var postContent = encodeForm(form);
	ajaxSave.modePOST('/ajax/lw_contact_save.php?id='+id+'&type='+type, postContent);		
	return false;
}

function savePinStatus(aJaX_obj, AJX_response){
	AJX_response = eval(AJX_response);
	switch (AJX_response[0]){
		case 'OK':
			elementById('lw_saving_status_' + AJX_response[1]).className = 'hidden';
			elementById('pin_edit_' + AJX_response[1]).className = 'displayed';
			
			if (AJX_response[3] != ''){
				elementById(AJX_response[2]).className = 'hidden';
				elementById('dis_pin_' + AJX_response[1]).innerHTML = AJX_response[3];
				elementById('dis_pin_' + AJX_response[1]).className = 'displayed';
			} else {
				elementById('pin_edit_' + AJX_response[1]).className = 'hidden';
				elementById('save_button_' + AJX_response[1]).className = 'displayed';
				elementById(AJX_response[2]).className = 'displayed';
			}
		break;
	}
}

function savePin(id, form, type, mode){
	elementById('lw_saving_status_' + id).className = 'displayed';
	
	switch (mode){
		case 'new':
			elementById('save_button_' + id).className = 'hidden';
		break;

		case 'edit':
			elementById('btn_save_' + id).className = 'btn_sml_silver w_55 hidden';
		break;
	}

	var ajaxSave = new aJaX(savePinStatus);
	var postContent = encodeForm(form);
	ajaxSave.modePOST('/ajax/pin_save.php?type='+type+'&id='+id, postContent);		
	return false;
}

function edit_pin(id, row){
	elementById(id).className = 'displayed';
	elementById('dis_pin_' + row).className = 'hidden';
	elementById('pin_edit_' + row).className = 'hidden';
	elementById('btn_save_' + row).className = 'btn_sml_silver w_55 displayed';
}

function label_verify_info(id){
	var appear_div = (id=='label_alertbox')? 'pp_validate_info' : 'div_scan_result';
	close_box(id);
	close_box('portal_user_info');
	setTimeout(function(){Effect.Appear(appear_div)},1200);
}

function scan_status(aJaX_obj, AJX_response){
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	switch (AJX_response[0]){
		case 'OK':
			fade_bckg();
			
			if (elementById('scan_info') != null){
				document.body.removeChild(elementById('scan_info'));
			}
			var pop_scan = document.createElement('div');
			pop_scan.setAttribute('id', 'scan_info');
			document.body.appendChild(pop_scan);
			var html_string  = '<div style="border: 3px solid #269B25;width:480px;height:100px;padding: 40px 12px 0 12px;font-size:18px;font-weight:bold;">';
				html_string += '<div>Please wait while we scan your personal information...</div>';
				html_string += '<div class="pp_loader" style="margin:30px 0 0 166px;"></div>';
				html_string += '</div>';
			pop_scan.innerHTML = html_string;
			floatDiv('scan_info',150, 1).floatIt();

			myInnerHTML('','ssn_err');
			clearFieldError('ssn_1');
			clearFieldError('ssn_2');
			clearFieldError('ssn_3');

			myInnerHTML('','conf_ssn_err');
			clearFieldError('conf_ssn_1');
			clearFieldError('conf_ssn_2');
			clearFieldError('conf_ssn_3');

			myInnerHTML('','birth_err');
			clearFieldError('birth_month');
			clearFieldError('birth_day');
			clearFieldError('birth_year');	
		
			setTimeout(function(){close_box('scan_info');},2000);
			
			var name_list = AJX_response;
			name_list.splice(0, 1);
			//alert(name_list);
			
			close_box('pp_validate_info');
				
			var html_str = '';
			var text = '';
			if (name_list.length == 1){
				text = 'We have found 1 name that may be associated with your identity, however this does not mean that your identity is at risk.</span> Unfortunately, public databases have many pieces of disjointed information. If we find any information that may indicate you are at an increased risk of identity theft, we will notify you immediately. In the meantime, <span style="font-weight:bold;">please let us know if name listed below is familiar to you.';
			} else {
				text = 'We have found '+name_list.length+' names that may be associated with your identity, however this does not mean that your identity is at risk. Please review the names listed below and let us know if they are familiar to you.';
			}
			
			html_str += '<div id="label_scan_result" style="border-left:2px;border-right:2px;border-bottom:2px;border-style:solid;border-color:#fdd26a;width:800px;margin-bottom:6px;">'+
							'<div style="background-color: #fdd26a;font-size:14px;font-weight:bold;padding:2px 0 6px 0;color:#9d080e;padding-left:8px;">Scan Results</div>'+

							'<div class="portal_icon_alert" style="padding-left:30px;padding-top:4px;margin:8px 0 0 8px;font-weight:bold;width:250px;height:24px;font-size:14px;">New Information Requested</div>'+
							'<div style="padding-bottom:8px;margin-left:38px;">'+
								'<span style="font-weight:bold;">'+text+'</span>'+
							'</div>'+
						'</div>';

			html_str += '<form id="pp_verify_form" name="pp_verify_form">';

			html_str += '<div style="border:1px solid #CCCCCC;width:800px"><div style="background:#568bad;margin:3px"><table cellspacing="0" style="width:100%"><tr>'+
											'<td style="color:#ffffff;font-size:12px;font-weight:bold;width:26px;padding-left:4px;height:30px">No.</td>'+
											'<td style="border-left:1px solid #FFFFFF;color:#ffffff;font-size:12px;font-weight:bold;width:186px;padding-left:4px">Name</td>'+
											'<td style="border-left:1px solid #FFFFFF;color:#ffffff;font-size:12px;font-weight:bold;padding-left:4px">Relationship</td>'+
										'</tr></table></div><table cellspacing="3" style="width:100%">';
			
			createDropDown();

			var name_count = name_list.length;
			for (i=0;i<name_count;i++){
				//var tmp = name_list[i].split("=>");
				//var id = tmp[0];
				var name = name_list[i];
				var color = (i % 2)? '#edf2f8' : '#dbe5f1';
				var no = i;
				
				html_str += '<tr style="background-color:'+color+'">'+
											'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:22px;height:70px;">'+ (++no) +'</td>'+
											'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px">'+name+'</td>'+
											'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px"><input type="radio" id="name_row_'+i+'_1" name="name_row_'+i+'" value="verified" onclick="hideRelation(\'name_row_'+i+'_2_select\');" checked />This is my name</td>'+
											'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px">'+
												'<div><input type="radio" id="name_row_'+i+'_2" name="name_row_'+i+'" value="[empty]" onclick="showRelation(\'name_row_'+i+'_2_select_div\');" />This name belongs to</div>'+
				 
												 '<div style="padding:10px 0 0 20px;display:none;" id="name_row_'+i+'_2_select_div">'+
													 '<select class="field" style="font-size:11px;padding:2px 2px;" id="name_row_'+i+'_2_select" onchange="checkRelation(\'name_row_'+i+'_2_select\',1);setRelationValue(\'name_row_'+i+'_2_select\');">'+
														 '<option value="">- Select -</option>'+
														 relation_html+
													 '</select>'+
												 '</div>'+

												 '<div id="name_row_'+i+'_2_select_err" class="input_err" style="padding: 4px 0 0 4px;"></div>'+

											'</td>'+
											'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px"><input type="radio" id="name_row_'+i+'_3" name="name_row_'+i+'" value="unknown" onclick="hideRelation(\'name_row_'+i+'_2_select\');" />I don\'t know this name<input type="hidden" name="name_row_'+i+'_value" value="'+name+'"></td>'+
										'</tr>';
			}
			
			html_str += '</table></div>';
			
			html_str += '</form>';

			html_str += '<div style="padding: 10px 0 0 288px;">'+
							'<div class="pp_btn_save" style="float:left" onclick="pp_action(\'save_scan\');"></div>'+
							'<div class="pp_btn_cancel" style="float:left" onclick="pp_action(\'cancel_scan\');"></div>'+
							'<div class="reset"></div>'+
						'</div>';
			
			elementById('div_scan_result').innerHTML = html_str;


			var alert_text = '';
			if (name_count==1){
				alert_text = 'We have found 1 name that may be associated with your identity, however this does not mean that your identity is at risk. Please review the name listed below and let us know if it is familiar to you.';
			} else {
				alert_text = 'We have found '+name_count+' names that may be associated with your identity, however this does not mean that your identity is at risk. Please review the names listed below and let us know if they are familiar to you.';
			}
			
			var alert_html = '';
			alert_html += '<div id="label_alertbox_scanned" style="border-left:8px;border-right:8px;border-bottom:8px;border-style:solid;border-color:#f4e396;">'+
								'<div style="background-color: #f4e396;font-size:14px;font-weight:bold;padding:2px 0 6px 0;">New Information Requested:</div>'+
								'<div class="portal_icon_alert" style="padding-left:30px;padding-top:2px;margin: 8px 0 0 10px;">'+
								'<span style="font-weight:bold;">'+alert_text+'</span>'+
								'</div>'+
								'<div style="margin-top:8px;margin-bottom:8px;">';				
			
			for (i=0;i<name_count;i++){
				var ccount = i;
				ccount++;
				alert_html += '<div style="color:#0f5688;font-weight:bold;padding-left:40px;">'+ccount+'. '+name_list[i]+'</div>';	
				
				if (ccount == 3){
				  alert_html += '<div style="color:#0f5688;font-weight:bold;padding-left:40px;">4. ... to view all names, click "Verify" button below.</div>';	
				  break;
				}
			}
			alert_html += '</div>'+
							'<div class="portal_button_verify" style="padding-bottom:10px;margin-left:34px;" onclick="label_verify_info(\'label_alertbox_scanned\');"></div>'+
							'</div>';
			elementById('div_temp_alert').innerHTML = alert_html;
			setTimeout(function(){Effect.Appear('div_scan_result')},1500);
		break;
		
		case 'NM':
			fade_bckg();
			
			if (elementById('scan_info') != null){
				document.body.removeChild(elementById('scan_info'));
			}
			var pop_scan = document.createElement('div');
			pop_scan.setAttribute('id', 'scan_info');
			document.body.appendChild(pop_scan);
			var html_string  = '<div style="border: 3px solid #269B25;width:480px;height:100px;padding: 40px 12px 0 12px;font-size:18px;font-weight:bold;">';
				html_string += '<div>Please wait while we scan your personal information...</div>';
				html_string += '<div class="pp_loader" style="margin:30px 0 0 166px;"></div>';
				html_string += '</div>';
			pop_scan.innerHTML = html_string;
			floatDiv('scan_info',150, 1).floatIt();

			myInnerHTML('','ssn_err');
			clearFieldError('ssn_1');
			clearFieldError('ssn_2');
			clearFieldError('ssn_3');

			myInnerHTML('','conf_ssn_err');
			clearFieldError('conf_ssn_1');
			clearFieldError('conf_ssn_2');
			clearFieldError('conf_ssn_3');

			myInnerHTML('','birth_err');
			clearFieldError('birth_month');
			clearFieldError('birth_day');
			clearFieldError('birth_year');	
		
			setTimeout(function(){close_box('scan_info');},2000);

			close_box('pp_validate_info');
			
			var html_str = '';
				
			html_str += '<div style="padding-top:20px;padding-right:20px;">'+
							'<div class="portal_icon_check" style="font-weight:bold;font-size:14px;padding: 2px 0 0 28px;">'+
								'Thank you for verifying and providing us with additional information to help us expand your protections.'+
							'</div>'+
							'<div style="padding: 16px 0 0 28px;font-size:12px;">'+
								'If we determine through our scanning of these new databases that any information that may indicate you are at an increased risk of identity theft, we\'ll send an instant e-mail alert.'+
							'</div>'+
							'<div class="portal_right_arrow" style="margin-left:25px;margin-top:16px;padding-left:16px;">'+
								'<a href="portal.php">Back to Main User Information</a>'+
							'</div>'
						'</div>';

			elementById('div_scan_result').innerHTML = html_str;
			setTimeout(function(){Effect.Appear('div_scan_result')},1500);
		break;

		case 'ERR':
			printErrors(AJX_response);
		break;
	}
}

function verify_status(aJaX_obj, AJX_response){
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	switch (AJX_response[0]){
		case 'OK':
			/*close_box('pp_validate_info');
			
			var html_str = '';
				
			html_str += '<div style="padding-top:20px;padding-right:20px;">'+
							'<div class="portal_icon_check" style="font-weight:bold;font-size:14px;padding: 2px 0 0 28px;">'+
								'Thank you for verifying and providing us with additional information to help us expand your protections.'+
							'</div>'+
							'<div style="padding: 16px 0 0 28px;font-size:12px;">'+
								'If we determine through our scanning of these new databases that any information that may indicate you are at an increased risk of identity theft, we\'ll send an instant e-mail alert.'+
							'</div>'+
							'<div class="portal_right_arrow" style="margin-left:25px;margin-top:16px;padding-left:16px;">'+
								'<a href="portal.php">Back to Main User Information</a>'+
							'</div>'
						'</div>';

			elementById('div_scan_result').innerHTML = html_str;
			setTimeout(function(){Effect.Appear('div_scan_result')},1500);*/
			
			window.location='portal.php?type=ids_thank_you';
		break;
	
		case 'ERR':
			printErrors(AJX_response);
		break;
	}
}

function pp_action(type){
	switch (type){
		case 'cancel':
			close_box('pp_validate_info');
			setTimeout(function(){Effect.Appear('portal_user_info');Effect.Appear('label_alertbox');},1200);
		break;

		case 'save':
				var ajaxSave = new aJaX(scan_status);
				var postContent  = '';
				var pc_ssn = encodeForm('ssn_form');
				var pc_dob = encodeForm('dob_form');
				var pc_vn  = encodeForm('vn_form');
				var pc_vr  = encodeForm('vr_form');
				
				if (pc_ssn && postContent != ''){ postContent += '&' + pc_ssn; }
					else { postContent += pc_ssn; }
				if (pc_dob && postContent != ''){ postContent += '&' + pc_dob; }
					else { postContent += pc_dob; }
				if (pc_vn && postContent != ''){ postContent += '&' + pc_vn; }
					else { postContent += pc_vn; }
				if (pc_vr && postContent != ''){ postContent += '&' + pc_vr; }
					else { postContent += pc_vr; }
				
				ajaxSave.modePOST('/ajax/ppScan.php', postContent);
				return false;
		break;
		
		case 'cancel_scan':
			Effect.Fade('div_scan_result');
			setTimeout(function(){Effect.Appear('portal_user_info');Effect.Appear('label_alertbox_scanned');},1200);
		break;

		case 'save_scan':
			var ajaxSave = new aJaX(verify_status);
			var postContent = encodeForm('pp_verify_form');
			ajaxSave.modePOST('/ajax/ppVerify.php', postContent);
			return false;
		break;
	}
}

function pp_action_ts_status(aJaX_obj, AJX_response){
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	switch (AJX_response[0]){
		case 'OK':
			switch (AJX_response[1]){
			case 'save_name':
				for (i=0; i<document.vn_form.elements.length; i++){
					if (document.vn_form.elements[i].className != ''){
						if (document.vn_form.elements[i].className == 'fld_err'){
							document.vn_form.elements[i].className = 'field';
						}
					}
				}
				myInnerHTML('','vn_err');
			break;
			
			case 'save_relation':
				for (i=0; i<document.vr_form.elements.length; i++){
				if (document.vr_form.elements[i].className != ''){
						if (document.vr_form.elements[i].className == 'fld_err'){
							document.vr_form.elements[i].className = 'field';
						}
					}
				}
				myInnerHTML('','vr_err');
			break;
			}
			window.location.reload();
		break;

		case 'VALIDATE':
			document.getElementById(AJX_response[1] + '@@ui_container_row_' + AJX_response[2]).style.display = 'none';
			document.getElementById(AJX_response[1] + '@@uido_container_row_' + AJX_response[2]).style.display = '';
			
			for (i=0; i<document.vr_form.elements.length; i++){
				if (document.vr_form.elements[i].className != ''){
					if (document.vr_form.elements[i].className == 'fld_err'){
							document.vr_form.elements[i].className = 'field';
					}
				}
			}
			myInnerHTML('','vr_err');
		break;

		case 'ERR':
			printErrors(AJX_response);
		break;
	}
}

function pp_action_ts(type){
	var ajaxSave = new aJaX(pp_action_ts_status);

	switch (type){
		case 'save_name':
		case 'save_name_validate':
			var postContent = encodeForm('vn_form');
		break;
	
		case 'save_relation':
		case 'save_relation_validate':
			var postContent = encodeForm('vr_form');
		break;
	}

	var url = '/ajax/ppScan_ts.php?type='+type;
	
	if (arguments[1]){
		url += '&row=' + arguments[1]; 
	}

	ajaxSave.modePOST(url, postContent);
	return false;
}

function scan_status_relogin(aJaX_obj, AJX_response){
	AJX_response = eval(AJX_response);
	
	var name_list = AJX_response;
		name_list.splice(0, 1);
	
	var name_count = name_list.length;

	var html_str = '';
	var text = '';
	if (name_list.length == 1){
		text = 'We have found 1 name that may be associated with your identity, however this does not mean that your identity is at risk.</span> Unfortunately, public databases have many pieces of disjointed information. If we find any information that may indicate you are at an increased risk of identity theft, we will notify you immediately. In the meantime, <span style="font-weight:bold;">please let us know if name listed below is familiar to you.';
	} else {
		text = 'We have found '+name_list.length+' names that may be associated with your identity, however this does not mean that your identity is at risk. Please review the names listed below and let us know if they are familiar to you.';
	}
	
	html_str += '<div id="label_scan_result" style="border-left:2px;border-right:2px;border-bottom:2px;border-style:solid;border-color:#fdd26a;width:800px;margin-bottom:6px;">'+
					'<div style="background-color: #fdd26a;font-size:14px;font-weight:bold;padding:2px 0 6px 0;color:#9d080e;padding-left:8px;">Scan Results</div>'+

					'<div class="portal_icon_alert" style="padding-left:30px;padding-top:4px;margin:8px 0 0 8px;font-weight:bold;width:250px;height:24px;font-size:14px;">New Information Requested</div>'+
					'<div style="padding-bottom:8px;margin-left:38px;">'+
						'<span style="font-weight:bold;">'+text+'</span>'+
					'</div>'+
				'</div>';

	html_str += '<form id="pp_verify_form" name="pp_verify_form">';

	html_str += '<div style="border:1px solid #CCCCCC;width:800px"><div style="background:#568bad;margin:3px"><table cellspacing="0" style="width:100%"><tr>'+
									'<td style="color:#ffffff;font-size:12px;font-weight:bold;width:26px;padding-left:4px;height:30px">No.</td>'+
									'<td style="border-left:1px solid #FFFFFF;color:#ffffff;font-size:12px;font-weight:bold;width:186px;padding-left:4px">Name</td>'+
									'<td style="border-left:1px solid #FFFFFF;color:#ffffff;font-size:12px;font-weight:bold;padding-left:4px">Relationship</td>'+
								'</tr></table></div><table cellspacing="3" style="width:100%">';
	
	createDropDown();

	var name_count = name_list.length;
	for (i=0;i<name_count;i++){
		//var tmp = name_list[i].split("=>");
		//var id = tmp[0];
		var name = name_list[i];
		var color = (i % 2)? '#edf2f8' : '#dbe5f1';
		var no = i;
		
		html_str += '<tr style="background-color:'+color+'">'+
									'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:22px;height:70px;">'+ (++no) +'</td>'+
									'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px">'+name+'</td>'+
									'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px"><input type="radio" id="name_row_'+i+'_1" name="name_row_'+i+'" value="verified" onclick="hideRelation(\'name_row_'+i+'_2_select\');" checked />This is my name</td>'+
									'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px">'+
										'<div><input type="radio" id="name_row_'+i+'_2" name="name_row_'+i+'" value="[empty]" onclick="showRelation(\'name_row_'+i+'_2_select_div\');" />This name belongs to</div>'+
		 
										 '<div style="padding:10px 0 0 20px;display:none;" id="name_row_'+i+'_2_select_div">'+
											 '<select class="field" style="font-size:11px;padding:2px 2px;" id="name_row_'+i+'_2_select" onchange="checkRelation(\'name_row_'+i+'_2_select\',1);setRelationValue(\'name_row_'+i+'_2_select\');">'+
												 '<option value="">- Select -</option>'+
												 relation_html+
											 '</select>'+
										 '</div>'+

										 '<div id="name_row_'+i+'_2_select_err" class="input_err" style="padding: 4px 0 0 4px;"></div>'+

									'</td>'+
									'<td style="vertical-align:top;padding: 4px 0 0 4px;font-size:12px;font-weight:bold;width:150px"><input type="radio" id="name_row_'+i+'_3" name="name_row_'+i+'" value="unknown" onclick="hideRelation(\'name_row_'+i+'_2_select\');" />I don\'t know this name<input type="hidden" name="name_row_'+i+'_value" value="'+name+'"></td>'+
								'</tr>';
	}
	
	html_str += '</table></div>';
	
	html_str += '</form>';

	html_str += '<div style="padding: 10px 0 0 288px;">'+
					'<div class="pp_btn_save" style="float:left" onclick="pp_action(\'save_scan\');"></div>'+
					'<div class="pp_btn_cancel" style="float:left" onclick="pp_action(\'cancel_scan\');"></div>'+
					'<div class="reset"></div>'+
				'</div>';
	
	elementById('div_scan_result').innerHTML = html_str;

	var alert_text = '';
	if (name_count==1){
		alert_text = 'We have found 1 name that may be associated with your identity, however this does not mean that your identity is at risk. Please review the name listed below and let us know if it is familiar to you.';
	} else {
		alert_text = 'We have found '+name_count+' names that may be associated with your identity, however this does not mean that your identity is at risk. Please review the names listed below and let us know if they are familiar to you.';
	}

	var alert_html = '';
	alert_html += '<div id="label_alertbox_scanned" style="border-left:8px;border-right:8px;border-bottom:8px;border-style:solid;border-color:#f4e396;">'+
						'<div style="background-color: #f4e396;font-size:14px;font-weight:bold;padding:2px 0 6px 0;">New Information Requested:</div>'+
						'<div class="portal_icon_alert" style="padding-left:30px;padding-top:2px;margin: 8px 0 0 10px;">'+
						'<span style="font-weight:bold;">'+alert_text+'</span>'+
						'</div>'+
						'<div style="margin-top:8px;margin-bottom:8px;">';				

	for (i=0;i<name_count;i++){
		var ccount = i;
		ccount++;
		alert_html += '<div style="color:#0f5688;font-weight:bold;padding-left:40px;">'+ccount+'. '+name_list[i]+'</div>';	
		
		if (ccount == 3){
		  alert_html += '<div style="color:#0f5688;font-weight:bold;padding-left:40px;">4. ... to view all names, click "Verify" button below.</div>';	
		  break;
		}
	}
	alert_html += '</div>'+
					'<div class="portal_button_verify" style="padding-bottom:10px;margin-left:34px;" onclick="label_verify_info(\'label_alertbox_scanned\');"></div>'+
					'</div>';
	elementById('div_temp_alert').innerHTML = alert_html;
}

function pp_action_relogin(value){
	var ajaxSave = new aJaX(scan_status_relogin);
	
	ajaxSave.modePOST('/ajax/ppScan.php', value);
	return false;
}

function validate_add_row(type){
	createDropDown();
	
	if(type=='name'){
		vn_row_counter++;
		var rcounter = vn_row_counter;
	} else if (type=='relation'){
		vr_row_counter++
		var rcounter = vr_row_counter;
	}
	
	var prefix = '';
	if (type == 'name'){
		prefix = 'vn';
	} else if (type == 'relation'){
		prefix = 'vr';
		var fld5 = prefix + '_relation_row_'+rcounter;
	}
	
	var obj = elementById(prefix + '_container');
	var newDiv = document.createElement('div');
	newDiv.setAttribute('id', prefix + '_div_'+rcounter);
	
	var rid	   = prefix + '_container_row_'+rcounter;
	var fld1   = prefix + '_first_name_row_'+rcounter;
	var fld2   = prefix + '_middle_name_row_'+rcounter;
	var fld3   = prefix + '_last_name_row_'+rcounter;
	var fld4   = prefix + '_suffix_row_'+rcounter;
	
	switch (type){
		case 'name':
			html_string = '\n\n\n'+
						 '<div id="'+rid+'" style="display:none">'+
						 '<div style="padding-top:4px;">'+
						 '<div style="float:left;width:216px;"><input class="field" style="width:192px;" type="text" id="'+fld1+'" name="'+fld1+'" validate="name"/></div>'+
						 '<div style="float:left;width:132px;"><input class="field" style="width:108px;" type="text" id="'+fld2+'" name="'+fld2+'" validate="name"/></div>'+
						 '<div style="float:left;width:216px;"><input  class="field" style="width:192px;" type="text" id="'+fld3+'" name="'+fld3+'" validate="name"/></div>'+
							 '<div style="float:left;width:84px;padding-top:1px;">'+
								 '<select style="border: 1px solid #356AA0;font-size:11px;padding:2px 2px;" name="'+fld4+'">'+
									 '<option value="">- Select -</option>'+
									 suffix_html+
								 '</select>'+
							 '</div>';

			html_string += '</div>'+
							'<div class="reset"></div>'+
							'<div>';
			newDiv.innerHTML = html_string;
			obj.appendChild(newDiv);
			Effect.Appear(elementById(rid), prefix + '_add_another_name', prefix + '_status_bar');
			init(prefix + '_form');
		break;
		
		case 'relation':
		   html_string = '\n\n\n'+
						 '<div id="'+rid+'" style="display:none">'+
						 '<div style="padding-top:4px;">'+
						 '<div style="float:left;width:182px;"><input class="field" style="width:160px;" type="text" id="'+fld1+'" name="'+fld1+'" validate="name"/></div>'+
						 '<div style="float:left;width:102px;"><input class="field" style="width:80px;" type="text" id="'+fld2+'" name="'+fld2+'" validate="name"/></div>'+
						 '<div style="float:left;width:182px;"><input  class="field" style="width:160px;" type="text" id="'+fld3+'" name="'+fld3+'" validate="name"/></div>'+
							 '<div style="float:left;width:84px;padding-top:1px;">'+
								 '<select style="border: 1px solid #356AA0;font-size:11px;padding:2px 2px;" name="'+fld4+'">'+
									 '<option value="">- Select -</option>'+
									 suffix_html+
								 '</select>'+
							 '</div>';
							 
		   html_string +=  
				 '<div style="float:left;padding-top:1px;" id="'+fld5+'_div" >'+
					 '<select class="field" style="font-size:11px;padding:2px 2px;" name="'+fld5+'" id="'+fld5+'" onchange="checkRelation(\''+fld5+'\');">'+
						 '<option value="">- Select -</option>'+
						 relation_html+
					 '</select>'+
				 '</div>';

			html_string += '</div>'+
							'<div class="reset"></div>'+
							'<div>';
			newDiv.innerHTML = html_string;
			obj.appendChild(newDiv);
			Effect.Appear(elementById(rid), prefix + '_add_another_name', prefix + '_status_bar');
			init(prefix + '_form');
		break;
	}
}

function checkRelation(id){
	var obj = elementById(id);
	
	if (obj.value != 'other'){
		return;
	}
	
	obj.style.display = 'none';
	var rel_other = document.createElement('input');
		rel_other.setAttribute('type', 'text');
		rel_other.setAttribute('id', id+'_text');
		rel_other.setAttribute('class', 'field');
		rel_other.setAttribute('style', 'width:65px;');
		
		if (arguments[1]){
			rel_other.setAttribute('onblur', 'setOtherRelation(\''+id+'\');setRelationValue(\''+id+'\');');
		} else {
			rel_other.setAttribute('onblur', 'setOtherRelation(\''+id+'\');');
		}
	
	var other_div = elementById(id+'_div');	
	other_div.appendChild(rel_other);
	rel_other.focus();
}

function setOtherRelation(id){
	var obj = elementById(id);
	var obj_text = elementById(id+'_text');
	var div_obj = elementById(id+'_div');
	var other_rel = obj_text.value;

	if (other_rel != ''){
		if (obj.options[obj.options.length-1].value != 'other'){
			obj.options[obj.options.length-1] = null;
		}
		other_rel =  other_rel.substr(0, 1).toUpperCase() + other_rel.substr(1).toLowerCase();
		obj.options[obj.options.length] = new Option(other_rel,other_rel);		
		obj.value = other_rel;
	} else {
		if (obj.options[obj.options.length-1].value != 'other'){
			obj.value = obj.options[obj.options.length-1].value;
		} else {
			obj.value = '';
		}
	}

	div_obj.removeChild(obj_text);
	obj.style.display = '';
}


function checkResidence(id){ 
	var obj = elementById(id);
	
	if (obj.value != 'other'){
		return;
	}

	obj.style.display = 'none';
	var rel_other = document.createElement('input');
		rel_other.setAttribute('type', 'text');
		rel_other.setAttribute('id', id+'_text');
		rel_other.setAttribute('class', 'field');
		rel_other.setAttribute('style', 'width:150px;');
		
		if (arguments[1]){
			rel_other.setAttribute('onblur', 'setOtherResidence(\''+id+'\');setRelationValue(\''+id+'\');');
		} else {
			rel_other.setAttribute('onblur', 'setOtherResidence(\''+id+'\');');
		}
	
	var other_div = elementById(id+'_div');	
	other_div.appendChild(rel_other);
	rel_other.focus();
}

function setOtherResidence(id){
	var obj = elementById(id);
	var obj_text = elementById(id+'_text');
	var div_obj = elementById(id+'_div');
	var other_rel = obj_text.value;

	if (other_rel != ''){
		if (obj.options[obj.options.length-1].value != 'other'){
			obj.options[obj.options.length-1] = null;
		}
		other_rel =  other_rel.substr(0, 1).toUpperCase() + other_rel.substr(1).toLowerCase();
		obj.options[obj.options.length] = new Option(other_rel,other_rel);		
		obj.value = other_rel;
	} else {
		if (obj.options[obj.options.length-1].value != 'other'){
			obj.value = obj.options[obj.options.length-1].value;
		} else {
			obj.value = '';
		}
	}

	div_obj.removeChild(obj_text);
	obj.style.display = '';
}

function setResidenceValue(id){
	var tmp = id.split('_');
	var obj = elementById(tmp[0]+'_'+tmp[1]+'_'+tmp[2]+'_'+tmp[3]);
	var source = elementById(id).value;

	if (source != ''){
		obj.value = source.toLowerCase();
	} else {
		obj.value = '[empty]';
	}
}


function showRelation(id){
	elementById(id).style.display = '';
}

function hideRelation(id){
	elementById(id+'_div').style.display = 'none';
	myInnerHTML('',id+'_err');
	clearFieldError(id);
}

function setRelationValue(id){
	var tmp = id.split('_');
	var obj = elementById(tmp[0]+'_'+tmp[1]+'_'+tmp[2]+'_'+tmp[3]);
	var source = elementById(id).value;

	if (source != ''){
		obj.value = source.toLowerCase();
	} else {
		obj.value = '[empty]';
	}
}

function save_ff_status(aJaX_obj, AJX_response){
	//alert(AJX_response);
	AJX_response = eval(AJX_response);
	
	switch (AJX_response[0]){
		case 'OK':
			window.location.reload();
		break;

		case 'ERR':
			printErrors(AJX_response);
			busy = false;
		break;
	}
}

function save_ff(form){
	if (busy == false){
		busy = true;
		var ajaxSave = new aJaX(save_ff_status);
		var postContent = encodeForm(form);
		ajaxSave.modePOST('/ajax/saveFF.php?form='+form, postContent);
		return false;
	}
}

function showFFPopup(type){
	busy = false;
	fade_bckg();
	switch (type){
		case 'placeFraudAlerts':
			if (elementById('place_fraud_alerts') != null)
			{
				document.body.removeChild(elementById('place_fraud_alerts'));
				showFFPopup(type);
			} else {
				var pop_fraud_alerts = document.createElement('div');
				pop_fraud_alerts.setAttribute('id', 'place_fraud_alerts');
				document.body.appendChild(pop_fraud_alerts);
				var html_string = '<form onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">Place Fraud Alerts</div>'
					+		'<div class="close" onclick="return close_box(\'place_fraud_alerts\')"></div>'
					+ '</div>'
					+ '<div style="padding-left:8px;font-weight:bold;font-size:12px;line-height:20px;">'
						+ '<div>To place fraud alerts, contact <u>ONE</u> of the credit bureaus below by phone or online, and request that they place a 90-day fraud alert on your credit report. ';
					
					if (adult_member_count != 0){
						html_string += 'Remember to place fraud alerts for all adults covered by your protection plan. ';
					}

					html_string += 'That credit bureau will automatically pass the alert on to the other bureaus. After placing the alert, close this window and click on the &quot;I Have Placed Fraud Alerts&quot; link and set the date that you placed the alert so that we can schedule your automatic renewal reminders.</div>'		
						+ '<div style="line-height:14px;padding-top:8px;"><div>Equifax</div><div><a href="https://www.alerts.equifax.com/AutoFraud_Online/jsp/fraudAlert.jsp" target="_new">Request a fraud alert online</a> or by calling <span style="font-weight:bold;">1-800-525-6285</span></div></div>'
						+ '<div style="line-height:14px;padding-top:8px;"><div>Experian</div><div><a href="http://www.experian.com/fraud" target="_new">Request a fraud alert (&quot;Initial Security Alert&quot;) online</a> or by calling  <span style="font-weight:bold;">1-888-397-3742</span></div></div>'
						+ '<div style="line-height:14px;padding-top:8px;padding-bottom:8px;"><div>TransUnion</div><div>Request a fraud alert by calling  <span style="font-weight:bold;">1-800-680-7289</span></div></div>'
					+'</div>'
					+'</div></form>';
				pop_fraud_alerts.innerHTML = html_string;
				floatDiv("place_fraud_alerts",220).floatIt();
			}
		break;

		case 'removeFraudAlerts':
			if (elementById('remove_fraud_alerts') != null)
			{
				document.body.removeChild(elementById('remove_fraud_alerts'));
				showFFPopup(type);
			} else {
				var pop_fraud_alerts = document.createElement('div');
				pop_fraud_alerts.setAttribute('id', 'remove_fraud_alerts');
				document.body.appendChild(pop_fraud_alerts);
				pop_fraud_alerts.innerHTML = '<form onsubmit="return false;">'
					+'<div class="add_popup" style="width:500px;height:200px;">'
					+ '<div class="header">'
					+ 	'<div class="title">Remove Fraud Alerts</div>'
					+		'<div class="close" onclick="return close_box(\'remove_fraud_alerts\')"></div>'
					+ '</div>'
					+ '<div style="padding-left:8px;font-weight:bold;font-size:12px;line-height:20px;">'
						+ '<div>Contact <u>ONE</u> of the credit bureaus below to request your fraud alert to be removed from your credit report.</div>'
						+ '<div style="color:#ff0000;padding-top:8px;">Phone:</div>'
						+ '<div>Equifax - 1.800.525.6285</div>'
						+ '<div>Experian - 1.888.397.3742</div>'
						+ '<div>TransUnion - 1.800.680.7289</div>'
					+'</div>'
					+'</div></form>';
				floatDiv("remove_fraud_alerts",220).floatIt();
			}
		break;

		case 'haveRemovedFraudAlerts':
		case 'havePlacedFraudAlerts':
			createYearDropdown(type);
			var div_title = (type=='haveRemovedFraudAlerts')? 'Removed' : 'Placed';
			var div_text = (type=='haveRemovedFraudAlerts')? 'remove' : 'place';
			var ff_form = (type=='haveRemovedFraudAlerts')? 'ff_form_remove' : 'ff_form_place';
			var height = (type=='haveRemovedFraudAlerts')? '180px' : '400px';

			if (elementById('place_remove_fraud_alerts') != null)
			{
				document.body.removeChild(elementById('place_remove_fraud_alerts'));
				showFFPopup(type);
			} else {
				var pop_fraud_alerts = document.createElement('div');
				pop_fraud_alerts.setAttribute('id', 'place_remove_fraud_alerts');
				document.body.appendChild(pop_fraud_alerts);
				var html_string = '<form id="'+ff_form+'" name="'+ff_form+'" onsubmit="return false;">'
					+'<div id="id_add_popup" class="add_popup" style="width:500px;height:'+height+'">'
					+ '<div class="header">'
					+ 	'<div class="title">I Have '+div_title+' Fraud Alerts</div>'
					+		'<div class="close" onclick="return close_box(\'place_remove_fraud_alerts\')"></div>'
					+ '</div>'
					
					+ '<div style="padding-left:8px;font-weight:bold;font-size:12px;line-height:20px;">'
						+ '<div>';
						
						if (type=='haveRemovedFraudAlerts'){
							html_string += 'When did you '+div_text+' fraud alerts?</div>';
						} else {
							if (adult_member_count != 0){
								html_string += 'Save the date that you placed fraud alerts below. If you set fraud alerts for multiple family members on the same date, this date can serve as a reminder for all of them. When it\'s time to renew your fraud alerts, we\'ll automatically send you an email reminder.<div style="padding-top:6px;">1. When did you '+div_text+' your fraud alerts?</div></div>';	
							} else {
								html_string += 'Save the date that you placed fraud alerts below. When it\'s time to renew your fraud alerts, we\'ll automatically send you an email reminder.<div style="padding-top:6px;">1. When did you '+div_text+' your fraud alerts?</div></div>';
							}
						}

						html_string += '<div style="padding-left:14px;padding-top:8px;">'
							+ '<div style="float:left;">'
							+ '	<select name="ff_month" id="ff_month" class="field">'
									+ monthList_html
							+ '	</select>'
							+ '</div>'
							+ '<div style="float:left;padding-left:6px;">'
							+ '	<select name="ff_day" id="ff_day" class="field">'
									+ dayList_html
							+ '	</select>'
							+ '</div>'
							+ '<div style="float:left;padding-left:6px;">'
							+ '	<select name="ff_year" id="ff_year" class="field">'
									+ yearList_html
							+ '	</select>'
							+ '</div>'
							+ '<div class="reset"></div>'
							+ '<div id="ff_err" class="input_err"></div>'
						+ '</div>';	
					if (ff_form == 'ff_form_place'){
						html_string += '<div style="line-height:16px;"><div style="padding-top:8px;">2. Which credit bureau did you contact to '+div_text+' your fraud alert?</div>'
						+ '<div style="padding-left:12px;">(Note: That bureau will automatically pass the alert on to the other bureaus.)</div></div>'
						+ '<div style="padding-left:8px;padding-top:6px;">'
							+ '<div><input type="radio" name="credit_bureau" value="equifax">&nbsp;Equifax</div>'
							+ '<div><input type="radio" name="credit_bureau" value="experian">&nbsp;Experian</div>'
							+ '<div><input type="radio" name="credit_bureau" value="transunion">&nbsp;TransUnion</div>'
							+ '<div><input type="radio" name="credit_bureau" value="dontremember">&nbsp;I don\'t remember</div>'
						+ '</div>'
						+ '<div style="padding-left:14px;" id="cc_bureau_err" class="input_err"></div>';
					}
					html_string += '</div>'
					+ '<div style="padding: 8px 0 0 20px;">'
						+ '<div id="save_button" class="btn_med_silver w_75" onclick="save_ff(\''+ff_form+'\')" style="float:left;"><div class="bl"><div class="br">SAVE</div></div></div>'
						+ '<div id="saving_status" class="hidden" style="text-align:center;width:75px" style="float:left;"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'
						+ '<div style="padding-left:16px;padding-top:6px;float:left;"><a href="#" onclick="return close_box(\'place_remove_fraud_alerts\')">Cancel</a></div>'
					+ '</div>'
					+'</div></form>';
					pop_fraud_alerts.innerHTML = html_string;
				floatDiv("place_remove_fraud_alerts",220).floatIt();
			}
		break;

		case 'editFraudAlertsPlacedDate':
		case 'editFraudAlertsRemovedDate':
			createYearDropdown(type);
			var div_title = (type=='editFraudAlertsRemovedDate')? 'removed' : 'placed';
			var div_text = (type=='editFraudAlertsRemovedDate')? 'removed' : 'have placed';
			var ff_form = (type=='editFraudAlertsPlacedDate')? 'ff_form_edit_placed' : 'ff_form_edit_removed';
			if (elementById('edit_fraud_alerts') != null)
			{
				document.body.removeChild(elementById('edit_fraud_alerts'));
				showFFPopup(type);
			} else {
				var pop_fraud_alerts = document.createElement('div');
				pop_fraud_alerts.setAttribute('id', 'edit_fraud_alerts');
				document.body.appendChild(pop_fraud_alerts);
				var html_string = '<form id="'+ff_form+'" name="'+ff_form+'" onsubmit="return false;">'
					+'<div class="add_popup" style="width:500px;height:210px;">'
					+ '<div class="header">'
					+ 	'<div class="title">Edit date when you '+div_title+' Fraud Alerts</div>'
					+		'<div class="close" onclick="return close_box(\'edit_fraud_alerts\')"></div>'
					+ '</div>'
					+ '<div style="padding-left:8px;font-weight:bold;font-size:12px;line-height:20px;">';
					
					if (adult_member_count != 0){
						html_string += '<div>You indicated that the last time you '+div_text+' fraud alerts for yourself and any other family members was <span style="color:#ff0000;">'+FFDate+'</span>.</div>';
					} else {
						html_string += '<div>You indicated that the last time you '+div_text+' fraud alerts was <span style="color:#ff0000;">'+FFDate+'</span>.</div>';
					}					

					html_string += '<div>If this date is incorrect, please enter the correct date below.</div>'
						+ '<div style="padding-top:12px;">'
							+ '<div style="float:left;">'
							+ '	<select name="ff_month" id="ff_month" class="field">'
									+ monthList_html
							+ '	</select>'
							+ '</div>'
							+ '<div style="float:left;padding-left:6px;">'
							+ '	<select name="ff_day" id="ff_day" class="field">'
									+ dayList_html
							+ '	</select>'
							+ '</div>'
							+ '<div style="float:left;padding-left:6px;">'
							+ '	<select name="ff_year" id="ff_year" class="field">'
									+ yearList_html
							+ '	</select>'
							+ '</div>'
							+ '<div class="reset"></div>'
							+ '<div id="ff_err" class="input_err"></div>'
						+ '</div>'
					+ '</div>'
					+ '<div style="padding: 16px 0 0 8px;">'
						+ '<div id="save_button" class="btn_med_silver w_75" onclick="save_ff(\''+ff_form+'\')" style="float:left;"><div class="bl"><div class="br">SAVE</div></div></div>'
						+ '<div id="saving_status" class="hidden" style="text-align:center;width:75px" style="float:left;"><img src="/images/tid/processing_standby.gif" alt="processing"></div>'
						+ '<div style="padding-left:16px;padding-top:6px;float:left;"><a href="#" onclick="return close_box(\'edit_fraud_alerts\')">Cancel</a></div>'
					+ '</div>'
					+'</div></form>';
					
					pop_fraud_alerts.innerHTML = html_string;

				floatDiv("edit_fraud_alerts",220).floatIt();
			}
		break;

		case 'fraudFlagHistory':
			if (elementById('fraud_flag_history') != null)
			{
				document.body.removeChild(elementById('fraud_flag_history'));
				showFFPopup(type);
			} else {
				var pop_fraud_alerts = document.createElement('div');
				pop_fraud_alerts.setAttribute('id', 'fraud_flag_history');
				document.body.appendChild(pop_fraud_alerts);
				var html_str = '<form onsubmit="return false;">'
					+'<div class="add_popup" style="width:700px;height:320px;">'
					+ '<div class="header">'
					+ 	'<div class="title">Fraud Alert History</div>'
					+		'<div class="close" onclick="return close_box(\'fraud_flag_history\')"></div>'
					+ '</div>'
					+ '<div style="font-weight:bold;font-size:14px;margin-left:8px;">Table below shows all your Fraud Alert history.</div>'
					+ '<div style="margin-left:8px;margin-top:8px;overflow:auto;width:680px;height:230px;">'
					+ '<table cellspacing="1" cellpadding="0">'
					+ '<tr style="background:#d9d9d9;"><td style="font-weight:bold;font-size:16px;width:90px;height:40px;padding-left:8px;">Start Date</td><td style="font-weight:bold;font-size:16px;width:90px;height:40px;padding-left:8px;">Status</td><td style="font-weight:bold;font-size:16px;width:500px;height:40px;padding-left:8px;">Details</td></tr>';
					
					var len = ff_history_detail.length;
					var bcolor = '';
					for (i=0; i<len; i++){
						var bcolor = (i % 2)? '#f2f2f2' : '';
						html_str += '<tr style="background:'+bcolor+'"><td style="font-size:14px;padding-left:8px;height:30px;">'+ff_history_detail[i][0]+'</td><td style="font-size:14px;padding-left:8px;height:30px;">'+ff_history_detail[i][1]+'</td><td style="font-size:14px;padding-left:8px;height:30px;">'+ff_history_detail[i][2]+'</td></tr>';
					}
					
					html_str += '</table>'
					+ '</div>'
					+'</div></form>';
				pop_fraud_alerts.innerHTML = html_str;
				floatDiv("fraud_flag_history",220).floatIt();
			}
		break;
	}
}

function showThreatScoreAction(type){
	busy = false;
	fade_bckg();
	switch (type){
		case 'calculate':
			if (elementById('ids_calculate') != null)
			{
				document.body.removeChild(elementById('ids_calculate'));
				showThreatScoreAction(type);
			} else {
				var ids_calculate = document.createElement('div');
				ids_calculate.setAttribute('id', 'ids_calculate');
				document.body.appendChild(ids_calculate);
				ids_calculate.innerHTML = '<form onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">What Actions Do I Need to Take?</div>'
					+		'<div class="close" onclick="return close_box(\'ids_calculate\')"></div>'
					+ '</div>'
					+ '<div>'
					+ '<div style="font-weight:bold;padding-left:8px;">Your score is not yet available</div>'
					+ '<div style="padding: 20px 0 20px 8px;">We are scanning hundreds of public and private databases to calculate your Identity Threat Score. Check for your score within 72 hours.</div>'
					+ '<div style="padding: 0 0 20px 8px;"><a style="cursor:pointer;" onclick="return close_box(\'ids_calculate\')">Close Window</a></div>'
					+ '</div>'
					+'</div></form>';
				floatDiv("ids_calculate",220).floatIt();
			}
		break;

		case 'lowrisk':
			if (elementById('ids_lowrisk') != null)
			{
				document.body.removeChild(elementById('ids_lowrisk'));
				showThreatScoreAction(type);
			} else {
				var ids_lowrisk = document.createElement('div');
				ids_lowrisk.setAttribute('id', 'ids_lowrisk');
				document.body.appendChild(ids_lowrisk);
				ids_lowrisk.innerHTML = '<form onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">What Actions Do I Need to Take?</div>'
					+		'<div class="close" onclick="return close_box(\'ids_lowrisk\')"></div>'
					+ '</div>'
					+ '<div>'
					+ '<div style="font-weight:bold;padding-left:8px;">Your Identity Threat Score is '+ids_score+' out of 500. Your risk is LOW.</div>'
					+ '<div style="padding: 20px 0 20px 8px;">'
					+ '<span style="font-weight:bold">Congratulations, based on your current score there are no additional steps that you need to take at this time.</span> You should always keep your protections active and up-to-date and regularly login to your MyTrustedID account to check the status of your protections and to see your updated Identity Threat Score.'
					+ '</div>'
					+ '<div style="padding: 0 0 20px 8px;"><a style="cursor:pointer;" onclick="return close_box(\'ids_lowrisk\')">Close Window</a></div>'
					+ '</div>'
					+'</div></form>';
				floatDiv("ids_lowrisk",220).floatIt();
			}
		break;

		case 'mediumrisk':
			if (elementById('ids_mediumrisk') != null)
			{
				document.body.removeChild(elementById('ids_mediumrisk'));
				showThreatScoreAction(type);
			} else {
				var ids_mediumrisk = document.createElement('div');
				ids_mediumrisk.setAttribute('id', 'ids_mediumrisk');
				document.body.appendChild(ids_mediumrisk);
				ids_mediumrisk.innerHTML = '<form onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">What Actions Do I Need to Take?</div>'
					+		'<div class="close" onclick="return close_box(\'ids_mediumrisk\')"></div>'
					+ '</div>'
					+ '<div>'
					+ '<div style="font-weight:bold;padding-left:8px;">Your Identity Threat Score is '+ids_score+' out of 500. Your risk is MEDIUM.</div>'
					+ '<div style="padding: 20px 0 20px 8px;">'
					+ '<span style="font-weight:bold">Based on your current score we recommend that you take extra precautions with your identity.</span> We have found information that fits some of the patterns of identity theft. Be very careful when giving your Social Security number and other personal information to anyone, and review your most recent financial statements and credit reports for any information that seems unfamiliar or out of place. If you spot any unfamiliar information, or suspect identity theft, contact our On-Call Protection Specialists at ' + support_phone + ' for assistance. Our trained experts are available ' + support_hours + ' and will help you determine if your identity is at risk and what actions are necessary.'
					+ '</div>'
					+ '<div style="padding-left:8px;">'
					+ 'Also, be sure to keep your protections active and up-to-date and regularly login to your MyTrustedID account to check the status of your protections. We rescan millions of records in public and private databases for your identity risk factors every 90 days to recalculate your score. New information can change your score quickly, so be sure to log in regularly to check your score and take any necessary actions.'
					+ '</div>'
					+ '<div style="padding: 20px 0 20px 8px;"><a style="cursor:pointer;" onclick="return close_box(\'ids_mediumrisk\')">Close Window</a></div>'
					+ '</div>'
					+'</div></form>';
				floatDiv("ids_mediumrisk",220).floatIt();
			}
		break;

		case 'highrisk':
			if (elementById('ids_highrisk') != null)
			{
				document.body.removeChild(elementById('ids_highrisk'));
				showThreatScoreAction(type);
			} else {
				var ids_highrisk = document.createElement('div');
				ids_highrisk.setAttribute('id', 'ids_highrisk');
				document.body.appendChild(ids_highrisk);
				ids_highrisk.innerHTML = '<form onsubmit="return false;">'
					+'<div class="add_popup">'
					+ '<div class="header">'
					+ 	'<div class="title">What Actions Do I Need to Take?</div>'
					+		'<div class="close" onclick="return close_box(\'ids_highrisk\')"></div>'
					+ '</div>'
					+ '<div>'
					+ '<div style="font-weight:bold;padding-left:8px;">Your Identity Threat Score is '+ids_score+' out of 500. Your risk is HIGH.</div>'
					+ '<div style="padding: 20px 0 20px 8px;">'
					+ '<span style="font-weight:bold">Based on your current score we recommend that you contact our On-Call Protection Specialists at ' + support_phone + ', if you have not already, in order to secure your identity.</span> Our trained experts are available ' + support_hours + ' and will help you determine if your identity has been compromised and what actions are necessary. Be extremely careful when giving out personal information, and make sure that all the features of your protection are active and up-to-date.'
					+ '</div>'
					+ '<div style="padding: 20px 0 20px 8px;"><a style="cursor:pointer;" onclick="return close_box(\'ids_highrisk\')">Close Window</a></div>'
					+ '</div>'
					+'</div></form>';
				floatDiv("ids_highrisk",220).floatIt();
			}
		break;
		
		case 'update':
			if (elementById('ids_update') != null)
			{
				document.body.removeChild(elementById('ids_update'));
				showThreatScoreAction(type);
			} else {
				var ids_update = document.createElement('div');
				ids_update.setAttribute('id', 'ids_update');
				document.body.appendChild(ids_update);
				ids_update.innerHTML = '<form name="form_update_score" onsubmit="return false;">'
					+'<div class="add_popup" style="width:550px;">'
					+ '<div class="header">'
					+ 	'<div class="title">Update My Identity Threat Score</div>'
					+		'<div class="close" onclick="return close_box(\'ids_update\')"></div>'
					+ '</div>'
					+ '<div>'
					+ '<div style="font-weight:bold;padding-left:8px;">Based on your current score we have recommended that you contact our On-Call Protection Specialists at ' + support_phone + ' in order to secure your identity.</div>'
					+ '<div style="padding: 10px 0 6px 8px;">'
					+ 'If you have already contacted us and completed the specific steps recommended by our experts, click on &quot;Update My Identity Threat Score&quot; below. We will rescan millions of records in public and private databases for your identity risk factors, and your score will be updated within 30 days.'
					+ '</div>'
					+ '<div style="padding: 6px 0 6px 4px;">'
					+ '<div style="float:left;padding-right:4px;"><input type="checkbox" name="confirm_update" /></div>'
					+ '<div>I confirm that I have completed the recommended steps and contacted the appropriate 3rd parties to update my information.</div>'
					+ '<div id="confirm_update_err" class="input_err"></div>'
					+ '</div>'
					+ '<div style="padding: 6px 0 30px 134px;">'
					+ '<div class="ids_update_score" style="float:left;margin-right:10px;cursor:pointer;" onclick="update_threat_score();"></div>'
					+ '<div style="padding: 6px 0 0 0"><a style="cursor:pointer;" onclick="return close_box(\'ids_update\')">Cancel</a></div>'
					+ '</div>'
					+ '</div>'
					+'</div></form>';
				floatDiv("ids_update",220).floatIt();
			}
		break;

		case 'update_thankyou':
			if (elementById('ids_update_thankyou') != null)
			{
				document.body.removeChild(elementById('ids_update_thankyou'));
				showThreatScoreAction(type);
			} else {
				var ids_update_thankyou = document.createElement('div');
				ids_update_thankyou.setAttribute('id', 'ids_update_thankyou');
				document.body.appendChild(ids_update_thankyou);
				ids_update_thankyou.innerHTML = '<form onsubmit="return false;">'
					+'<div class="add_popup" style="width:550px;">'
					+ '<div class="header">'
					+ 	'<div class="title">Update My Identity Threat Score</div>'
					+		'<div class="close" onclick="return close_box(\'ids_update_thankyou\')"></div>'
					+ '</div>'
					+ '<div>'
					+ '<div style="padding: 4px 0 6px 8px;">'
					+ 'Thank you. We will now begin scanning public and private databases for your identity risk factors to determine your Identity Threat Score. Please login to your account within 30 days to see your new score.'
					+ '</div>'
					+ '<div style="padding: 20px 0 20px 8px;"><a style="cursor:pointer;" onclick="return close_box(\'ids_update_thankyou\')">Close Window</a></div>'
					+ '</div>'
					+'</div></form>';
					+ '</div>'
					+'</div></form>';
				floatDiv("ids_update_thankyou",220).floatIt();
			}
		break;
	}
}

function update_threat_score_status(aJaX_obj, AJX_response){
	AJX_response = eval(AJX_response);
	switch(AJX_response[0]){
		case 'ERR':
			printErrors(AJX_response);
			break;
		case 'OK':
			close_box('ids_update');
			showThreatScoreAction('update_thankyou');
			break;
	}
}

function update_threat_score(){
	var ajaxSave = new aJaX(update_threat_score_status);
	var postContent = encodeForm('form_update_score');
	ajaxSave.modePOST('/ajax/updateThreatScore.php', postContent);
	return false;
}

var original_action = '';

function row_action(type, row, action){
	var edit_row = document.getElementById(type + '@@ui_container_row_' + row);
	var display_row = document.getElementById(type + '@@uido_container_row_' + row);
	var action_val = document.getElementById(type + '@@ui_action_row_'+ row);
	
	switch (action){
		case 'edit':
			edit_row.style.display = '';
			display_row.style.display = 'none';
		break;

		case 'delete':
			display_row.className = 'delete_row';
			document.getElementById(type + '@@ui@@action_container_row_' + row).style.display = 'none';
			document.getElementById(type + '@@ui@@undo_container_row_' + row).style.display = '';
			original_action = action_val.value;
			action_val.value = 'delete';
		break;

		case 'undo':
			display_row.className = '';
			document.getElementById(type + '@@ui@@action_container_row_' + row).style.display = '';
			document.getElementById(type + '@@ui@@undo_container_row_' + row).style.display = 'none';
			action_val.value = original_action;
		break;

		case 'save':
			var form_name = (type=='vr')? 'save_relation_validate' : 'save_name_validate';
				pp_action_ts(form_name, 'r_' + row);
			
		break;

		case 'update':
			var des_val = document.getElementById(type + '_'+ arguments[3] +'_row_' + row);
			var source_val = document.getElementById(type + '@@ui_'+ arguments[3] +'_row_'+ row);
			var display_val = document.getElementById(type + '@@uido_'+ arguments[3] +'_row_'+ row);

			des_val.value = source_val.value;
			display_val.innerHTML = '';
			display_val.innerHTML = source_val.value;

			action_val.value = 'update';
		break
	}
}