
/*******************
** rollover
**
*/

jQuery(document).ready(function($) {
	initSocialMediaButton();
	lmbrgnRollover();
});

function lmbrgnRollover() {
  var postfix = '_on';
  $('.rollover img,#gnav ul li img,.pnav li 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);
    $(this).parent().hover(
      function() {
        img.attr('src', src_on);
      },
      function() {
        img.attr('src', src);
      }
    );
  });
}

/*******************
** External Link Simple
**
*/

/*
$(document).ready( function(){
  $(".blank").click( function(){
    window.open( this.href, '_blank' );
      return false;
  });
});
*/

/*******************
** Smooth Scroll
**
*/

$(function(){
  $("a[href*='#']").easingScroll({
    easing: "easeOutExpo",
    duration: 800
  });
});

/*******************
** Popup Window
**
*/
$(function() {
	$(".popup").click(function(){
		window.open(this.href, "newWin","width=800,height=600,resizable=yes,scrollbars=yes");
		return false;
	});
});

/*******************
** PageSwitch
**
*/

/*$(function(){
	$('body').hide();
	$('body').fadeIn("slow");
});*/

/*******************
** Social Media Button
**
*/
function initSocialMediaButton() {
//	var url = document.URL;
	var url = encodeURIComponent(document.URL);
	var title = document.title;
	var mixiKey = "85014ff2e3ed2af397fa392a58c0a5110d120692";
	var html = "";
	html += "<li><a href=\"http://twitter.com/share?count=horizontal&amp;original_referer="+url+"&amp;text="+encodeURIComponent(title)+"&amp;url="+url+"\" onclick=\"window.open(this.href,'tweetwindow','width=550,height=450,personalbar=0,toolbar=0,scrollbars=1,resizable=1'); return false;\">";
	html += "<img src=\"/common/images/btn_twitter.gif\" alt=\"twitterで共有する\" />";
	html += "</a></li>";
	html += "<li><a href=\"http://www.facebook.com/share.php?u="+url+"\" onclick=\"window.open(this.href,'facebookwindow','width=550,height=450,personalbar=0,toolbar=0,scrollbars=1,resizable=1'); return false;\">";
	html += "<img src=\"/common/images/btn_facebook.gif\" alt=\"facebookで共有する\" />";
	html += "</a></li>";
	html += "<li><a href=\"javascript:void(0);\" onclick=\"window.open('http://mixi.jp/share.pl?u="+url+"&k="+mixiKey+"','share',['width=632','height=456','location=yes','resizable=yes','toolbar=no','menubar=no','scrollbars=no','status=no'].join(','));\">";
	html += "<img src=\"/common/images/btn_mixi.gif\" alt=\"mixiで共有する\" />";
	html += "</a></li>";
	$(".snSns ul").html(html);
};

