var current_image = 1;var rotate = true;$(document).ready(function() {	show_image();	setTimeout("tick()", 12000);});function tick() {	if (rotate) {		show_next_image();	}	setTimeout("tick()", 12000);}function bind_thumbnails() {	var thumbnails = '';	for (var i = 0; i < images.length; i++) {		if (current_image == (i+1)) {			thumbnails += '<a href="#" class="active" rel="'+(i+1)+'"><img src="'+images[i][1]+'" alt="" /></a>';		} else {			thumbnails += '<a href="#" rel="'+(i+1)+'"><img src="'+images[i][1]+'" alt="" /></a>';		}	}	$(".gallery_imgs").html(thumbnails);	$(".gallery_imgs a").click(function() {		turn_rotation(false);		setTimeout('turn_rotation(true)', 30000);		current_image = $(this).attr("rel");		show_image();		return false;	});}function show_next_image() {	if (current_image == images.length) {		current_image =  1;	} else {		current_image++;	}	show_image();}function turn_rotation(bool) {	rotate = bool;}function show_image() {	bind_thumbnails();	$("#selected-image").css({"background-image": "url("+images[current_image-1][0]+")", "background-repeat": "no-repeat"});	$(".gallery-title").html(images[current_image-1][2]);	$(".gallery-text").html(images[current_image-1][3]);	$("#selected-image").find("img").fadeOut(1000, function() {		$("#selected-image").find("img").attr("src", images[current_image-1][0]);		$("#selected-image").find("img").show();	});}