/* ---

R-co.ltd
jquery1.4 common file.

--------------------------------------- */

/* ---

--------------------------------------- */

$(document).ready(function(){
	
	// open new window.
	$(function() {
		$('a[href^="http://"]').click(function() {
			this.target = "_blank";
			//window.open(this.href, '');
			//return false;
		});
		$('a[href^="../pdf"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="pdf/"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="../blog"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="blog/"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="../nzoom"]').click(function() {
			window.open(this.href, '');
			return false;
		});
	});

	// web catalog image change
	$(document).ready(function(){
		$(function(){
			$(".catNavi li").click(function(){
				if( $('.catNavi li').hasClass("select") ) {
					$('.catNavi li').removeClass("select");
				}
				$(this).addClass("select")
				
				$("#main img").attr("src",$(".catNavi li.select a").attr("href"));
				return false;
			});
		});
	});

	jQuery(function() {

		jQuery.getFeed({
/*			url: 'http://www.r-co.jp/satisfaction/proxy.php?url=http://www.satisfaction.jp/blog/feeds/rss2.0.xml',*/
			url: 'http://www.satisfaction.jp/blog/feeds/rss2.0.xml',
			success: function(feed) {

				var html = '';

				html += '<dl>'

				for(var i = 0; i < feed.items.length && i < 4; i++) {

					var item = feed.items[i];
					var date = item.updated;
					data = date.split(" ");
					var yy = data[3];
					var mm = data[2];
					switch(mm){
						case "Jan":
							mm = "01";
							break;
						case "Feb":
							mm = "02";
							break;
						case "Mar":
							mm = "03";
							break;
						case "Apr":
							mm = "04";
							break;
						case "May":
							mm = "05";
							break;
						case "Jun":
							mm = "06";
							break;
						case "Jul":
							mm = "07";
							break;
						case "Aug":
							mm = "08";
							break;
						case "Sep":
							mm = "09";
							break;
						case "Oct":
							mm = "10";
							break;
						case "Nov":
							mm = "11";
							break;
						case "Dec":
							mm = "12";
							break;
						default:
							mm
					}
					var dd = data[1];
					html += '<dt>'
					+ yy + '.' + mm + '.' + dd
					+ '<\/dt>';

					html += '<dd>'
					+ '<a href="'
					+ item.link
					+ '">'
					+ item.title
					+ '<\/a>'
					+ '<\/dd>';
				}

				html + '<\/dl>'

				jQuery('#blogup').append(html);
			}    
		});
	});

});