 function open_window(url) { 
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=540,height=485'); 
} 
function print_window(url) { 
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=700,height=500'); 
} 
function mlsprint() {
	window.print();
	}
function virtual_window(url) { 
mywin = window.open(url,"win",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=600,height=400'); 
} 
function swapImage(id) {
    var thumb = document.getElementById(id);
    var photo = document.getElementById("mainPhoto");
    photo.src = thumb.src;
    photo.title = thumb.title;
}
function swaprentalImage(image) {
var photo = document.getElementById("mainPhoto");
photo.src = "http://www.puebloareahomes.com/images/rentals/full/res"+image+".jpg";
}

function startList() {
	if (document.all&&document.getElementById) {
		if(document.getElementById("nav")){
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
		}
	}
}
$(document).ready(function(){
    $(".thumbnails").click(function () {
        $("#timer").stopTime();
     // Gets the ID attribute of the item that was clicked                        
     var clicked_id = $(this).attr('id');
     // Gets the ID attribute of the item that is the currently selected item
     var current_id = $('.thumbnails').find('.current').parent('div').attr('id');
     //Hide the current content
     $('#'+current_id+'-lead').hide();
     $('#'+current_id+'-summary').hide();
     $('#'+current_id+'-shadow').hide();
     $('#'+current_id+'-image').hide();
     // Changes the current class to other on the current img
     $('.thumbnails').find('.current').removeClass("current").addClass("other").end();
     // Changes the other class to current on the clicked img
     $("#"+clicked_id+' img').removeClass("other").addClass("current").end();
     $('#'+clicked_id+'-lead').show();
     $('#'+clicked_id+'-summary').show();
     $('#'+clicked_id+'-shadow').show();
     $('#'+clicked_id+'-image').show();
     
    });
    
    
    $("#timer").everyTime("5s",function () {
                                           
    
    // Gets the ID attribute of the item that was clicked                        
     var clicked_id = $('#timer').attr('class');
     var current = clicked_id.replace('head','');
      // Gets the ID attribute of the item that is the currently selected item
     var current_id = (parseInt(current-1));
     if(current_id ==0) {
         current_id=3;
     }
     
     
     var next = (parseInt(current)+1);
     if(next > 3) {
        next=1; 
     }

     //Hide the current content
     // Changes the current class to other on the current img
     $('#head'+current_id+' img').removeClass("current").addClass("other")
     $('#head'+current_id+'-lead').hide();
     $('#head'+current_id+'-summary').hide();
     $('#head'+current_id+'-shadow').hide();
     $('#head'+current_id+'-image').hide();
     // Changes the other class to current on the clicked img
     $("#"+clicked_id+' img').removeClass("other").addClass("current").end();
     $('#'+clicked_id+'-lead').show();
     $('#'+clicked_id+'-summary').show();
     $('#'+clicked_id+'-shadow').show();
     $('#'+clicked_id+'-image').show();

     $("#timer").removeClass("head"+current).addClass("head"+next).end();
    });

});