// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

$(document).ready(function(){  
  var section = document.location.pathname.slice(1).split("/")[0]
  if(section=="")
    section = "home"
  
  //$('img[@src$=.png]').pngfix()
  
  $('#' + section).addClass("at_page")
  
  /*if($('#map').length > 0 && GBrowserIsCompatible()) {
     var map = new GMap2(document.getElementById("map"));
     var point = new GLatLng(51.508048,-0.14205);
     map.setCenter(point, 14);
     map.addControl(new GSmallMapControl());
     map.addOverlay(new GMarker(point));
     map.openInfoWindow(map.getCenter(), document.getElementById("contactdetails"));
  }*/
  
  $('#home').cornerz({corners: "tl", radius: 20 })
  $('#labs').cornerz({corners: "tr", radius: 20 })
 
  $("#roundtop2").cornerz({corners: "tl tr", radius: 30, outer: true })
  $("#footer").cornerz({corners: "bl br", radius: 30, outer: true })

 $("[img~='/']").each(function() {
   var src = $(this).attr("img");
   $(this).html("<img src='" + src + "' />")
 })

  $('#header ul a').bigTarget({
  })
  
  $("a").focus(function() { 
      $(this).blur();
    })
  
})


function sendMail() {
  
  $("#button").hide();
  $("#ajax").fadeIn();
  
  $.get("/contact", {
      message: $('#message').val(),
      from:  $('#from').val()
    },
    function() {
      $("#ajax").parent().hide();
      $("#thankyou").fadeIn();
      $("input, textarea").css({color: "#aaa", border: "1px solid #ccc"})
    }
  )
  
  //replace("<img src='/images/ajax.gif' />") //.attr("disabled", true)
  
}

