// JavaScript Document
     

$(document).ready(function() {
	
	if ( $.browser.msie && (parseInt($.browser.version, 10))<= 7) {
   $("#flashBar").css({"height":"188px"});
   $("#flashBar").css({"opacity":"1"});
	$("#changeActiveFlashBar").hide();
  }else {

   	$('#flashBar').animate({ height:"188px", "opacity":"1"}, {queue:true,duration:1800, easing: 'easeInOutExpo'});
	$('.flashBarContent').delay(5000).eq(0).animate({ "margin-top":"-201px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	$('.flashBarContent').delay(8000).eq(0).animate({ "margin-top":"-401px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	$('.flashBarContent').delay(8000).eq(0).animate({ "margin-top":"-601px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	
	$('#changeActiveFlashBar li').click(function() {
		
		$('#changeActiveFlashBar li').css("color","#cac47f");
		$(this).css("color","#a29b55");
		
	});
	
	$('#changeActiveFlashBar li').eq(0).click(function() {
		$('.flashBarContent').eq(0).stop("false","false").animate({ "margin-top":"0px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	});
	
	$('#changeActiveFlashBar li').eq(1).click(function() {
		$('.flashBarContent').eq(0).stop("false","false").animate({ "margin-top":"-201px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	});
	
	$('#changeActiveFlashBar li').eq(2).click(function() {
		$('.flashBarContent').eq(0).stop("false","false").animate({ "margin-top":"-401px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	});
	$('#changeActiveFlashBar li').eq(3).click(function() {
		$('.flashBarContent').eq(0).stop("false","false").animate({ "margin-top":"-601px"}, {queue:true,duration:1500, easing: 'easeInOutExpo'});
	});
	
  }
  
	$('.scrollImgs').mouseenter(
            function() { $('.prevImg,.nextImg').css('display', 'block'); }
	);
	
	$('.scrollImgs').mouseleave(
            function() { $('.prevImg,.nextImg').css('display', 'none'); }
	);
	
  $('.prevImg').click(function() {
    currentImg = currentImg-1;
    if (currentImg < 0) currentImg = galleryArray.length-1;
    $('#img1').attr('src', galleryArray[currentImg]);
  });
  
  $('.nextImg').click(function() {
    currentImg = currentImg+1;
    if (currentImg > (galleryArray.length-1)) currentImg = 0;
    $('#img1').attr('src', galleryArray[currentImg]);
  });
  
  $('#propertyGallery a').click(function() {
    var destination = $('#img1').offset().top;
    
    if (destination < $("body").scrollTop() || destination < $("html").scrollTop() ) {
      $("html,body").animate({ scrollTop: destination}, 300 );
    }
  });
    

  // remove the side bar for older browser that don't render it correctly
 if(($.browser.msie) && (parseInt($.browser.version, 10) < 8)) {
   $('#branchinfo').hide();
  }else {
   $('#branchinfo').show(); 
  }  

  $('.branch a').click(function() {
  
  if(($.browser.msie) && (parseInt($.browser.version, 10) < 7)) {
	  $("#darkcolumn").hide();
		$("#darkcolumnfix").hide();
		$("#searchmap").css({"marginLeft":"150px"});
		$("#closebranch").css({"top":"0"});
		$("#branchinfo").show();
		
	  }else{
	  
		$("#darkcolumn").animate({ width: 0}, 1000);
		$("#darkcolumnfix").animate({width: 0}, 1000);
		$("#searchmap").animate({marginLeft: "150px"}, 1000 );
		$("#closebranch").delay(800).animate({top: "0px"},600 ,function(){$('#branchinfo').show();});
	  }
    
    // Return false to prevent anchor redirects
    return false;
  });
  $('#button').css({"cursor":"pointer"});
  $('#button').click(function() {
    $("div").clearQueue();

	if(($.browser.msie) && (parseInt($.browser.version, 10) < 7)) {
		$("#darkcolumn").show().css({"width":"255px"});
		$("#darkcolumnfix").show().css({"width":"255px"});
		$("#searchmap").css({"marginLeft":"410px"});
		$("#closebranch").css({"top":"-30px"});
	}else{
		$("#darkcolumn").animate({ width: 255}, 1100);
		$("#darkcolumnfix").animate({width:255}, 1100);
		$("#searchmap").animate({marginLeft: "410px"}, 1000 );
		$("#closebranch").animate({top: "-30px"}, 600 );
	}
	if(($.browser.msie) && (parseInt($.browser.version, 10) < 8)) {
	$('#branchinfo').hide();
	}
	
  });


  if ($.browser.mozilla) {
    $('#facebooklogo').mouseover(function() {
    	$('#facebooklogo').stop(true, false).animate({opacity: 1}, 500);
    });
	
    $('#facebooklogo').mouseout(function() {
    	$('#facebooklogo').stop(true, false).animate({opacity: 0.5}, 500);
    });
    
    $('#twitterlogo').mouseover(function() {
    	$('#twitterlogo').stop(true, false).animate({opacity: 1}, 500);
    });
    
    $('#twitterlogo').mouseout(function() {
    	$('#twitterlogo').stop(true, false).animate({opacity: 0.5}, 500);
    });
  }
});





  
$(document).ready(function() {
				
  $.getScript('harrisonmurray2011/js/mapHover.js');

});

	
function showbranch(toggleMe) {
  
  $(".branchinfotext").hide();
  $('#' + toggleMe).show();
	var selectedbranch = toggleMe;		

  // Return false to prevent anchor redirects
  return false;
}

function showsalediv() {
    $('#salediv').show();
    $('#rentdiv').hide();
}

function showrentdiv() {
    $('#rentdiv').show();
    $('#salediv').hide();
}

function preload(string) {
  // Removes JS errors from the pages
  return false;
}

function MM_showHideLayers(param1, param2, param3, param4, param5, param6) {
  // Removes JS errors from the pages
  return false;
}
