$(document).ready(function() {
	$(".news_content a[href$=.jpg], .news_content a[href$=.png],.news_content a[href$=.gif],.news_content .imageframe a").fancybox({
			'hideOnContentClick': true,
			'titlePosition': 'over'	
	});	
	$("a#inline").fancybox({
		'hideOnContentClick': true
	});
	$("a.group").fancybox({
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'hideOnContentClick': true,
		'titlePosition': 'over'		
	});
});

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

$(document).ready(function(){
    var currentDate = new Date();
    $('.newmarkList').each(function(){
        var pass
             = 48;
        var content
             = '<img class="new" src="http://static.silver-and-gold.com/images/news/new.gif" alt="4日以内の新着ブログ記事" width="30" height="10" title="4日以内の新着ブログ記事" />';
        var newmarkAttr = $(this).attr('title');
        newmarkAttr = newmarkAttr.replace(/年|月|日|時|分/g,':');
        newmarkAttr = newmarkAttr.replace(/\s|秒.*/g,'');
        var time = newmarkAttr.split(":");
        var entryDate = new Date(time[0], time[1]-1, time[2], time[3], time[4], time[5]);
        var now = (currentDate.getTime() - entryDate.getTime())/(60*60*1000); 
        now = Math.ceil(now);
        if(now <= pass){
            $(this).after(content);
        }
    });
});

$(function(){
    $(".post_image img").hover(
    function(){
       $(this).fadeTo("normal", 0.7);
    },
    function(){
       $(this).fadeTo("normal", 1.0);
    });
});

$(function(){
	var conf = {
	className : 'hover',
	postfix : '_hover'
	};
	$('.'+conf.className).each(function(){
		this.originalSrc = this.src;
		this.rolloverSrc = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/, conf.postfix+"$1");
		preloadImage(this.rolloverSrc);
	}).hover(function(){
		this.src = this.rolloverSrc;
	},function(){
		this.src = this.originalSrc;
	});
  
});

preloadedImages = [];
function preloadImage(url){
	var p = preloadedImages;
	var l = p.length;
	p[l] = new Image();
	p[l].src = url;
}
