
// hasegawahiroshi.jp
// jquery.js

$(function(){

	// search input
	$('form.searchform input').focus( function() {
		if (this.value=='検索') this.value='';
	});
	$('form.searchform input').blur( function() {
		if (this.value=='') this.value='検索';
	});
	
	// external link
	$('a[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});
	
	// tooltip
	$('#blog a').tipsy({gravity: 's'});

	// home easing
	$("header nav ul").mouseover(function(){
		$(this).stop().animate(
			{marginTop:-5},
			{duration: 1000, easing: 'easeOutElastic'}
		)
	});
	$("header nav ul").mouseout(function(){
		$(this).stop().animate(
			{marginTop:-30},
			{duration: 1000, easing: 'easeOutBounce'}
		)
	});

	// scroll
	$('.pageup a').click(function(){
			$.scrollTo("#header", 400);
			return false;
	});

	// link
	$('#mainmenu a').hover(
	function () {
		$(this).stop().animate({ color: "#3C3733" }, 300 )
	},
	function () {
		$(this).stop().animate({ color: "#EBEAEA" }, 200 )
	});
	
	$('.banner a img').hover(
	function () {
		$(this).stop().animate({ opacity: "0.7" }, 300 )
	},
	function () {
		$(this).stop().animate({ opacity: "1" }, 200 )
	});

	$("a.gslsubwin").click(function(){
		window.open('https://gsl-co2.com/mark/license.php?siteh=http://hasegawahiroshi.jp/', '_blank', 'width=500,height=625,resizable=no,status=0');
		return false;
	});
	
});

// canvas

window.onload = function() {

	var canvas = document.getElementById('crowline');
	if ( ! canvas || ! canvas.getContext ) return false;
	var ctx = canvas.getContext('2d');
	ctx.beginPath();
	ctx.moveTo(250, 0);
	ctx.bezierCurveTo(170, 160, 70, 185, 4, 132);
	ctx.moveTo(4, 132);
	ctx.bezierCurveTo(0, 128, 2, 150, 2, 150);
	ctx.strokeStyle = "#3C3733";
	ctx.lineWidth = "0.5";
	ctx.stroke();

};

