/*===========Hamid===============*/
var intervalId, curBnr=0;
	//image rotation
	$(document).ready(function(){
		if($('.homeBnnr img').length >0){
			$('.homeBnnr img:eq(0)').css('display','block');
			playBnr();
		}
	
	$('.bigPhoto li:eq(0)').css('display','block');
	$(".photoList li").click(
			function(){
				var crntIndex=$(".photoList li").index(this);
				var allBtns =$(".photoList li");
				var allTabs =$(".bigPhoto li");
				
				$(allTabs).hide();
				$(allTabs[crntIndex]).show();
				/*$(allBtns).removeClass("slctNewsTab");
				$(this).addClass("slctNewsTab");*/
			}
		);
		
	//for google map	
	if($('#map').length>0) map_initialize(address);
	
	
		
 });
 
 
var address='';

function map_initialize(){
// Creating a map


  geocoder = new google.maps.Geocoder();
  var latlng = new google.maps.LatLng(-34.397, 150.644);
  var myOptions = {
  zoom: 8,
  center: latlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  map = new google.maps.Map(document.getElementById("map"), myOptions);
  
  
  geocoder.geocode( { 'address': address}, function(results, status) {
  if (status == google.maps.GeocoderStatus.OK) {
  map.setCenter(results[0].geometry.location);
  var marker = new google.maps.Marker({
  map: map,
  position: results[0].geometry.location});
  } else {
  alert("Geocode was not successful for the following reason: " + status);
  }
  });

}
	
function pauseBnr(){clearInterval(intervalId)}
function playBnr(){intervalId=setInterval('startBnrPlay()',5000)}

function startBnrPlay(){
	var allButnsLen=$('.homeBnnr img').length;
	if(curBnr==(allButnsLen-1))
		curBnr=0;
	else
		curBnr++;
	changeBnr();
}

function changeBnr(){$('.homeBnnr img').fadeOut().eq(curBnr).fadeIn('slow')}



//for google map

var gdir;
function showAddress(){
	if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("mapCont"),
			{ size: new GSize(713,235) } );
			//map.setCenter(new GLatLng(37.4419, -122.1419), 13);
			geocoder1 = new GClientGeocoder();
		}
	address = "13 Abbotsbury Road,Weymouth,Dorset";
	if (geocoder1) {
		geocoder1.getLatLng(address,function(point) {
			if (!point) {
				alert(address + " not found");
				document.getElementById('mapCont').innerHTML='';
				}
			else {
				map.setCenter(point, 12);
				var marker = new GMarker(point,'B');
				map.addOverlay(marker);
				//marker.openInfoWindowHtml(address);
			}
		});
		}
	var customUI = map.getDefaultUI();
	customUI.controls.scalecontrol = false;
	map.setUI(customUI);
}
