<!-- Hide from old browsers

function OM_init() {
  var preloadImgStr;
  preloadImgStr = '/images/menu-find2.jpg';
  preloadImgStr += '/images/menu-blog2.jpg';
  preloadImgStr += '/images/menu-faq2.jpg';
  preloadImgStr += '/images/menu-about2.jpg';
  preloadImgStr += '/images/menu-news2.jpg';
  preloadImgStr += '/images/menu-list2.jpg';
  MM_preloadImages(preloadImgStr);
}

window.onload = OM_init;

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Activates ActiveX Control For Flash File
function CreateControl(DivID, CLSID, ObjectID, WIDTH, HEIGHT, URL, QUALITY) {
  d = document.getElementById(DivID);
  if (navigator.appName == "Microsoft Internet Explorer") {
    if (DivID == "urflick") {
      d.innerHTML = '<object type="application/x-shockwave-flash" data="http://www.urflick.com/scripts/vs_urFlickPlayer.swf" classid="' + CLSID + '" id="' + ObjectID + '" width="' + WIDTH + '" height="' + HEIGHT + '"><param name="FlashVars" value="vid=' + URL + '"><param name="movie" value="http://www.urflick.com/scripts/vs_urFlickPlayer.swf" /><param name="quality" value="' + QUALITY + '" /></object>';
    }
    else { // youtube
      d.innerHTML = '<object type="application/x-shockwave-flash" data="' + URL + '" classid="' + CLSID + '" id="' + ObjectID + '" width="' + WIDTH + '" height="' + HEIGHT + '"><param name="movie" value="' + URL + '" /><param name="quality" value="' + QUALITY + '" /></object>';
    }
  }
}

// swaps zip search box with city/state search box and vice versa
function OM_swapSearchZipCity(id, idZipCity, idLink) {
  var a = document.getElementById(idZipCity);
  var b = document.getElementById(idLink);
  var textStr = '';
  
  if (id == 'city') {
    textStr = '<input name="searchCity" id="searchCity" value="enter city" tabindex="2" size="10" maxlength="25" onclick="clearSearchCity(this.name);" onblur="clearSearchCity(this.name);" />';
    textStr += '&nbsp;';
    textStr += '<select name="searchState" id="searchState" tabindex="3">';
    textStr += '<option value="" selected="selected">--</option>';
    textStr += '<option value="AK">AK</option>';
    textStr += '<option value="AL">AL</option>';
    textStr += '<option value="AR">AR</option>';
    textStr += '<option value="AZ">AZ</option>';
    textStr += '<option value="CA">CA</option>';
    textStr += '<option value="CO">CO</option>';
    textStr += '<option value="CT">CT</option>';
    textStr += '<option value="DC">DC</option>';
    textStr += '<option value="DE">DE</option>';
    textStr += '<option value="FL">FL</option>';
    textStr += '<option value="GA">GA</option>';
    textStr += '<option value="HI">HI</option>';
    textStr += '<option value="IA">IA</option>';
    textStr += '<option value="ID">ID</option>';
    textStr += '<option value="IL">IL</option>';
    textStr += '<option value="IN">IN</option>';
    textStr += '<option value="KS">KS</option>';
    textStr += '<option value="KY">KY</option>';
    textStr += '<option value="LA">LA</option>';
    textStr += '<option value="MA">MA</option>';
    textStr += '<option value="MD">MD</option>';
    textStr += '<option value="ME">ME</option>';
    textStr += '<option value="MI">MI</option>';
    textStr += '<option value="MN">MN</option>';
    textStr += '<option value="MO">MO</option>';
    textStr += '<option value="MS">MS</option>';
    textStr += '<option value="MT">MT</option>';
    textStr += '<option value="NC">NC</option>';
    textStr += '<option value="ND">ND</option>';
    textStr += '<option value="NE">NE</option>';
    textStr += '<option value="NH">NH</option>';
    textStr += '<option value="NJ">NJ</option>';
    textStr += '<option value="NM">NM</option>';
    textStr += '<option value="NV">NV</option>';
    textStr += '<option value="NY">NY</option>';
    textStr += '<option value="OH">OH</option>';
    textStr += '<option value="OK">OK</option>';
    textStr += '<option value="OR">OR</option>';
    textStr += '<option value="PA">PA</option>';
    textStr += '<option value="RI">RI</option>';
    textStr += '<option value="SC">SC</option>';
    textStr += '<option value="SD">SD</option>';
    textStr += '<option value="TN">TN</option>';
    textStr += '<option value="TX">TX</option>';
    textStr += '<option value="UT">UT</option>';
    textStr += '<option value="VA">VA</option>';
    textStr += '<option value="VT">VT</option>';
    textStr += '<option value="WA">WA</option>';
    textStr += '<option value="WI">WI</option>';
    textStr += '<option value="WV">WV</option>';
    textStr += '<option value="WY">WY</option>';
    textStr += '</select>';
    textStr += '&nbsp;<input name="id_srchFrmBtn_Go" id="id_srchFrmBtn_Go" tabindex="4" value="Go" type="submit" />';
    
    a.innerHTML = textStr;
    b.innerHTML = '<a href="OM_swapSearchZipCity(\'zip\',\'searchZipCity\',\'searchZipCityLink\'); return false;" onclick="OM_swapSearchZipCity(\'zip\',\'searchZipCity\',\'searchZipCityLink\'); return false;">SEARCH BY ZIP</a>';
  }

  if (id == 'zip') {
    textStr = '<input id="searchZip" name="searchZip" type="text" value="zip" maxlength="5" size="5" onclick="clearSearchZip(this.name);" onblur="clearSearchZip(this.name);" />';
    textStr += '&nbsp;<input name="id_srchFrmBtn_Go" id="id_srchFrmBtn_Go" value="Go" type="submit" />';
    
    a.innerHTML = textStr;
    b.innerHTML = '<a href="javascript:OM_swapSearchZipCity(\'city\',\'searchZipCity\',\'searchZipCityLink\'); return false;" onclick="OM_swapSearchZipCity(\'city\',\'searchZipCity\',\'searchZipCityLink\'); return false;">SEARCH BY CITY</a>';
  }
}

// clears zip textbox when clicked on
function clearSearchZip(id) {
  var a = document.getElementById(id);
  
  if (a.value=='zip') {
    a.value='';
  } 
  //else if (a.value=='') {
  //  a.value='enter zip';
  //}
}

// clears city textbox when clicked on
function clearSearchCity(id) {
  var a = document.getElementById(id);
  
  if (a.value=='enter city') {
    a.value='';
  } 
  //else if (a.value=='') {
  //  a.value='enter city';
  //}
}

function openPop(url, width, height) {
    newWindow=window.open(url,'terms','location=no,toolbar=no,scrollbars=yes,directories=no,width='+width+',height='+height+',resizable');
    return false;
}

// swaps zip search box with city/state search box and vice versa
function OM_swapSearchCityCountry(id, idZipCity, idLink,countryID) {

  var a = document.getElementById(idZipCity);
  var b = document.getElementById(idLink);
  a.innerHTML = '';
  b.innerHTML = '';
  var textStr = '';
  if (countryID == 'USA') { //USA
  OM_swapSearchZipCity('city','searchZipCity','searchZipCityLink'); return false;
  } else if (countryID == 'Canada') { //Canada
     if (id == 'city') {
    //textStr = '<input name="searchCity" id="searchCity" value="enter city" tabindex="2" size="10" maxlength="25" onclick="clearSearchCity(this.name);" onblur="clearSearchCity(this.name);" />';
    //textStr += '&nbsp;';
    textStr += '<select name="searchState" id="searchState" tabindex="3">';
    textStr += '<option value="" selected="selected">--</option>';
    textStr += '<option value="AB">AB</option>';
    textStr += '<option value="BC">BC</option>';
    textStr += '<option value="MB">MB</option>';
    textStr += '<option value="NB">NB</option>';
    textStr += '<option value="NF">NF</option>';
    textStr += '<option value="NT">NT</option>';
    textStr += '<option value="NS">NS</option>';
    textStr += '<option value="NU">NU</option>';
    textStr += '<option value="ON">ON</option>';
    textStr += '<option value="PE">PE</option>';
    textStr += '<option value="QC">QC</option>';
    textStr += '<option value="SK">SK</option>';
    textStr += '<option value="YT">YT</option>';
    textStr += '</select>';
    textStr += '&nbsp;<input name="id_srchFrmBtn_Go" id="id_srchFrmBtn_Go" tabindex="4" value="Go" type="submit" />';
    
    a.innerHTML = textStr;
    b.innerHTML = '';
    }
    
  } else { //Other countries
    if (id == 'city') {
    textStr = '<input name="searchCity" id="searchCity" value="enter city" tabindex="2" size="10" maxlength="25" onclick="clearSearchCity(this.name);" onblur="clearSearchCity(this.name);" />';
    textStr += '<input type="hidden" name="searchState" id="searchState" value="" />';
    textStr += '&nbsp;<input name="id_srchFrmBtn_Go" id="id_srchFrmBtn_Go" tabindex="4" value="Go" type="submit" />';
    
    a.innerHTML = textStr;
    b.innerHTML = '';
    }
  }
    
}

function validate_form(f)
{
  if(f.searchCountry.value == "Canada") {
    if(eval(f.searchState)) {
      var state = f.searchState.value;
      if(state == '') {
        alert("Please select a province");
        return false;
      }
    }   
  }
  if(f.searchCountry.value == "USA") {
    
    if(testIsValidObject(f.searchCity)) {
      //city validation if field exist
      if(testIsValidObject(f.searchCity)) {
        var city = f.searchCity.value;
        if(city == 'enter city' || city == '') {
          alert("Please enter a city");
          return false;
        }
      }
      
      //state validation if field exist
      if(testIsValidObject(f.searchState)) {
        var state = f.searchState.value;
        if((!state != '')) {
          alert("Please select a state");
          return false;
        }
      }
    } else {
    
      if(testIsValidObject(f.searchZip)) {
        var zip = f.searchZip.value;
        if(zip.length != 5 || isNaN(zip)) {
          alert("Please enter a valid zipcode");
          return false;
        }
      }
    }
    
    
  }

  return true;
}

function testIsValidObject(objToTest) {
  if (null == objToTest) {
    return false;
  }
  if ("undefined" == typeof(objToTest) ) {
    return false;
  }
  return true;
}

function searchValidateZip(fieldname,type) {
  //type: zipcode, city, state
  //fieldname: name of form field
  //use: onsubmit="return searchValidateZip(document.searchForm2.searchZip,'zipcode')"
  var v = fieldname.value;
  if(v.length != 5 || isNaN(v)) {
    alert("Please enter a valid zipcode");
    fieldname.focus();
    return false;
  }
  return true;
}

function regionJump(v) {
	if(v != '')
		location=v;	
}

// -->


