
// forked from h2ham's "fontsize change" http://jsdo.it/h2ham/font-size
jQuery(function($){
  //変数にクッキー名を入れる
  var history = $.cookie('fontSize');
  
  //適用する箇所を指定。今回は部分的に#test内のpに
  var elm = $('body');
  
  //変数が空ならfontMを、空でなければクッキーに保存しておいたものを適用
  if(!history){
    elm.addClass('fontM');
    $('#fontM').addClass('active');
  }else{
    elm.addClass(history);
    $('#'+history).addClass('active');
  }
  
  //ボタンをクリックしたら実行
  $('li','#fontChange').click(function(){
    
    //activeでないボタンだった場合のみ動作
    if(!$(this).hasClass('active')){
      
      //現在activeのついているclassを削除
      $('.active').removeClass('active');
      
      //クリックしたボタンをactive
      $(this).addClass('active');
      
      //クリックした要素のID名を変数にセット
      var setFontSize = this.id;
      
      //クッキーに変数を保存
      $.cookie('fontSize', setFontSize, { expires : 30, path : '/' });
      
      //一度classを除去して、変数をclassとして追加
      elm.removeClass().addClass(setFontSize);
    }
  });
});

$(document).ready(function() {
		// Fix background images on all TD elements
	//$("table td").pngfix();
	//$("div#shinsaiMsg > img").pngfix();
	// Fix background images on all A elements
	//$("a").pngfix();
	//$("h1 > img").pngfix();
	//$("div#contents").pngfix();
	//$("div#saveTop").pngfix();
	
	
	// Fix all inline PNG images and the element #container with the custom sizingMethod of "scale"
	//$("img[@src$=png], #container").pngfix({
	//	sizingMethod: "scale"
	//});
	//$("img[@src$=png]").pngfix();
	//$("img[@src$=png], h1").pngfix();
	
	//$.miseAlphaImageLoader("sdsd");
	
	//$("#n-home").pngfix();
	//$("#n-concept").pngfix();
	
	if( $.browser.msie && $.browser.version == 6 ){
		$("#philosophy h1").html('<h1><img src="../common/images/h1_plilosophy_ie6.png" alt="企業理念／代表ごあいさつ" width="970" height="87" /></h1>');
		$("#company h1").html('<h1><img src="../common/images/h1_company_ie6.png" alt="会社概要" width="970" height="87" /></h1>');
		$("#business h1").html('<h1><img src="../common/images/h1_business_ie6.png" alt="事業領域" width="970" height="87" /></h1>');
		$("#rd h1").html('<h1><img src="../common/images/h1_rd_ie6.png" alt="研究開発" width="970" height="87" /></h1>');
		$("#recruit h1").html('<h1><img src="../common/images/h1_recruit_ie6.png" alt="採用情報" width="970" height="87" /></h1>');
		$("#about h1").html('<h1><img src="common/images/h1_about_ie6.png" alt="このサイトについて" width="970" height="87" /></h1>');
		$("#inquiry h1").html('<h1><img src="common/images/h1_inquiry_ie6.png" alt="お問い合わせ" width="970" height="87" /></h1>');
		$("#iso h1").html('<h1><img src="common/images/h1_iso_ie6.png" alt="ISO14001認証取得" width="970" height="87" /></h1>');
		$("#privacy h1").html('<h1><img src="common/images/h1_privacy_ie6.png" alt="プライバシーポリシー" width="970" height="87" /></h1>');
		$("#sitemap h1").html('<h1><img src="common/images/h1_sitemap_ie6.png" alt="サイトマップ" width="970" height="87" /></h1>');
		$("#topics h1").html('<h1><img src="../common/images/h1_topics_ie6.png" alt="トピックス・更新情報" width="970" height="87" /></h1>');
		$("#topPage h1").html('<h1><img src="images/main_img_ie6.jpg" alt="水の新しい価値を創造し、 自然環境と都市環境の調和を目指し、 社会の発展に貢献します。" width="960" height="294" /></h1>');
		$("#popup #contentsTop").html('<div><img src="../common/images/contents_top_ie6.png" alt="" width="690" height="10" /></div>');
	}
	
	//ポップアップウインド設定
	$(function() {
		$(".popup").click(function(){
			window.open(this.href, "popwindow","width=740,height=700,resizable=yes,scrollbars=yes,location=yes,menubar=yes");
			return false;
		});
	});
	
	//_blankウインドクラス設定
	$(".blank").click(function(){
　　　　window.open(this.href,'_blank');
　　　　　　return false;
　　});

	//スムーススクロール
	$(function() {
	$('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var sclpos = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
});


});


