// jquery用

$(document).ready(function(){
	$('a').each(function(){
		if(this.href.match(/\.jpg$/) || this.href.match(/\.gif$/) || this.href.match(/\.png$/)){
			this.rel = 'lightbox';
			this.href = this.href + '?lightbox=1';
		}
	});
	
	$('a[rel*=lightbox]').lightpop();
	
	$('#procutsLinks ul li:first-child').addClass('firstChild');
	$('#categoryList li:last-child').addClass("lastChild");
	$('#channelHeader .lNaviSub ul li:last-child').addClass("lastChild");
	$('#homeMainHead #toplink li:last-child').addClass("lastChild");
});

function initRollOverImages() {
	var image_cache = new Object();
	$("img.onimage").not("[src*='_on.']").each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on; },
			function() { this.src = imgsrc; }
		);
	});
}

$(function() {
 $('a.lightpop').lightpop({overlayBgColor:'#000',size:'new Array(640,480)' });
});

$(document).ready(initRollOverImages);