<!--  Styled Select Site Menus //-->

$(document).ready(function() {
        $('#selectlist1 select').styledSelect({zIndexApply: true});
          $('#selectlist1 div.styledSelect').click(function() {
            if ($('form#selectlist1 select').val()!= "unselected") {
              document.selectlist1.submit();
            }
          });
      });


$(document).ready(function() {
        $('#selectlist select').styledSelect({zIndexApply: true});
          $('#selectlist div.styledSelect').click(function() {
            if ($('form#selectlist select').val()!= "unselected") {
              document.selectlist.submit();
            }
          });
      });


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_controlShockwave(objStr,x,cmdName,frameNum) { //v3.0
  var obj=MM_findObj(objStr);
  if (obj) eval('obj.'+cmdName+'('+((cmdName=='GotoFrame')?frameNum:'')+')');
}


<!--  Slideshow Window //-->
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function ClearOptionsFastAlt(id)
{
	document.getElementById(id).innerHTML = "";
}


function launchViewer(filename,x,y)
	{	
		window.imagex=x;
		window.imagey=y;
		window.imagename=filename;
		viewer=window.open('../../../go_htm/st_joseph_michigan_hot_cars_cool_beaches/viewart/z.htm','VIEWER','scrollbars,status,resizable');
		viewer.opener=window;
		viewer.focus();
		return false;
	}
	
	
	
	
function appendMSConversionTracker() {

  dls.logout = function() {
    document.getElementById('sign-out-form').submit();
    return false;
  };

  dls.backgroundLoaded = false;

  dls.swapBackground = function(thumbSrc,src) {
    $('#background img:first').attr('src', thumbSrc);
    dls.loadBackground(src);
  };

  dls.loadBackground = function(src) {
    var img = new Image();
    dls.backgroundLoaded = false;
    $(img).
      load(function() {
        if (!dls.backgroundLoaded) dls.onBackgroundLoad($(img,true));
      })
      .attr('src', src);
    // load it right away if is in browser cache
    if (img.complete) {
      dls.backgroundLoaded = true;
      dls.onBackgroundLoad($(img),false);
    }
  };

  dls.onBackgroundLoad = function(img,animated) {
    var old = $('#background img:first');
    if (!animated) {
      $('<img/>').
        attr('src',img.attr('src')).
        appendTo('#background');
      old.remove();
      return;
    }
    var background = $('<img/>').
      hide().
      attr('src',img.attr('src')).
      appendTo('#background');
    background.fadeIn(300, function(){ old.remove(); });
  };

jQuery(function($){

  var countries = [];
  for (var country in dls.fte_cities) {
    if (dls.fte_cities.hasOwnProperty(country)) {
      countries.push(country);
    }
  }

  $.each(countries.sort().reverse(), function(i, country){
    var optgroup = $('<optgroup label="'+country+'"/>');
    $('#preferred_city').prepend(optgroup);
    $.each(dls.fte_cities[country], function(j, city){
      var option = $('<option value="'+city.id+'">'+city.name+'</option>');
      optgroup.append(option);
    });
  });

  $('#preferred_city').val(dls.preferredCity.id);

  $('#email[title]').each(function() {
    var $this = $(this);
    if ($this.val() === ''){
      $this.css("color",'#999');
      $this.val($this.attr('title'));
    }
    $this.focus(function() {
      $this.css("color",'black');
      if($this.val() === $this.attr('title')) {
        $this.val('');
      }
    });
    $this.blur(function() {
      if($this.val() === '') {
        $this.css("color",'#999');
        $this.val($this.attr('title'));
      }
    });
  });
  
  $('#fte').show();
});
}
