
var sectionCount = 0;
var currentSection = 1;

function cycleimages(no) {
	$('#Image'+no).cycle({
		 timeout:4000,
		 pager:  '#imagenav'+no, 
		 pagerAnchorBuilder: function(idx, slide) { 
			return '#imagenav'+no+' li:eq(' + idx + ') a'; 
		 }   
	});
}



$(".overimage").mouseover ( function() {
  var s = $(this).find("img").attr("src");
	s = s.replace(".jpg", "over.jpg");
	 $(this).find("img").attr("src", s)		
}
).mouseout ( function() {
  var s = $(this).find("img").attr("src");
	s = s.replace("over.jpg", ".jpg");
	 $(this).find("img").attr("src", s)		
}
);

$(".changeimages").click(function() {
	var s = $(this).attr("id");
	s = s.replace("changeimages", "");
	
	$('#Image'+currentSection).hide();
	$('#imagenav'+currentSection).hide();
	$('#Image'+currentSection).cycle('stop');
	
	currentSection = parseInt(s);
	
	$('#Image'+currentSection).show();
	$('#imagenav'+currentSection).show();
	
	cycleimages(currentSection);		
});

$(document).ready(function() { 
  $('ul.sf-menu').superfish(); 	
	
	var iName = "Image";
	for (count=1;count<10;count++) {
		var j = $("#Image"+count);
		if (j.length==0) {
			sectionCount = count-1;
			break;			
		}
	}
	
	
	cycleimages("1");
}); 
 

