/* jquery
----------------------------------------------- */
$(document).ready(function() {

	/*
	$('a[href^="http"]').not('[href^="http://115.146.38.10/"]').click(function() {
		window.open(this.href, '');
		return false;
	});
	$('a[href^="http"]').not('[href^="http://115.146.38.10/"]').addClass("exLink");
	*/
	//pdf
	$('a[href$=".pdf"]').click(function() {
		window.open(this.href, '');
		return false;
	});
	
	//link block
	$(".linkBlock li").click(function() {
		window.location = $(this).find("a").attr("href");
		return false;
	});

	//pageTop
	$("#pageTop a").click(function() {
		var targetOffset = $("#container").offset().top;
		$("html,body").animate({scrollTop: targetOffset}, 1000);
		return false;
	});
	
	//input focus
	$("#search").focus(function() {
        if($(this).val() == $(this).attr('defaultValue'))
            $(this).css('color', '#241A08').val('');
    }).blur(function() {
        if(jQuery.trim($(this).val()) == "") {
            $(this).css('color', '#C1B1AC').val($(this).attr('defaultValue'));
        }
    });
	
});


/* form
----------------------------------------------- */
window.onload = function() {
    if ( document.getElementById("btn2") ) {  
        with(document) {  
            getElementById("btn2").disabled = true;  
            getElementById("btn2").setAttribute("src","../contact/images/btn_check_off.gif");  
            getElementById("no").onclick = function() { bt_transrate(this,"btn2"); }  
            getElementById("yes").onclick = function() { bt_transrate(this,"btn2"); }  
        }  
        if ( document.getElementById("yes").checked ) {  
            bt_transrate(document.getElementById("yes"),"btn2");  
        }  
    }  
}  
  
function bt_transrate(obj,inp) {  
    var radioBT = obj.value;  
    var subBT = document.getElementById(inp);  
    if ( radioBT == "yes" ) {  
        with(document) {  
            subBT.disabled = false;  
            subBT.setAttribute("src","../contact/images/btn_check.gif");  
        }  
        return true;  
    }  
    if ( radioBT == "no" ) {  
        with(document) {  
            subBT.disabled = true;  
            subBT.setAttribute("src","../contact/images/btn_check_off.gif");  
        }  
        return true;  
    }  
}


/* icon_new
----------------------------------------------- */
kikan = 5;
icon = "<img src='http://115.146.38.10/common/icon_new.gif'>";
today = new Date();
upday = new Date();
function koushin(y, m, d) {
   upday.setFullYear(y);
   m = m - 1;
   upday.setMonth(m);
   upday.setDate(d);
   difference = today.getTime() - upday.getTime();
   difference = Math.floor(difference / (1000 * 60 * 60 * 24));
   if (difference < kikan) {
      document.write(icon);
   }
}
