// jQuery Config
$(function(){
	var windowHeight;
	if (self.innerHeight) {    // all except Explorer
        windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
        windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
        windowHeight = document.body.clientHeight;
	}
	$("a.lightwindow").fancybox({'titleShow': false});
	$("a.album").fancybox({'titlePosition': 'inside'});
	$("a.iframe").fancybox({'titleShow': false, 'width': 525, 'height': windowHeight});
	$("a.iframe260").fancybox({'titleShow': false, 'width': 260, 'height': windowHeight, 'autoDimensions': false, 'overlayShow': false});
	$("a.iframe1000").fancybox({'titleShow': false, 'width': 1000, 'height': 1000, 'autoDimensions': false, 'overlayShow': false, 'type': 'iframe'});
	$("a.ifyoutube").fancybox({'titleShow': false, 'width': 640, 'height': 390, 'autoDimensions': false, 'overlayShow': false, 'type': 'iframe'});
	
	// Alert Message
	var $alert = $('#caution');
	if($alert.length)
	{
		var alerttimer = window.setTimeout(function () {
			$alert.trigger('click');
		}, 3000);
		$alert.animate({height: $alert.css('line-height') || '50px'}, 200)
		.click(function () {
			window.clearTimeout(alerttimer);
			$alert.animate({height: '0'}, 200);
		});
	}
	
	// Smooth Scroll
	$('a[href^=#]').click(function() {
     	 var speed = 400;
     	 var href= $(this).attr("href");
      	var target = $(href == "#" || href == "" ? 'html' : href);
      	var position = target.offset().top;
      	$($.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
      	return false;
	});
	
	// Hover
	$('a img, input.submit').hover(function(){
            $(this).stop(true, true).animate({ opacity: 0.8 }, 'fast');
        }, function(){
            $(this).stop(true, true).animate({ opacity: 1.0 }, 'fast');
    });
    
    // To Top Buttun
    $(window).scroll(function () {
      if ($(this).scrollTop() > 100) {
      	$('#totop').fadeIn();
      } else {
        $('#totop').fadeOut();
      }
    });
    
    // Close
    $('#close-btn').click(function() { $(this).parent().slideUp(); });

});



function pne_url2a(url) {
    var urlstr = url.replace("&amp;", "&");
    if (urlstr.length > 57) {
       urlstr = urlstr.substr(0, 57) + '...';
    }
    urlstr = urlstr.replace("&", "&amp;");
    document.write('<a href="'+url+'" target="_blank">'+urlstr+'</a>');
}
/*
TextFiledClassName_normal = 'text';
TextFiledClassName_focus  = 'text_focus';

Event.observe(window, 'load', setFocusClass, false);

function setFocusClass() {
	var TFs = $A(document.getElementsByClassName(TextFiledClassName_normal));
	TFs.each(function (node){
		node.TFclass = node.className;
		node.TFclass_onfocus = TextFiledClassName_focus;
		node.onfocus = function() { this.className = this.TFclass_onfocus; };
		node.onblur  = function() { this.className = this.TFclass; };
	});
}
*/
