
this.gotoUrl = function() {
  region = jq(".regions select").val();
  if (region == "") {
    return false
  }
  if (region == 'london') {
    district = jq(".londonregions select").val();
    extra = region+"/"+district
  } else {
    extra = region
  }
  //extra = region
  base_url = "/providers/regions/"
  window.location.href = base_url + extra
}

jq(document).ready(function() {
  
  jq(".londonregions,.regionSearch").hide();
  
  jq(".regions select").change(function() {
    if(jq(this).val()=='london') {
      jq(".londonregions").show().find('select').val('');
    } else {
      gotoUrl();
    }
  });
  
  jq(".londonregions select").change(function() {
    gotoUrl();
  })
  
  jq("map area").each(function() {
		jq(this).hover(function(e) {
		  jq(".mapselect img").attr('src', '/++resource++asap.providers.images/map-'+jq(this).attr('class')+'.png');
		}, function(e) {
		  jq(".mapselect img").attr('src', '/++resource++asap.providers.images/map.png');
		});
  })

  setInterval("carousel_rotate()", 8000);  
  jq('#carousel li:not(:first)').hide();
  
});

this.carousel_rotate = function() {
    jq('#carousel li:visible').fadeOut("slow");
    next = jq('#carousel li:visible').next();
    if (next.length) {
        next.fadeIn("fast");
    } else {
        jq('#carousel li:first').fadeIn("fast");
    }

}

