$(document).ready(function(){
  ajaxTheContent();
  
  $('#email').focus(function() {
    if ($('#email').val() == 'Email') {
      $('#email').val('');
    }  
  });
  
  $('#email').blur(function() {
    if ($('#email').val() == '') {
      $('#email').val('Email');
    }  
  });
  
  $('#pwd').focus(function() {
    if ($('#pwd').val() == 'Password') {
      $('#pwd').val('');
    }  
  });
  
  $('#pwd').blur(function() {
    if ($('#pwd').val() == '') {
      $('#pwd').val('Password');
    }  
  });
  
  $('#s').focus(function() {
    if ($('#s').val() == 'Find a user') {
      $('#s').val('');
    }  
  });
  
  $('#s').blur(function() {
    if ($('#s').val() == '') {
      $('#s').val('Find a user');
    }  
  });
  
});
    
function doAjax()
{
  $("#example1title").get(0).innerHTML="Loading...";
  $.ajax({
  //IE likes to save stuff to its cache so here is a random url to prevent that from happening.    
  url: "/index.php/ajax/shoutbox_ajax/content/"+Math.random(),
  type: "GET",
  dataType: "html",
  timeout: 10000,
    success: function(html)
    {
    var arr;
    arr=html.split("|||||",2);
    fade("example1");
    $("#example1title").get(0).innerHTML=arr[0];
    $("#example1").get(0).innerHTML=arr[1];
    var tt = new TypingText(document.getElementById("example1"));
    tt.run();
    }
  });

}
function ajaxTheContent()
{
  if(firstload)
  {
    fade("example1");  
    $.ajax({
    //IE likes to save stuff to its cache so here is a random url to prevent that from happening.
    url: "/index.php/ajax/shoutbox_ajax/content/"+Math.random(),
    type: "GET",
    dataType: "html",
    timeout: 10000,
      success: function(html)
      {
      var arr;
      arr=html.split("|||||",2);
      $("#example1title").get(0).innerHTML=arr[0];
      $("#example1").get(0).innerHTML=arr[1];
      var tt = new TypingText(document.getElementById("example1"));
      tt.run();
      }
    });
    firstload=false;
  }
  else
  {
    fade("example1");
    setTimeout("doAjax()",3000);
  }
}
    
function closeBox()
{
  $("#googlemap").get(0).style.display="none";
  hold=false;
}
function showMap(id,cid)
{
  hold=true;
  $("#googlemap").css("width","0px");
  $("#googlemap").css("height","0px");            
  $("#googlemap").animate({width:"450px",height:"375px"},500);
  $("#googlemap").get(0).style.display="block";    
  $("#theframe").get(0).src="/index.php/ajax/googlemap_ajax/index/"+id;
  $("#thelink").get(0).href="/advisory/country/"+cid;      
  $("#cover").get(0).style.display="block";
}
