//rollover
$(document).ready(function($) {
	var postfix = '_on';
	$('#rightmain a img, #pagetop_bt a img').not('[src*="'+ postfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(
			function() {
				img.attr('src', src_on);
			},
			function() {
				img.attr('src', src);
			}
		);
	});
});


//innerfade
$(document).ready(
	function(){
		$('ul#imageswitch').innerfade({
			speed: 4000,
			timeout: 8000,
			type: 'sequence'
            });
});


//contentsslider
$(document).ready(function(){
	$("#myController").jFlow({
		slides: "#slides",
		controller: ".jFlowControl", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "jFlowSelected",  // just pure text, no sign
		auto: true,		//auto change slide, default true
		width: "400px",
		height: "240px",
		duration: 400,
		prev: ".jFlowPrev", // must be class, use . sign
		next: ".jFlowNext" // must be class, use . sign
	});
});


//textresizer
$(document).ready(function() {
	if($.cookie('TEXT_SIZE')) {
		$('#contentsarea').addClass($.cookie('TEXT_SIZE'));
	}
	$('#resizer a').click(function() {
		var textSize = $(this).parent().attr('class');
		$('#contentsarea').removeClass('small medium large').addClass(textSize);
		$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
		return false;
	});
});




//lightbox
$(function() {  
  $('.gallery01 a').lightBox();  
}); 

$(function() {  
  $('.gallery02 a').lightBox();  
}); 

$(function() {  
  $('.gallery03 a').lightBox();  
}); 

$(function() {  
  $('#past2007 a').lightBox();  
}); 

$(function() {  
  $('#past2008 a').lightBox();  
}); 

$(function() {  
  $('#past2009 a').lightBox();  
}); 

$(function() {  
  $('#past2010 a').lightBox();  
}); 

$(function() {  
  $('#past2011 a').lightBox();  
}); 


//rightclick
$(document).ready(function(){
	$(document).bind("contextmenu",function(e){
		return false;
	});
});


//equalheight
function equalHeight(group) {
  tallest = 0;
  group.each(function() {
    thisHeight = $(this).height();
    if(thisHeight > tallest) {
      tallest = thisHeight;
    }
  });
  group.height(tallest);
}


$(document).ready(function(){
  equalHeight($(".block_inner_x3_01_wb"));
  equalHeight($(".block_inner_x2_01_wb"));
  equalHeight($(".block_x3_01_wb"));
});
