$(function(){
	
	/*
	getRSS('#gazarRSS','http://www.gazar.org/rss.php?action=content');
	getRSS('#fist-row-second-column-content','http://news.gogo.mn/feed');
	getRSS('#soninRSS','http://sonin.mn/feed/');
	*/
	
	
	$('#fist-row-second-column-title a').each(function(){
		$(this).click(function(){
			$('#fist-row-second-column-title a.active').removeClass("active").addClass("inactive");
			$(this).removeClass("inactive").addClass("active");
			getRSS('#fist-row-second-column-content', $(this).attr("accesskey"));
			return false;
		});
	});
	$('#fist-row-third-column-title a').each(function(){
		$(this).click(function(){
			$('#fist-row-third-column-title .active').removeClass("active").addClass("inactive");
			$(this).removeClass("inactive").addClass("active");
			getRSS('#fist-row-third-column-content', $(this).attr("accesskey"));
			return false;
		});
	});
	
	$('#row3-menu a').each(function(){
		$(this).click(function(){
			$('#row3-menu a.active').removeClass("active").addClass("inactive");
			$(this).removeClass("inactive").addClass("active");
			$(this+" img").removeClass("thumb_img");
			getRSS('#row3-content', $(this).attr("accesskey"),'rss_video',12);
			return false;
		});
	});
	
	
	//search iinh
	$('#searchH a').each(function(){
		$(this).click(function(){
			$('#searchH a').each(function(){
				$(this).attr('class','inactiveS');
			}); //removeClass('activeS').addClass('inactiveS');
			$(this).attr('class','activeS');
			return false;
		});
	});
});
function getRSS(target_div,url,tpl_file,title_limit){
	
	$(target_div).html('<img src="images/loading.gif" align="left" hspace="5" /> мэдээллийг ачааллаж байна...<br clear="all">');
	if(!tpl_file){
		tpl_file = 'rss_short';
	}if(!title_limit){
		title_limit = 100;
	}
	$.ajax({
			type: "POST", url: "pms_xml.php?action=rss&url="+encodeURI(url), data: "tpl="+tpl_file+"&title_limit="+title_limit,
			complete: function(data){
				$(target_div).html(data.responseText+'<br clear="all" />');
			}
		 });
}
