 /*
 /           _|
 / _|_|_|        _|_|_|
 / _|    _|  _|  _|    _|
 / _|    _|  _|  _|    _|
 / _|    _|  _|  _|    _|
 /
 / nin: access
*/

/**
 * messages.js
 *
 *
 */

var activetab = 0;
var earthTabs = {};

earthTabs.init = function() {
  $(document).ready(function(){		      
		      $("#tabs").tabs();
		      $("#tabs").tabs('select', 0);
		      
		      $('#tabs').bind('tabsselect', function(event, ui) {
					if(ui.index == 0) {
					  activetab = 0;
					  $('#t1 img').attr('src',"/images/access/geo_tab_auto_selected.gif");
					  $('#t2 img').attr('src',"/images/access/geo_tab_browse.gif");
					  earth.autoMode(true);
					}
					if(ui.index == 1) {
					  activetab = 1;
					  $('#t1 img').attr('src',"/images/access/geo_tab_auto.gif");
					  $('#t2 img').attr('src',"/images/access/geo_tab_browse_selected.gif");
					  earth.hideBrowseTip();
					  earth.autoMode(false);
					  browse.update();
					}
				      });
					       
		      $("#borders").change(function() {
					     earth.bordersLayer($("#borders").attr("checked"));
					   });
		      
		      $("#streets").change(function() {
					     earth.roadsLayer($("#streets").attr("checked"));
					   });
		      
		      $("#buildings").change(function() {
					       earth.buildingsLayer($("#buildings").attr("checked"));
					     });
					     
		      $('#golink').click(function() {
					   earth.search($('#searchbox').val());
					   });
					     
		      $("#searchform").submit(function() {
						earth.search($('#searchbox').val());
						return false;       
					      });
		      });
  
};

google.setOnLoadCallback(earthTabs.init);
		      
var browse = {};

browse.update = function() {
  setTimeout(earth.populateBrowse, 1500);
};
