// blank
$(document).ready( function () {
    $(".blank").append('&nbsp;<span><img src="http://www1.tokyo-web-park.com/test_okome/global/images/icon_blank.gif" height="13" width="13" alt="" class="bordernone img_blank" /></span>');
    $(".blank img").css("vertical-align","top");
    $('.blank').click(function(){
        window.open(this.href, '_blank');
        return false;
    });
});

// self
$(document).ready( function () {
    $(".self").append('&nbsp;<img src="http://www1.tokyo-web-park.com/test_okome/global/images/icon_self.gif" height="13" width="13" alt="" class="bordernone img_self" />');
    $(".self img").css("vertical-align","top");
    $('.self').click(function(){
        window.open(this.href, '_self');
        return false;
    });
});

// pdf
$(document).ready( function () {
    $(".pdf").append('&nbsp;<img src="http://www1.tokyo-web-park.com/test_okome/global/images/icon_pdf.gif" height="15" width="16" alt="" class="bordernone" />');
    $(".pdf img").css("vertical-align","text-top");
    $('.pdf').click(function(){
        window.open(this.href, '_blank');
        return false;
    });
});



// IE PING FI
/* 置換する透過GIF画像 */
var blank=new Image();
blank.src='http://www1.tokyo-web-park.com/test_okome/global/images/blank.gif';

$(function() {
/* IE5.5、IE6かどうか判定 */
var badBrowser=(/MSIE ((5¥.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
if (badBrowser){
/* img要素のsrc属性の値で拡張子PNGのimg要素に対して透過PNGを対応させる */
$('img[src$=.png]').each(function() {
if (!this.complete) {
this.onload=function(){ fixPng(this) };
}else{
fixPng(this);
}
});
}
});
function fixPng(png) {
/* PNG画像のパスを取得 */
var src = png.src;
/* 幅と高さを設定 */
if (!png.style.width) { png.style.width = $(png).width(); }
if (!png.style.height) { png.style.height = $(png).height(); }
/* 透過GIF画像に置換 */
png.src = blank.src;
png.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')";
}


// pulldownmenu
  $(document).ready(function(){
		$("#nav-one li").hover(
			function(){ $("ul", this).fadeIn("fast"); }, 
			function() { } 
		);
	if (document.all) {
			$("#nav-one li").hoverClass ("sfHover");
		}
  });
  
	$.fn.hoverClass = function(c) {
		return this.each(function(){
			$(this).hover( 
				function() { $(this).addClass(c);  },
				function() { $(this).removeClass(c); }
			);
		});
	};	

/* input フォーカスを当てるとデフォルト文字列が消える */

$(function(){
    $("#searchInThisSite").focus(function() {
        if($(this).val() == $(this).attr('defaultValue'))
            $(this).css('color', '#000').val('');
    }).blur(function() {
        if(jQuery.trim($(this).val()) == "") {
            $(this).css('color', '#999').val($(this).attr('defaultValue'));
        }
    });
});

// rollover
function initRollOverImages() {
  var image_cache = new Object();
  $("img.on").each(function(i) {
    var imgsrc = this.src;
    var dot = this.src.lastIndexOf('.');
    var imgsrc_ro = this.src.substr(0, dot) + '_ro' + this.src.substr(dot, 4);
    image_cache[this.src] = new Image();
    image_cache[this.src].src = imgsrc_ro;
    $(this).hover(
      function() { this.src = imgsrc_ro; },
      function() { this.src = imgsrc; });
  });
}

$(document).ready(initRollOverImages);

//printer friendly
function replace_css(id,url){
  if(!document.getElementById) return false;
  var element = document.getElementById(id);
  if(!element || !element.cloneNode) return false;
  var new_node = element.cloneNode(true);
  new_node.href = url;
  element.parentNode.replaceChild(new_node,element);
  return true;
}

function changeCSS(){
  setTimeout("replace_css('npu','../global/css/print_def.css')",5000);
}

function changeCSS02(){
  setTimeout("replace_css('npu','../global/css/print_def.css')",100);
}

// scrolling page top
function backToTop() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
		if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
	if (x > 0 || y > 0) {
	window.setTimeout("backToTop()", 25);
	}
}





$(function () {
    $(".boxLink").click(function () {
        var boxLink = $(this).find("a");
        if (boxLink.attr("target") == "_blank") {
            window.open(boxLink.attr("href"));
        }
        else window.location = boxLink.attr("href");
        return false;
    });
    $(".boxLink").hover(function () {
        $(this).addClass("hover");
    }, function () {
        $(this).removeClass("hover");
    });
});


// random script 
this.randomtip = function(){
	var length = $("#tips li").length; // this is where we put the id of the list
	var ran = Math.floor(Math.random()*length) + 1;
	$("#tips li:nth-child(" + ran + ")").show();
};

$(document).ready(function(){	
	randomtip();
});


// 角丸
function initCorners() {
    var settings = {
      tl: { radius: 12 },
      tr: { radius: 12 },
      bl: { radius: 12 },
      br: { radius: 12 },
      antiAlias: true
    }
    curvyCorners(settings, "#paging-l, #paging-r,.bd_red");
  }

