$(document).ready(function() {
  	
  	/*if ($(".posted_data").text() != 1) {
  	
  		$("#enquiry_form").css("height", "60px");
  	
  		$("#enquiry_form").hover(function() {
  	
  			$(this).css("height", "auto");
  			//$(this).animate({height: "130px"}, 200);
  	
  		},
  		function() {
  	
  			$(this).css("height", "60px");
  			//$(this).animate({height: "62px"}, 200);
  	
  		});
  		
  	}*/
  	
  	$("#main_phone").hide();
  	
  	$(".office .submit").click(function() {
  	
  		var link_location = $(this).parent().parent().attr("action");
  		location.href=link_location;
  		return false;
  	
  	});
  	
  	$("#enquiry_form .submit").click(function() {
  	
  		$(this).attr({value: "submitting..."});
  		/*$(this).attr({disabled: "disabled"});*/
  	
  	});
  	
  	/*$.get(document.URL + "/region-form.php", function(data) {
		
		$("#header h1").after(data);
	
	});
	
	$("#region-form select").live("click", function() {
		
		var ind = this.selectedIndex;
		if (ind == 0) { return; }
		var url = this.options[ind].value;
		document.location=url;

	
	}); */

 	function resizeMapAndSidebar() {
 	
 		var viewport_height;
 
 		// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 		if (typeof window.innerWidth != 'undefined') {
    		viewport_height = window.innerHeight
 		}
 
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 		else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
       		viewport_height = document.documentElement.clientHeight
 		}
 
 		// older versions of IE
 
 		else {
       		viewport_height = document.getElementsByTagName('body')[0].clientHeight
 		}
	
		if (viewport_height > 800) {
	
			$("#map_canvas").css("height", "500px");
			$("#map_handle").css("background-position", "left top");
			
		} else {
		
			$("#map_canvas").css("height", "300px");
			$("#map_handle").css("background-position", "left -19px");
		
		}
		
	}
	
	var browser=navigator.appName;
  	if (browser != "Microsoft Internet Explorer") {
  	
  		$("#map_holder").append("<div id=\"map_handle\"></div>");
  		$("#office #map_canvas").css({height: "150px"});
  	
  		if ($("body").attr("id") != "office"){
		
			resizeMapAndSidebar();
		
		}

  		window.onresize = function(event) {
    
    		resizeMapAndSidebar();
    
		}
	
	}
	
	$("#main_phone").fadeIn(3000).animate({fontSize: '22px'}, 500);
	
});
