
$(document).ready(function(){

			$(".loadcomments").click(function(){
				$(".commentbox").html("");
				var id = $(this).attr("id");
			    $("#user" + id).html("<img src=\"images/loading.gif\" /> Please wait. Loading Comments..");
				$.post("comments.php", { id: id },
				   function(data){
				$("#user" + id).html("");
						jQuery.facebox(data);
					
				   });			
			});
			
			$('#pbutton').click(function() { 
				if ($(this).attr("src") == "images/control_pause_blue.png"){
					$(this).attr("src","images/control_play_blue.png");
					clearTimeout(timer);
				} else if ($(this).attr("src") == "images/control_play_blue.png"){
					$(this).attr("src","images/control_pause_blue.png");
					paused = 0;
					clearTimeout(timer);
					timer = setInterval("nextphoto()",10000);
				}
			});

			$("#searchfield").addClass("unfocused");
			$("#searchfield").attr("value","Search HomeItUp");	
			$("#btnsearch").attr("disabled", true);
				
			$('#searchfield').keypress(function() { 
				var x = $(this).attr("value");
				
				if (x.length >= 3){
					$("#btnsearch").attr("disabled",false);
				}
				else {
					$("#btnsearch").attr("disabled",true);
				}
			});
			
			$('#searchfield').focus(function() { 
				if ($(this).attr("value") == "Search HomeItUp") {
					$(this).removeClass("unfocused");
					$(this).attr("value","");
				}
			});

			$('#searchfield').blur(function() { 
				if ($(this).attr("value") == "" || $(this).attr("value") == "Search HomeItUp") {
					$(this).addClass("unfocused");
					$(this).attr("value","Search HomeItUp");
					$("#btnsearch").attr("disabled",true);
				}
			});
			
			pic_xx = new Image(16,16);
			pic_xx.src = "images/control_pause_blue.png";

			pic_xx2 = new Image(16,16);
			pic_xx2.src = "images/control_play_blue.png";

			pic_xx3 = new Image(16,16);
			pic_xx3.src = "images/loading.gif";
			
			$(".sidebaritem").mouseover(function () {
				$(this).addClass($(this).attr("id"));
			});
	
			$(".sidebaritem").mouseout(function () {
				$(this).removeClass($(this).attr("id"));
			});

			$(".listing_link").mouseover(function () {
				$(this).addClass("pagehover");
			});
	
			$(".listing_link").mouseout(function () {
				$(this).removeClass("pagehover");
			});
			
			$(".page").mouseover(function () {
				$(this).addClass("pagehover");
			});
	
			$(".page").mouseout(function () {
				$(this).removeClass("pagehover");
			});
			
			$(".menuitem").mouseover(function () {
				$(this).addClass("menu_hover");
			});
	
			$(".menuitem").mouseout(function () {
				$(this).removeClass("menu_hover");
			});
	
		  });

		  function hideservice(){
				var province = $("#province :selected").text();

                            if (province){
                                //alert("Your service city will be your mailing address.");
			  $("#servicetr").css("visibility","visible")
			 $("#serviceloading").html("<img src=\"images/loading.gif\" />");
				$.post("areas.php", { province: province },
				   function(data){
                                $("#service").html("");
				   $("#service").html(data);
				   $("#serviceloading").html("");
                                $("#citylist").html("");
				   });} else { 
                                $("#service").html("");
				   $("#serviceloading").html("");
                                $("#citylist").html("");                                         
				   }				   
		  }
		  
		  function citylist(){
			  var city = document.memberform.service.value;
                        var province = $("#province").val();
			  document.getElementById("serviceloading").innerHTML = " <img src=\"images/loading.gif\" />";
				   $.post("cities.php", { city: city, province: province },
				   function(data){
				   document.getElementById("citylist").innerHTML = data;
				   document.getElementById("serviceloading").innerHTML = "";
				   });			  
		  }
		  
		  
window.onload = function()  
			{
				var h = ($("#layout_middle").height() + 10);
				$("#beige_div").height((h+12));
				$("#ivory_div").height(h);		
				$("#Home").attr("title","Home");
				$("#Interiors").attr("title","Interiors");
				$("#Exteriors").attr("title","Exteriors");
				$("#Services").attr("title","Services");
				
			}
			