function mouseOver(id, img) {
    document.getElementById(id).src="http://www.montmartredc.com/images/" + img + "_on.jpg";
}

var selectedType = "";

function clearDots() {
    mouseOut('center_1','center_image_1');
    mouseOut('center_2','center_image_2');
    mouseOut('center_3','center_image_3');
    mouseOut('center_4','center_image_4');
    mouseOut('center_5','center_image_5');
}

function setSelectedType(type) {
    selectedType = type;
    mouseOut('brunch_img','brunch_menu');
    mouseOut('lunch_img','lunch_menu');
    mouseOut('dinner_img','dinner_menu');
}

function mouseOut(id, img) {
    if (selectedType != id) {
        document.getElementById(id).src="http://www.montmartredc.com/images/" + img + "_off.jpg";
    }
}

function initImage() {
jQuery(function($) {
	var btns = $('td a[href=#]')
	btns.each(function(i, obj) {
		$(obj).find('img').attr('onclick', '')
		$(obj).click(function() {
			gotoImage(i+1)
			if (rotateTimer) clearTimeout(rotateTimer)
			
			return false

		})
	})
	for (var i=1;i<=5;i++) {
		var img = new Image()
		img.src = 'http://www.montmartredc.com/images/homepage_center_'+i+'.jpg'
	}
	$('#thephoto').data('curr', 1)
	rotateTimer = setTimeout('rotateImage2()', 6000)
})
}
function gotoImage(i) {
	var $ = jQuery
	if ($('#thephoto').data('curr') == i) return
	$('#thephoto').data('curr', i)
	$('#thephoto').fadeOut('fast', function() {
		var i = $(this).data('curr')
		$(this).attr('src', 'http://www.montmartredc.com/images/homepage_center_'+i+'.jpg').fadeIn('fast')
		clearDots()
		mouseOver('center_'+(i), 'center_image_'+(i))
	})
}
rotateTimer = null
function rotateImage2() {
	next = $('#thephoto').data('curr') + 1
	if (next > 5) next = 1
	gotoImage(next)
	if (rotateTimer) clearTimeout(rotateTimer)
	rotateTimer = setTimeout('rotateImage2()', 6000)
}



function stopChange() {}
function changeImage() {}
