isNS = 0;
isIE = 0;
if(navigator.appName.indexOf('Netscape') != -1)
isNS = 1;
else
isIE = 1;
function ran()
{
return (new Date()).getMilliseconds();
}
function getMouseXY(e)
{
var posx = 0;
var posy = 0;
var divoffset = 10;
if (e.pageX || e.pageY){
posx = e.pageX;
posy = e.pageY + divoffset;
}
else if (e.clientX || e.clientY){
posx = e.clientX + document.body.scrollLeft
+ document.documentElement.scrollLeft;
posy = e.clientY + document.body.scrollTop
+ document.documentElement.scrollTop + divoffset;
}
return {x:posx, y:posy};
}
function changeClass(id, c)
{
if(document.getElementById(id)) document.getElementById(id).className = c;
}
function toggleClass(elementid, class1, class2)
{
var o = document.getElementById(elementid);
if (o!=null)
o.className = (o.className==class1?class2:class1);
}
function setTextboxValue(id, value)
{
var o = document.getElementById(id);
if(o!=null) o.value = value;
}
function cookieImage(url)
{
var i = new Image();
i.src = url+'?ran='+ran();
setTimeout('refreshThisPage(window.location.href)', 500);
}
function setWhatValue(value, divtofocus)
{
setTextboxValue('ls_whatboxtop',value);
setTextboxValue('ls_whatboxbottom',value);
document.getElementById(divtofocus).focus();
}
function setWhereValue(value, divtofocus)
{
setTextboxValue('ls_whereboxtop',value);
setTextboxValue('ls_whereboxbottom',value);
document.getElementById(divtofocus).focus();
}
function setWherePopValue(value, divtofocus)
{
setTextboxValue('ls_wherepopboxtop',value);
setTextboxValue('ls_wherepopboxbottom',value);
document.getElementById(divtofocus).focus();
}
function showDefaultLocationForm(form,e)
{
var m = getMouseXY(e);
document.getElementById(form).style.top = m.y;
document.getElementById(form).style.visibility = 'visible';
document.getElementById('defAddress').focus();
}
function hideDefaultLocationForm()
{
document.getElementById('ls_DefaultLocations').style.visibility = 'hidden';
document.getElementById('ls_cityerror').style.visibility = 'hidden';
}
function clearDefaultLocation()
{
var imgclr = new Image();
imgclr.src = 'http://www.switchboard.com/swbd.main/dir/6_0/defaultlocation/clear.htm?ran='+ran();
setTimeout('refreshThisPage(window.location.href)', 150);
}
function saveDefaultLocation()
{
if(document.getElementById('defCity').value == '' || document.getElementById('defState').selectedIndex==0)
{
changeClass('ls_cityerror', 'errorEnabled');
return false;
}
else
{
changeClass('ls_cityerror', 'errorDisabled');
}
var defAddress = document.getElementById('defAddress').value;
var defCity = document.getElementById('defCity').value;
var selState = document.getElementById('defState');
selStateIndex = selState.selectedIndex;
var defState = selState.options[selStateIndex].value;
var defZip = document.getElementById('defZip').value;
if(defAddress=='')
{
defAddress = 'NULL';
}
if(defZip=='')
{
defZip = 'NULL';
}
document.deflocimage.src = 'http://www.switchboard.com/swbd.main/dir/6_0/defaultlocation/save.htm?defAddress=' + defAddress + '&defCity=' + defCity + '&defState=' + defState + '&defZip=' + defZip + '&ran='+ran();
setTimeout('refreshThisPage(window.location.href)', 150);
}
function verifyDefaultCity()
{
if(document.getElementById('defCity').value == '')
changeClass('ls_cityerror', 'errorEnabled');
else
changeClass('ls_cityerror', 'errorDisabled');
}
function refreshThisPage(currenthref)
{
window.location.reload();
}
function validateMainForm(location)
{
var errorString = 'You must enter a keyword, phrase, and/or a valid location';
if (document.getElementById('ls_wherebox' + location))
{
if((document.getElementById('ls_wherebox' + location).value.length == 0) && document.getElementById('ls_whatbox' + location).value.length == 0)
{
document.getElementById('WhatWhereError' + location).innerHTML = errorString;
changeClass('WhatWhereError' + location, 'ls_StandardVisibleError');
return false
}
}
}
function popwin(URL,height,width)
{
var options = 'height=' + height + ',width=' + width + ',status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes';
window.open(URL, 'PopupWindow', options);
}
function getwhere()
{
document.getElementById("ls_wherepop").style.visibility = "visible";
document.getElementById("ls_wherepop").style.display = "block";
document.whereform.where.focus();
}
function hidewhere()
{
document.getElementById("ls_wherepop").style.visibility = "hidden";
document.getElementById("ls_wherepop").style.display = "none";
}
function toggleShowDate(s2pval,s2eval)
{
if((s2pval == 'off')||(s2eval == 'off')){
document.getElementById('showdate').style.visibility = 'hidden';
}else{
document.getElementById('showdate').style.visibility = 'visible';
}
//alert(s2pval+"::"+s2eval);
}
function trim(str)
{
if (str == null)
return null;
var startingIndex = 0;
var endingIndex = str.length-1;
while(str.substring(startingIndex, startingIndex+1) == ' ')
startingIndex++;
while(str.substring(endingIndex, endingIndex+1) == ' ')
endingIndex--;
if(endingIndex < startingIndex)
return '';
return str.substring(startingIndex, endingIndex+1);
}
function HandleInputEvents(input,input_dirty)
{
var input_dirty2 = document.getElementById(input_dirty);
var input2 = document.getElementById(input);
if(input_dirty2.value == 0)
{
input2.value='';
input_dirty2.value=1;
}
}
var win = null;
function newWindow(mypage,myname,w,h,features)
{
var winl = (screen.width-w)/2;
var wint = (screen.height-h)/2;
if (winl < 0) winl = 0;
if (wint < 0) wint = 0;
var settings = 'height=' + h + ',';
settings += 'width=' + w + ',';
settings += 'top=' + wint + ',';
settings += 'left=' + winl + ',';
settings += features;
win = window.open(mypage,myname,settings);
win.window.focus();
}
function showsurvey()
{
document.getElementById("survey").style.display = "block";
document.getElementById("survey").style.visibility = "visible";
}
function survey(action)
{
if(action=="go")
{
newWindow('https://live.datstat.com/INFO-Collector/Survey.ashx?Name=Switchboard_Q2_2007_survey','','650','350','resizable,scrollbars,status,toolbar');
document.getElementById("survey").style.display = "none";
document.getElementById("survey").style.visibility = "hidden";
}
else
{
document.getElementById("survey").style.display = "none";
document.getElementById("survey").style.visibility = "hidden";
}
}
// i CAN FIND no reference to this function 17.sept.09 rsr
function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );
/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
// this function gets the cookie, if it exists
// i CAN FIND no reference to this function 17.sept.09 rsr
function Get_Cookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function idearcclick(clickurl)
{
var idearcimg = new Image();
idearcimg.src = clickurl;
}
function OmnitureClick(section,coid,event)
{
//08-15-08: CMM - Chg omniture server setting to a web-xml parameter. Setting is read and
//stored in SwbdConstants and then assigned when SwbdTrackingInfo is instantiated. Footer
//include logic takes value from tracking-model and assigns javascript s_account variable.
//var s_account="superpagesswitchbd" - PRODUCTION
//var s_account="superpagesswitchbddev" - TEST
var s=s_gi(s_account);
s.linkTrackVars="channel,eVar3,events"
s.linkTrackEvents=event+"-"+coid;
s.channel = 'Switchboard';
s.eVar3 = section;
s.prop26 = section;
s.events=event;
s.tl(this,'o',section);
}
/*
* remove crlf
*/
function removeCRLF(inbound) {
var outbound = inbound.replace(/[\n\r]+/g, "");
return outbound;
}
function convertPlus(str) {
var out = "", flag = 0;
for (i = 0; i < str.length; i++) {
if (str.charAt(i) != "+") {
out += str.charAt(i);
flag = 0;
}
else {
if(flag == 0) {
out += " ";
flag = 1;
}
}
}
return out;
}
