﻿$(document).ready(function(){
	var out = function(data){
		var xmlData = data.data.maxellshop;
		var tmpList;
		if(xmlData.length){
			tmpList = xmlData;
		}else{
			tmpList = [xmlData];
		}
		
		var output = '';
		for(var i = 0; i < tmpList.length; i++){
			var tmpItem = tmpList[i];
			var newItem = (tmpItem.isNew == 'yes') ? '<img src="index/img/new_icon.gif" width="16" height="6" alt="new" style=" margin-left: 3px;" />' : '';
			var target = tmpItem.url.target;
			target = (target == '' || !target) ? '_self' : target;
			var anchor = '<a href="' + tmpItem.url['#cdata-section'] + '" title="' + tmpItem.title + '" target="' + target + '">';
			
			output += '<li class="clearfix">';
			output += '<p class="rec-img">' + anchor + '<img src="' + tmpItem.src + '" width="58" height="58" alt="' + tmpItem.title + '" /></a></p>';
			output += '<div class="rec-txts">';
			
			output += '<p class="rec-title blue-link">' + anchor + tmpItem.title + '</a></p>';
			output += '<p class="rec-description">' + anchor + tmpItem.description + '</a></p>';
			output += '</div>';
			output += '</li>';
		}
		output += '';
		$('#maxellshop-div-list').html(output);
		$('.rec-img img').alphaOver();
	}
	
	var http = new JKL.ParseXML('index/xml/maxellshop.xml');
	http.async(out);
	http.parse();
});
