var doc=document;var dZ="Zip";
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof(window.onload)!= 'function')
{
window.onload = func;
}
else
{
window.onload = function(){
oldonload();
func();
}
}
}
function returnDistSelectIndex(OptionValue)
{
if (OptionValue == 1) {return 0;}
if (OptionValue == 3) {return 1;}
if (OptionValue == 5) {return 2;}
if (OptionValue == 10) {return 3;}
if (OptionValue == 15) {return 4;}
if (OptionValue == 20) {return 5;}
if (OptionValue == 25) {return 6;}
if (OptionValue == 50) {return 7;}
if (OptionValue == 75) {return 8;}
if (OptionValue == 100){return 9;}
else {return 3;}
}
function buildURLCatLink(){
var c,l,a,t,s,z;
l=doc.swbgetcat.L.value;t=doc.swbgetcat.T.value;
s=doc.swbgetcat.S.value;a=doc.swbgetcat.A.value;
z=doc.swbgetcat.Z.value;
c=doc.swbgetcat.C.value;
if(doc.swbgetcat.SD){
var list = doc.swbgetcat.SD;
var strRadius = list.options[list.selectedIndex].value;
strRadius = strRadius;
}
return "&ST=2&C="+escape(c)+"&L="+ escape(l)+"&T="+escape(t)+"&S="+escape(s)+"&A="+escape(a)+"&SD="+strRadius +"&Z="+escape(z);
}
function buildURLKeywordLink()
{
var isDistance, kw,t,s,st,a,z;
if (doc.swbgetcat.ST){
if (doc.swbgetcat.ST.checked==false){
isDistance = false;
st=1;
}else{
isDistance = true;
st=2;
}
/*
if(doc.swbgetcat.ST.value=="2"){
isDistance = true;
st=2;
}
if(doc.swbgetcat.ST.value=="3"){
isDistance = false;
st=3;
}*/
}
kw=doc.swbgetcat.KW.value;
if(doc.swbgetcat.T){t=doc.swbgetcat.T.value;}
if(doc.swbgetcat.S){s=doc.swbgetcat.S.value;}
if(doc.swbgetcat.A){a=doc.swbgetcat.A.value;}
if(doc.swbgetcat.Z){z=doc.swbgetcat.Z.value;}
if(isDistance==false){ //search in
if (((navigator.appName == "Netscape") || (navigator.appName == "Microsoft Internet Explorer")) && (parseFloat(navigator.appVersion) >= 3.0)){
return "&ST="+escape(st)+"&KW="+escape(kw)+"&T="+escape(t)+"&S="+escape(s)+"&Z="+escape(z);
}else{
return "&KW=&T=&S=";
}
}else{ //search near
if(doc.swbgetcat.SD){
var list = doc.swbgetcat.SD;
var strRadius = list.options[list.selectedIndex].value;
strRadius = strRadius;
}
return "&ST="+escape(st)+"&KW="+escape(kw)+"&T="+escape(t)+"&S="+escape(s)+"&SD="+strRadius+"&Z="+escape(z);
}
}
function buildURLCatLinkSmall(){
//search in
if (((navigator.appName == "Netscape") || (navigator.appName == "Microsoft Internet Explorer")) && (parseFloat(navigator.appVersion) >= 3.0)){
return "&C="+escape(doc.YPFORM.C.value)+"&L="+ escape(doc.YPFORM.L.value)+"&T="+escape(doc.YPFORM.T.value)+"&S="+escape(doc.YPFORM.S.value)+"&ST="+escape(doc.YPFORM.ST.value)+"&Z="+escape(doc.YPFORM.Z.value);
}else{
return "&C=&L=&T=&S=";
}
}
function verifyWP() {
//-------Standard WP from validation-------
if (doc.WPFORM.L.value == ""){
alert("Please enter part of a Last Name.");
doc.WPFORM.L.focus();
doc.WPFORM.L.select();
return false;
}
if(doc.WPFORM.Z){
if ((doc.WPFORM.T.value != "") && (doc.WPFORM.S.value == "") &&doc.WPFORM.Z.value=="" ) {
alert("Please enter a state when searching in a city");
doc.WPFORM.S.focus();
doc.WPFORM.S.select();
return false;
}
}else{
if ((doc.WPFORM.T.value != "") && (doc.WPFORM.S.value == "")) {
alert("Please enter a state when searching in a city");
doc.WPFORM.S.focus();
doc.WPFORM.S.select();
return false;
}
}
return true;
}
function verifyYP() {
var sC = escape(doc.swbgetcat.C.value);
var sL = escape(doc.swbgetcat.L.value);
var sT = escape(doc.swbgetcat.T.value);
var sS = escape(doc.swbgetcat.S.value);
var sA = escape(doc.swbgetcat.A.value);
var sZ = escape(doc.swbgetcat.Z.value);
if(!doc.swbgetcat.ST.checked){
//search in
if ((sC == "") && (sL == "")) {
alert("Please enter a Category or Business Name.");
doc.swbgetcat.C.focus();
doc.swbgetcat.C.select();
return false;
}
if ((sZ=="") && (sS == "") && (sT !== "")){
alert("Please choose a State.");
doc.swbgetcat.S.focus();
doc.swbgetcat.S.select();
return false;
}
}else{
//search near
if (sT==""&&sS==""&&sZ=="") {
alert('Please enter a city and state or Zip when you select "Include surrounding areas".');
doc.swbgetcat.T.focus();
return false;
}
if (sT!=""&&sS==""&&sZ=="") {
alert('Please enter a state when searching in a city.');
doc.swbgetcat.S.focus();
doc.swbgetcat.S.select();
return false;
}
}
return true;
}
function toggleDropdown(chbx){
if(chbx.checked){
if (doc.all){
doc.all['dRadius'].style.display = "block";
}else if (doc.getElementById){
doc.getElementById('dRadius').style.display = "block";
}
}else{
if (doc.all){
doc.all['dRadius'].style.display = "none";
}else if (doc.getElementById){
doc.getElementById('dRadius').style.display = "none";
}
}
}
function verifyKeyword() {
var t=doc.swbgetcat.T.value;
var s=doc.swbgetcat.S.value;
var z=doc.swbgetcat.Z.value;
if(document.swbgetcat.KW.value==""){
alert("You must enter a Keyword or Phrase.");
doc.swbgetcat.KW.focus();
return false;
}
if( (doc.swbgetcat.ST.checked==true) || (doc.swbgetcat.ST.checked=="1")){
if(z=="" &&t=="" && s==""){
alert('Please enter a city and state or Zip when you select "Include Surrounding Area".');
doc.swbgetcat.T.focus();
return false;
}
if(z=="" && s==""){
alert("You must choose a State.");
doc.swbgetcat.S.focus();
doc.swbgetcat.S.select();
return false;
}
if(z=="" && t==""){
alert("You must choose a City.");
doc.swbgetcat.T.focus();
doc.swbgetcat.T.select();
return false;
}
}else{
if ((t != "") && (s == "")&& (z == "")){
alert("Please enter a state when searching in a city");
doc.swbgetcat.S.focus();
doc.swbgetcat.S.select();
return false;
}
}
}
function verifyKeywordSmall(){
//YPKeyword
if(doc.YPKeyword.KW.value==""){
alert("You must enter a Keyword or Phrase.");
doc.YPKeyword.KW.focus();
return false;
}
if( (doc.YPKeyword.ST.checked==true) || (doc.YPKeyword.ST.checked=="2")){
if(doc.YPKeyword.Z.value=="" && doc.YPKeyword.T.value=="" && doc.YPKeyword.S.value=="")
alert('Please enter a city and state or Zip.');
doc.swbgetcat.T.focus();
return false;
//alert('hi');
if(doc.YPKeyword.S.value=="" && doc.YPKeyword.Z.value==""){
alert("You must choose a State.");
doc.YPKeyword.S.focus();
doc.YPKeyword.S.select();
return false;
}
if(doc.YPKeyword.T.value=="" && doc.YPKeyword.Z.value==""){
alert("You must choose a City.");
doc.YPKeyword.T.focus();
doc.YPKeyword.T.select();
return false;
}
}
if (doc.YPKeyword.T.value != "" && doc.YPKeyword.S.value == ""){
alert("Please enter a state when searching in a city");
doc.YPKeyword.S.focus();
doc.YPKeyword.S.select();
return false;
}
}
function verifyYPsmall() {
if(!document.YPFORM.ST.checked){
//search in
if ((document.YPFORM.C.value == "") && (document.YPFORM.L.value == "")) {
alert("Please enter a Category or Business Name.");
document.YPFORM.C.focus();
return false;
}
if (((doc.YPFORM.S.value=="" && doc.YPFORM.Z.value=="") && ((document.YPFORM.C.value != "") || (document.YPFORM.T.value != "")))){
alert("Please choose a State.");
document.YPFORM.S.focus();
return false;
}
return true;
}else{
//search near
if ((document.YPFORM.C.value == "") && (document.YPFORM.L.value == "")) {
alert("Please enter a Category or Business Name.");
document.YPFORM.C.focus();
return false;
}
if (document.YPFORM.T.value == "") {
alert('Please enter a city and state when you select "Include Surrounding Areas".');
document.YPFORM.T.focus();
return false;
}
if (document.YPFORM.S.value == "") {
alert('Please enter a city and state when you select "Include Surrounding Areas".');
document.YPFORM.S.focus();
return false;
}
return true;
}
}
function buildURL(){
if (document.swbgetcat.ST.checked==false)
{
//search in
if (((navigator.appName == "Netscape") || (navigator.appName == "Microsoft Internet Explorer")) && (parseFloat(navigator.appVersion) >= 3.0))
{
return "&C="+escape(document.swbgetcat.C.value)+"&L="+ escape(document.swbgetcat.L.value)+"&T="+escape(document.swbgetcat.T.value)+"&S="+escape(document.swbgetcat.S.value)+"&A="+escape(document.swbgetcat.A.value)
}
else {
return "&C=&L=&T=&S="
}
}else{
//search near
return "&ST=2&C="+escape(document.swbgetcat.C.value)+"&L="+ escape(document.swbgetcat.L.value)+"&T="+escape(document.swbgetcat.T.value)+"&S="+escape(document.swbgetcat.S.value)+"&A="+escape(document.swbgetcat.A.value)
}
}
function hideAllRecent(typeOfCookie) {
if (doc.all){
doc.all['recentSearchCat'].style.display = "none";
doc.all['recentSearchPep'].style.display = "none";
doc.all['clearLinkYP'].style.display = "none";
doc.all['clearLinkWP'].style.display = "none";
DeleteCookie(typeOfCookie);
}else if (doc.getElementById){
doc.getElementById('recentSearchCat').style.display = "none";
doc.getElementById('recentSearchPep').style.display = "none";
doc.getElementById('clearLinkYP').style.display = "none";
doc.getElementById('clearLinkWP').style.display = "none";
DeleteCookie(typeOfCookie);
}
}
function hideRecentSearchs(typeOfCookie) {
if (doc.all){
doc.all['recentsearches'].style.display = "none";
}else if (doc.getElementById){
doc.getElementById('recentsearches').style.display = "none";
}
DeleteCookie(typeOfCookie);
}
function hideAllRecentYP(typeOfCookie) {
if (doc.all){
doc.all['clearLinkYP'].style.display = "none";
doc.all['recentSearchCat'].style.display = "none";
}else if (doc.getElementById){
doc.getElementById('clearLinkYP').style.display = "none";
doc.getElementById('recentSearchCat').style.display = "none";
}
DeleteCookie(typeOfCookie);
}
function hideAllRecentWP(typeOfCookie) {
if (doc.all){
doc.all['clearLinkWP'].style.display = "none";
doc.all['recentSearchPep'].style.display = "none";
DeleteCookie(typeOfCookie);
}else if (doc.getElementById){
doc.getElementById('clearLinkWP').style.display = "none";
doc.getElementById('recentSearchPep').style.display = "none";
DeleteCookie(typeOfCookie);
}
}
function hideAllRecentRL(typeOfCookie) {
if (doc.all){
doc.all['clearLinkRL'].style.display = "none";
doc.all['recentSearchRL'].style.display = "none";
DeleteCookie(typeOfCookie);
}else if (doc.getElementById){
doc.getElementById('clearLinkRL').style.display = "none";
doc.getElementById('recentSearchRL').style.display = "none";
DeleteCookie(typeOfCookie);
}
}
function hideAllRecentMaps(typeOfCookie) {
if (doc.all){
doc.all['clearLinkMAP'].style.display = "none";
doc.all['recentSearchMaps'].style.display = "none";
DeleteCookie(typeOfCookie);
}else if (doc.getElementById){
doc.getElementById('clearLinkMAP').style.display = "none";
doc.getElementById('recentSearchMaps').style.display = "none";
DeleteCookie(typeOfCookie);
}
}
function hideAllRecentDir(typeOfCookie) {
if (doc.all){
doc.all['clearLinkDir'].style.display = "none";
doc.all['recentSearchDir'].style.display = "none";
DeleteCookie(typeOfCookie);
}else if (doc.getElementById){
doc.getElementById('clearLinkDir').style.display = "none";
doc.getElementById('recentSearchDir').style.display = "none";
DeleteCookie(typeOfCookie);
}
}
function CheckTheBox(){
if ((SmartSearch !="")){
document.swbgetcat.ST.checked = false;
if (document.all){
document.all['dRadius'].style.display = "none";
}else if (document.getElementById){
document.getElementById('dRadius').style.display = "none";
}
}
}
function verifyKeywordSL()
{
if (document.swbgetcat.ST.value!="2") {
if(document.swbgetcat.KW.value=="")
{
alert("You must enter a Keyword or Phrase.");
document.swbgetcat.KW.focus();
return false;
}
}
else if (document.swbgetcat.LO.value=="")
{
alert("You must enter a Location.");
document.swbgetcat.LO.focus();
return false;
}
return true;
}
function chkSTVal()
{
if(document.swbgetcat.SD.selectedIndex == 0)
{
document.swbgetcat.ST.value = "1";
}
else
{
document.swbgetcat.ST.value = "2";
}
return true;
}
function verifyWPSL()
{
//-------Standard WP from validation-------
if (doc.WPFORM.NM.value == "")
{
alert("Please enter part of a Last Name.");
doc.WPFORM.NM.focus();
return false;
}
return true;
}
function verifyRSSL()
{
if(!checkPhone(document.RSform.PH.value))
{
alert("Please enter a valid phone number which could be 6-10 digits.");
document.RSform.PH.focus();
return false;
}
else
return true;
}
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()-. ";
// Minimum no of digits in a phone number.
var minDigitsInIPhoneNumber = 6;
function isInteger(s)
{ var i;
for (i = 0; i < s.length; i++)
{
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}
function stripCharsInBag(s, bag)
{ var i;
var returnString = "";
// Search through string's characters one by one.
// If character is not in bag, append to returnString.
for (i = 0; i < s.length; i++)
{
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) returnString += c;
}
return returnString;
}
function checkPhone(strPhone)
{
strPhone = trim(strPhone);
if (strPhone.charAt(0) == '1') strPhone = strPhone.substr(1);
var s=stripCharsInBag(strPhone,phoneNumberDelimiters);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}
function verifyReviseKeywordSL()
{
if( document.swbgetcat.KW.value=="" && document.swbgetcat.ST.value=="1" )
{
alert("You must enter a Keyword or Phrase.");
document.swbgetcat.KW.focus();
return false;
}
if(document.swbgetcat.LO.value=="")
{
document.swbgetcat.SD.selectedIndex = 0;
document.swbgetcat.ST.value = "1";
}
if(document.swbgetcat.SD.selectedIndex == 0)
{
document.swbgetcat.ST.value = "1";
}
else
{
document.swbgetcat.ST.value = "2";
}
return true;
}
function verifyMapFormSL()
{
if (document.MAPFORM.LO.value == "")
{
alert('Please enter a city, state or Zip.');
document.MAPFORM.LO.focus();
return false;
}
}
function reviseSearchDistSelectIndex(OptionValue)
{
if (OptionValue == 1) {return 1;}
if (OptionValue == 3) {return 2;}
if (OptionValue == 5) {return 3;}
if (OptionValue == 10) {return 4;}
if (OptionValue == 15) {return 5;}
if (OptionValue == 20) {return 6;}
if (OptionValue == 25) {return 7;}
if (OptionValue == 50) {return 8;}
if (OptionValue == 75) {return 9;}
if (OptionValue == 100){return 10;}
else {return 4;}
}
function getparam(searchfor)
{
var tmp1=unescape(window.location.search.substring(1).toLowerCase());
var tmp2=searchfor.toLowerCase();
var pos1=tmp1.indexOf('&' + tmp2 + '=');
if(pos1==0)
{
var pos1=tmp1.indexOf('?' + tmp2 + '=');
}
var pos2=tmp1.indexOf("&",pos1+1);
if(pos2<1) pos2 = tmp1.length+1;
if(pos1>-1 && pos2>1)
{
pos1=pos1+searchfor.length+2;
res=tmp1.substring(pos1,pos2);
}
else
{
res = '';
}
return res;
}
