function addTrackIdToResultsSortFormAction (that, site_id, origAction) {
var sortval = that.value;
var trid    = 0;
if (that.value == 'domain desc,lname,fname,age_range,state_id,citye') {
trid = 10168;
}
if (trid !== 0) {
// add track id to form action
that.form.action = '/' + site_id + '/track/' + trid + origAction;
}
}
function addLoadEvent (func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
};
}
}
function log_extra_listing_feature (form_id, clicked_el, site_id, log_prefix, log_what, strip_site_id) {
var form_el = document.getElementById(form_id);
var uri_site_id = '/' + site_id;
if (form_el) {
if (strip_site_id) { uri_site_id = ''; }
if (clicked_el.checked) {
form_el.action = uri_site_id + '/log_feature/' + log_prefix + '_w_' + log_what + '/search/FindPerson';
} else {
form_el.action = uri_site_id + '/log_feature/' + log_prefix + '_wo_' + log_what + '/search/FindPerson';
}
}
}
/* WP: ######################################## */
function HelpCenter(url) {
if (url.substring(0,1)!='/' && url.substring(0,4)!='http') {  url = '/'+url; }
help = window.open(url, 'help', "width=520,height=540,toolbars=no,location=no,scrollbars=yes,resizable=yes,status=no");
help.focus();
}
function WP_Help(url) {
var assembly = "http://images.whitepages.com" + url;
help = window.open(assembly, 'help', "width=650,height=500,toolbars=no,location=no,scrollbars=yes,resizable=yes,status=no");
help.focus();
}
function Bounce(cross, chip, site) {
if (chip===null) { chip = cross; }
site = (site===null) ? '' : '/'+site;
var show_popup = 1;
var cookie = document.cookie;
var cookies = cookie.split( '; ' );
var lookfor = 'MI-' + chip;
var persistent,nvp,pair,i,k;
for ( i=0; i<cookies.length; i++ ) {
if ( cookies[i].indexOf('wpn_persistent') > -1 ) {
persistent = cookies[i].split('=');
nvp = persistent[1].split('%26');
for ( k=0; k<nvp.length; k++ ) {
pair = nvp[k].split('%3D');
if ( pair[0] == lookfor ) {
if ( pair[1] >= 2 ) {
show_popup = 0;
}
}
}
}
}
}
function popWin(url, winName, width, height, other_settings) {
winName = winName.replace(" ", "_");
var settings;
if (other_settings==='') {
settings = "'width=" + width + ",height=" + height + ",toolbars=no,location=no,scrollbars=no,resizable=yes,status=no" + "'";
}else{
settings = "'width=" + width + ",height=" + height + "," + other_settings + "'";
}
popup = window.open(url, winName, settings);
popup.focus();
}
function termsPopup (url) {
termsWindow = window.open(url, 'terms', "width=670,height=480,toolbars=no,location=no,scrollbars=yes,resizable=yes,status=no");
termsWindow.focus();
}
function listing_validation_popup (url) {
termsWindow = window.open(url, 'listing_validation', "width=294,height=344,toolbars=no,location=no,scrollbars=no,resizable=no,status=no");
termsWindow.focus();
}
function yui_popup(name,ele) {
YAHOO.util.Event.onDOMReady(function(){
YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName(name,ele),'click',function(e){
var width_val, height_val, chrome_val, chrome_options;
var href_val = this.href;
var rel_val = this.rel;
var rel_split = rel_val.split(';');
for(n=0;n < rel_split.length; n++){
var equal_index = rel_split[n].indexOf('=');
var prop_name = rel_split[n].substring(0,equal_index);
var prop_value =  rel_split[n].substring(equal_index + 1);
if(prop_name == 'width'){
var width_val = prop_value;
}
if(prop_name == 'height'){
var height_val = prop_value;
}
if(prop_name == 'chrome'){
var chrome_val = prop_value;
}
}
if(chrome_val == 'none'){
var chrome_options = 'location=no,menubar=no,status=no,toolbar=no';
}
window.open(href_val, 'popup', 'height=' + height_val + ',width=' + width_val + ',scrollbars=yes,resizable=yes,' + chrome_options);
YAHOO.util.Event.preventDefault(e);
})
});
}
function send_email(listings_per_page, records_processed, uri_prefix ) {
var num_records;
var emails = "";
var email = "";
if ( listings_per_page > records_processed ) {
num_records = records_processed;
} else {
num_records = listings_per_page;
}
for( i=1; i<=num_records; i++ ) {
el = eval("document.selectAll.check" + i);
if ( el ) {
if ( el.checked ) {
email = eval("document.selectAll.primary_email" + i);
if ( email.value !== "" ) {
emails = emails + email.value + ';';
}
}
}
} 
if (emails) {
location.href = "mailto:" + emails;
} else {
alert("You must select at least one Contact that has an e-mail address.");
}
} 
function checkUncheckAll(listings_per_page, records_processed) {
var num_records;
if (listings_per_page > records_processed) {
num_records = records_processed;
} else {
num_records = listings_per_page;
}
for(i=1; i<=num_records; i++) {
el = eval("document.selectAll.check" + i);
if ( el ) {
if ( document.selectAll.checkall.checked === true ){
el.checked = true;
} else {
el.checked = false;
}
} 
}
} 
function preDelete( formname, url ) {
var f = document.forms[formname];
var listings_per_page = f.count.value;
var records_processed = f.rcount.value;
var num_records,agree,i;
var stripid = /.*_(.*)?/;
num_records = ( listings_per_page > records_processed ) ? records_processed : listings_per_page;
f.contact_id.value = "";
for( i=1; i<=num_records; i++ ) {
el = eval("f.check" + i);
if ( el ) {
if ( el.checked ) {
id_num = el.id.substring(el.id.lastIndexOf('_')+1);
f.contact_id.value += id_num + ';';
}
}
} 
if ( f.contact_id.value.length > 1 ) {
agree = confirm(f.confirm_delete.value);
if ( agree ) {
f.action = url;
f.submit();
}
return true;
} else {
alert("You have not selected any contacts. Click at least one contact's checkbox that you want to delete and try again.");
return false;
}
} // end preDelete
function swapElementText( id, find, repl ) {
el = document.getElementById(id);
if (el) {
re = new RegExp(find,'g');
txt = el.innerHTML;
el.innerHTML = txt.replace(re,repl);
}
} 
function addElementText(id, value) {
var el = WPScript.get(id);
el.innerHTML = value;
} 
function getCookieData( name, stage, key ) {
stage = ( stage===null || stage==='' || stage == 'production' ) ? '' : '_' + stage;
name = 'wpn_' + name + '' + stage;
var c = document.cookie.split('; ');
var i,nvp,j;
for ( i=0; i<c.length; i++ ) {
if ( c[i].indexOf(name) > -1 ) {
nvp = c[i].split('=')[1].split('%26');  // Get the name value pairs
for ( j=0; j<nvp.length; j++ ) {
if ( nvp[j].split('%3D')[0] == key ) { return nvp[j].split('%3D')[1]; }
}
}
}
return '';  
} 
function get_rdb_cookie(stage) {
var name = 'RDB';
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if ( c.indexOf(nameEQ) == 0 ) {
var rdb_fields = [];
var rdb_regex = 
/(.{4})(.{6})(.{4})(.{4})(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})(.{1})(.{1})(.{1})(.{1})(.{1})(.{1})(.{1})(.{1})(.{8})(.{3})(.{5})/;
rdb_fields = c.substring( nameEQ.length,c.length ).match( rdb_regex );
if (rdb_fields) {
return rdb_fields;
}
}
}
return null;
}
function dec2hex ( dec ) {
return dec.toString(16);
}
/** "WP: Hexadecimal to Decimal */
function hex2dec ( hex ) {
return parseInt(hex,16);
}
function compareDate( a, b ) {
if ( a===null || a==='' ) { a = new Date(); }
return ( b===null || b==='' )
? false
: ( a > b ) ? true : false;
} 
function getDateOffset( d, offset ) {
if ( offset===null || offset==='' ) { offset = 0; } 
d.setDate(
parseInt( d.getDate(), 10 )
+ parseInt( offset, 10 )
); 
return d;
} 
function translateDate( dateString, parser ) {
if ( dateString===null || dateString==='' ) { return ''; } 
if ( parser===null || parser==='' ) { parser = '/'; }      
var d = new Date();
d.setFullYear(parseInt(dateString.split(parser)[0],10));
d.setMonth(parseInt(dateString.split(parser)[1],10) - 1); // January == 0
d.setDate(parseInt(dateString.split(parser)[2],10));
return d;
} 
function releaseSurvey( siteId, formName, disable, stage, exp ){
if ( disable===true || disable=='true' ) { return false; } // Disable blocker
var authForms = ['pers_form','email_form','rp_form','ra_form','dual','wp_biz_form','wp_biz_cat_form'];
var isAuth    = false;
var formIsAuth = 0;
for ( var i = 0; i < authForms.length; i++ ) {
if ( formName.indexOf(authForms[i]) > -1 ) { isAuth = true; }
}
if ( isAuth === false ) { return false; }
var cDate = translateDate( getCookieData( 'persistent', stage, 'survey_rdate' ), '-' );
if ( cDate===null || cDate==='' ) { 
cDate = new Date();
cDate.setMonth(
parseInt( cDate.getMonth(), 10 ) - 12
); 
}
else {
cDate = getDateOffset( cDate, exp );
}
// Next, let's take a look at the cookie to see if we have an eDate
var dom,domain,uri,wW,wH;
if ( compareDate( new Date(), cDate ) ) { // Is the cDate bigger than the expiration limit??
dom    = ( location.href.substring( 0, 7 ) == 'http:\/\/' )
? location.href.substring(7)
: location.href;
dom    = dom.substring( 0, dom.indexOf('\/') );
domain = ( dom.indexOf('\\:') > -1 ) ? dom.substring( 0, dom.indexOf('\\:') ) : dom;
uri    = (siteId) ? dom + '/' + siteId : dom;
wW     =	(typeof(window.survey)!="undefined" && 'width' in survey ? survey.width : 350);
wH     =	(typeof(window.survey)!="undefined" && 'height' in survey ? survey.height : 660);
w = window.open(
'http://' + uri + '/survey' + '?wsb13=' + uri + 
'&wsb15=' + domain + '&localtime=survey',
'',
"width="+wW+",height="+wH+",toolbars=no,location=no,scrollbars=yes,resizable=yes,status=no"
);              
w.blur();       
window.focus(); 
return true;    
}
return false; 
} 
function releaseDemoSurvey(stage){
if(document.cookie.indexOf('seenDemoSurvey') < 0){
var pop_top = ((screen.height*1) / 2) - (550/2);
var pop_left = ((screen.width*1) / 2) - (739/2);
var pop_options = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=739,height=550,left=' + pop_left + ',top=' + pop_top + ',screenX=,screenY=';
document.cookie = "seenDemoSurvey=true;path=/;";
window.open('/profile_survey', 'popUpWin', pop_options);
}
return true;
}
function resizeWindow(x, y){
if (parseInt(navigator.appVersion,10) > 3) {
if (navigator.appName=="Netscape") {
top.outerWidth=x;
top.outerHeight=y;
}
else {
top.resizeTo(x,y);
}
}
else {
top.resizeTo(x,y);
}
} 
function changeHeight(target_id,target_size){
var e=document.getElementById(target_id);
current_height = e.clientHeight;
if(e.getAttribute('toggle_status') != 'open'){
if(current_height >= target_size){
clearTimeout(openTimeout);
e.setAttribute('toggle_status','open');
}else{
current_height = current_height + 20;
e.style.height = current_height;
openTimeout = setTimeout(function(){changeHeight(target_id,target_size);},0);
}
}else{
if(current_height <= 1){
clearTimeout(closeTimeout);
e.setAttribute('toggle_status','closed');
}else{
current_height = current_height - 20;
e.style.height = current_height;
closeTimeout = setTimeout(function(){changeHeight(target_id,target_size);},0);
}
}
}
//This is for the single results page sendsave button dropdown on RPR sites
function togglediv(whichdiv,parent_div) {
var thediv = document.getElementById(whichdiv);
var e = document.getElementById(parent_div);
thediv.style.display = ( thediv.style.display != 'block' ) ? 'block' : 'none';
e.className = ( e.className != 'results_single_action_active' ) ? 'results_single_action_active' : 'results_single_action';
}
function toggleImg(parent_div) {
var thediv = document.getElementById(parent_div);
thediv.className = ( thediv.className != 'open' ) ? 'open' : 'closed';
}
var hideImg = function(){
try {
var img = document.body.firstChild;
if (img.name && img.name.indexOf('s_i_whitepages')===0) {
img.style.position="absolute"; img.style.top="-2";
}
}
catch (err) { 
}
};
hideImg();
function PLL() {
if (document.getElementById("tdPCLeft") && document.getElementById("tdPCRight")) 	{
this.oL = getChildElement(document.getElementById("tdPCLeft"), "searchbox_border");
this.oR = getChildElement(document.getElementById("tdPCRight"), "searchbox_border");
if (this.oL && this.oR) 		{
if(this.oL.offsetHeight<this.oR.offsetHeight) {
this.oL.style.height=this.oR.offsetHeight;
this.oR.style.height=this.oR.offsetHeight;
}
else if(this.oR.offsetHeight<this.oL.offsetHeight) {
this.oR.style.height=this.oL.offsetHeight;
this.oL.style.height=this.oL.offsetHeight;
}
}
}
/**WP
* Summary: Loops through all of the child nodes of an element searching for
*          a node with either an ID or NAME that matches the search pattern.
* Returns: The first node that matches the search pattern NULL if no match found.
* Parameters:
*    OBJECT  obj - The parent element to search.
*    STRING  str - The ID/NAME to search for
*    BOOLEAN rcv - Search child nodes recursively.
*/
function getChildElement(obj,str,rcv) {
if (obj.hasChildNodes) {
for (this.i = 0; this.i <= (obj.childNodes.length-1); this.i++) {
if (obj.childNodes[this.i].id) {
if(obj.childNodes[this.i].id.toLowerCase().match(str)) {
return obj.childNodes[this.i];
} 
}
else if (obj.childNodes[this.i].name) {
if(obj.childNodes[this.i].name.toLowerCase().match(str)) {
return obj.childNodes[this.i];
} 
}
if (rcv) {
getChildElement(obj.childNodes[this.i], str, rcv);
}
}
}
return null;
}
}
function obsAddr(key) {
var url;
if (key=="101")	{ url="/cust_serv/contact_email_form?subject=Mobile Feedback&to_email=mobile-support&section_ref=mobile_test&page_ref=mobile_jump_page&page_title=mobile_page&site=10001"; } //mobile-support
window.open(url, 'contact_us', "width=520,height=540,toolbars=no,location=yes,scrollbars=yes,resizable=yes,status=no");
}
function help_text_flyout_action(action) {
var helpTextElement,helpElementHeight,helpTextIframe;
if(document.getElementById('helpTextFlyout')) {
helpTextElement = document.getElementById('helpTextFlyout');
helpTextElement.style.visibility = action;
helpElementHeight = helpTextElement.offsetHeight;
if(document.all && document.getElementById('helpTextFlyoutIframe')) {
helpTextIframe = document.getElementById('helpTextFlyoutIframe');
helpTextIframe.style.filter ='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
helpTextIframe.style.height = helpElementHeight;
helpTextIframe.style.visibility = action;
}
}
}
function getElementsByClassName(oElm, strTagName, oClassNames){
var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = [];
var arrRegExpClassNames = [];
var i;
if(typeof oClassNames == "object"){
for(i=0; i<oClassNames.length; i++){
arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/-/g, "\\-") + "(\\s|$)"));
}
}
else{
arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/-/g, "\\-") + "(\\s|$)"));
}
var oElement,bMatchesAll,j,k;
for(j=0; j<arrElements.length; j++){
oElement = arrElements[j];
bMatchesAll = true;
for(k=0; k<arrRegExpClassNames.length; k++){
if(!arrRegExpClassNames[k].test(oElement.className)){
bMatchesAll = false;
break;
}
}
if(bMatchesAll){
arrReturnElements.push(oElement);
}
}
return (arrReturnElements);
}
function show_city_whitepages(){ 
var cities_panel = document.getElementById('cities');
var cities_iframe = document.getElementById('cities_iframe');
if(cities_iframe){
if(cities_iframe.style.display == 'none' || cities_iframe.style.display === 'null' || cities_iframe.style.display === ''){
cities_iframe.style.display = 'block';	
}else{
cities_iframe.style.display = 'none';
}
}
if(cities_panel){
if(cities_panel.style.display == 'none' || cities_panel.style.display === 'null' || cities_panel.style.display === ''){
cities_panel.style.display = 'block';	
}else{
cities_panel.style.display = 'none';
}
}
}
function show_element(ele_name) {
var obj_ele = document.getElementById(ele_name);
if(obj_ele) {
if(obj_ele.style.display == 'none' || obj_ele.style.display === 'null' || obj_ele.style.display === '') {
obj_ele.style.display = 'block';	
}else{
obj_ele.style.display = 'none';
}
}
}
function hide_element(ele_name) {
var obj_ele = document.getElementById(ele_name);
obj_ele.style.display = 'none';
}
function resultsSuggestionsReviseExpando(obj) {
try {
if(obj.parentNode.className=='up') {
obj.parentNode.className='down';
obj.title="Click to collapse";
}else{
obj.parentNode.className='up';
obj.title="Click to expand";
}
}
catch (err) {}
}
function pnAboutExpando(obj){resultsSuggestionsReviseExpando(obj);}
function validate_listing( f, strURL ) {
var doc = 
(window.XMLHttpRequest) ? new XMLHttpRequest() : 
(window.ActiveXObject)  ? new ActiveXObject("Microsoft.XMLHTTP") : 
null;
if ( doc !== null ) {
doc.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
if (callback) { callback(this.responseXML); }
} else {
}
}
}
doc.open( "GET", strURL, true );
doc.send(null);
}
return doc;
} 
function claim_listing( f, strURL ) {
var doc =
(window.XMLHttpRequest) ? new XMLHttpRequest() :
(window.ActiveXObject)  ? new ActiveXObject("Microsoft.XMLHTTP") :
null;
if ( doc !== null ) {
doc.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
if (callback) { callback(this.responseXML); }
} else {
}
}
}
doc.open( "GET", strURL, true );
doc.send(null);
}
return doc;
}
function send_listing_feedback(f) {
opener.document.getElementById('results_single_listing_validation_thanks_this_is_me_container').style.display='block';
opener.document.getElementById('results_single_listing_validation_tellus_container').style.display='none';
f.submit();
opener.focus();
}
function goToNewPage(list)  {
var url = list.options[list.selectedIndex].value;
if (url != "")
{
window.open(url);
}
}
String.prototype.Left = function ()
{
if(arguments.length == 0){return this.toString();}
var n = parseInt(arguments[0]);
if(isNaN(n)){return this.toString();}
if (n <= 0) {return "";}
else if (n > this.length) {return this.toString();}
else {return this.substring(0,n);}
};
String.prototype.Right = function ()
{
if(arguments.length == 0){return this.toString();}
var n = parseInt(arguments[0]);
if(isNaN(n)){return this.toString();}
if (n <= 0) {return "";}
else if (n > this.length) {return this.toString();}
else {return this.substring(this.length, (this.length - n));}
}
String.Left = function(s,n){return s.Left(n);}
String.Right = function(s,n){return s.Right(n);}
String.Format = function()
{
if(arguments.length == 0){return null;}
var str = arguments[0];
for(var i=1;i<arguments.length;i++)
{
var re = new RegExp('\\{' + (i-1) + '\\}','gm');
str = str.replace(re, arguments[i]);
}
return str;
}
var DemoSurvey;
var common_ad;

