$(document).ready(function() {
									
	$(".rollover").hover(function() {
		$('img', this).attr('src', $('img', this).attr('src').replace(/\./g, "_h."));
	}, function() {
		$('img', this).attr('src', $('img', this).attr('src').replace(/\_h/g, ""));
	});
	
	$(".over").hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); })
	
	$("a[href='#top']").click(function() { $("html, body").animate({ scrollTop: 0 }, 'slow'); return false; });
});

function resets(form) {
	$(':input', form).not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
}

function swf(m, d, w, h, p) {
	var sw = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+w+'" height="'+h+'" align="middle">';
	sw += '<param name="allowScriptAccess" value="sameDomain" />'; sw += '<param name="wmode" value="transparent" />';
	sw += '<param name="movie" value="'+m+'" />'; sw += '<param name="quality" value="high" />';
	sw += '<param name="menu" value="false" />'; sw += '<param name="Flashvars" value="'+p+'" />'; 
	sw += '<embed src="'+m+'" wmode="transparent" menu="false" align="middle" quality="high" '; sw += 'Flashvars="'+p+'" '; 
	sw += 'width="'+w+'" height="'+h+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	$("#" + d).html(sw);
}

var bnr = 0;
var delay = 5000;
var INT;
function initbnr() {
	$(".mbnr img").css({'z-index': 0});
	$(".mbnr img#t" + bnr).css({'z-index': 10});
	$(".mbnr a").hover(function() {
		var cur = bnr;
		bnr = $(this).attr('id').replace("tm", "");
		clearInterval(INT);
		if(bnr != cur) $(".mbnr img#t" + bnr).stop();
		slide(cur, bnr);
	}, function() {});
	$(".mbnr div").hover(function() {}, function() { INT = setInterval('playbnr()', delay); });
	INT = setInterval('playbnr()', delay);
}

function playbnr() {
	var cur = bnr;
	bnr ++;
	if(bnr > 5) bnr = 0;
	slide(cur, bnr);
}

function slide(cur, i) {
	if(cur != i) {
		$(".mbnr a").removeClass("sel");
		$(".mbnr a#tm" + i).addClass("sel");
		$(".mbnr img").css({'z-index': 0});
		$(".mbnr img#t" + cur).css({'z-index': 10});
		
		$(".mbnr img#t" + i).css({'opacity': 0});
		$(".mbnr img#t" + i).css({'z-index': 15});
		$(".mbnr img#t" + i).animate({'opacity': 1}, 1500);
	}
}
