//Avoid flash of unformated content 
//Use in combination with the no-js-blink class
//$('html').addClass('js');

$(document).ready( function()
{	

	$("#Main li:odd").css('margin-right', 0);
	$("#countrybox").hide();
	
	$("#global").toggle(
	  function () {
		$("#countrybox").show();
	  },
	  function () {
		$("#countrybox").hide();
	  }
	);
		 
	//画像置き換え
	$('.image-replace').jQIR();
	
	//ロールオーバー
	rn.imageRollover.init();
	
	if( jQuery.url != undefined ){
		if( jQuery.url.param("autodownload") ){
			window.setTimeout("rn.doDownload.start();", 200);
		}
	}

	
	
});




/*-----------------------------
 image RollOver
-----------------------------*/
rn = {};
rn.imageRollover =
{
	init: function(){
		
		this.preload();

		$(".rollover").hover(
			function () { $(this).find("img").attr( 'src', rn.imageRollover.newimage($(this).find("img").attr('src')) ); },
			function () { $(this).find("img").attr( 'src', rn.imageRollover.oldimage($(this).find("img").attr('src')) ); }
		);
	},

	preload: function(){
		$(window).bind('load', function() {
			$('.rollover').each( function( key, elm ) { $('<img>').attr( 'src', rn.imageRollover.newimage( $(this).find("img").attr('src') ) ); });
		});
	},

	newimage: function( src ){
		return src.substring( 0, src.search(/(\.[a-z]+)$/) ) + '_OV' + src.match(/(\.[a-z]+)$/)[0];
	},

	oldimage: function( src ){
		return src.replace(/_OV\./, '.');
	}
};
rn.doDownload =
{
	start: function(){
    if(typeof(installerPath) != 'undefined') {
  		window.location.href = installerPath;
    }
	}
};

