function NewsScroll(options,contentOption) {
	var vstart = 1;
	var hstart = 1;           
	var newsdom = options.dom;                                                        
	var lengthList = 0;
	var vScrollStep = 0;
	var hScrollStep = 0;
	//var thisDate = newsdom.find(".date").html().split("&nbsp;&nbsp;")[0];

	contentOption.offset = parseInt(contentOption.baseoffset);      
	contentOption.current_date_diff = 0;

	var resetSize = function () {                  
		lengthList = newsdom.find(".wrapperVScrollFloat li").length;
		vScrollStep = 0;
        if (newsdom.find(".wrapperVScrollFloat li").length != 0)
			hScrollStep = newsdom.find(".wrapperVScrollFloat li").get(0).offsetWidth; 
		newsdom.find(".wrapperVScrollFloat li").each(function () {
			vScrollStep += $(this).get(0).offsetHeight;
		})
		newsdom.find(".wrapperVScrollFloat").css("height",(vScrollStep*2)+"px");
		newsdom.find(".wrapperHScrollFloat").css("width",(hScrollStep*2)+"px");
		
		newsdom.find(".wrapperVScroll").css("height",(vScrollStep)+"px");
		newsdom.find(".wrapperVScroll").css("width",(hScrollStep)+"px");
		newsdom.find(".wrapperVScrollFloat").css("width",(hScrollStep)+"px");
		
		newsdom.find(".wrapperHScroll").css("height",(vScrollStep)+"px");
		newsdom.find(".wrapperHScroll").css("width",(hScrollStep)+"px");
		newsdom.find(".wrapperHScrollFloat").css("height",(vScrollStep)+"px");
		
		newsdom.find(".wrapperHScroll").css("overflow","hidden");
		newsdom.find(".wrapperVScroll").css("overflow","hidden");
		newsdom.find(".wrapperVScroll").css("float","left");
		newsdom.find(".wrapperHScrollFloat").css("clear","left");
		
	}

	
	var bindButton = function () {
		if (options.ubutton)
			options.ubutton.click (goUp);
		if (options.dbutton)
			options.dbutton.click (goDown); 
		
		if (options.lbutton)
			options.lbutton.click (goLeft); 
		
		if (options.rbutton)
			options.rbutton.click (goRight);
	}
	
	var unBindButton = function () {
		if (options.ubutton)
			options.ubutton.unbind("click");
		if (options.dbutton)
			options.dbutton.unbind("click");
		if (options.lbutton)
			options.lbutton.unbind("click");
		if (options.rbutton)
			options.rbutton.unbind("click");
	}

	var goUp = function () {   
			unBindButton();
			var column_list = "content_id,category_id,image_thumbnail,title,intro,pubdate";
			if (contentOption.offset != parseInt(contentOption.baseoffset))
			{
			contentOption.offset -= parseInt(contentOption.amount);
			if (contentOption.offset < parseInt(contentOption.baseoffset))
				contentOption.offset = parseInt(contentOption.baseoffset);
			var option = {method:"getContent",categoryID:contentOption.category_list,limit:contentOption.amount,offset:contentOption.offset,dateCurrentDiff:contentOption.current_date_diff,columnlist:column_list,fixdate:contentOption.fixdate,joinCategory:"true",baseoffset:contentOption.baseoffset};
			$.ajax({
			  type: "GET",
			  url: "/cfcustom/handlerfunction.cfc",
			  data: option,
			  dataType:"json",
			  success: function(response){
				
				var tempHTML = "";
				for(var i = 0; i < response.DATA.length; i++)
				{
					var imgthumb = response.DATA[i][$.inArray("IMAGE_THUMBNAIL",response.COLUMNS)].split(",")[0];
					var catimgthumb = response.DATA[i][$.inArray("CAT_IMAGE1",response.COLUMNS)].split(",")[0];
					var title = response.DATA[i][$.inArray("TITLE",response.COLUMNS)];
					var intro = response.DATA[i][$.inArray("INTRO",response.COLUMNS)];
					var tmSplit = response.DATA[i][$.inArray("PUBDATE",response.COLUMNS)].split(" ");
					var pubdate = tmSplit[0]+" "+tmSplit[1]+" "+tmSplit[2];
					var content_id = response.DATA[i][$.inArray("CONTENT_ID",response.COLUMNS)];
					
					
					if (i < contentOption.head_amount) {
						if (contentOption.head_title == "true" && contentOption.head_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
						
						tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';
						
						if ((contentOption.head_thumb == "true") && (imgthumb != ""))
							tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
						if ((contentOption.head_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';

						if (contentOption.head_title == "true")
							tempHTML+='			<h5>'+title+'</h5>';			

						if (contentOption.head_intro == "true")
							tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

						if (contentOption.head_date == "true")
							tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
							
						tempHTML+='</a>';	
						tempHTML+='		</li>';
					} else {
						if (contentOption.other_title == "true" && contentOption.other_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
						
						tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';
							
						if ((contentOption.other_thumb == "true") && (imgthumb != ""))
							tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
						if ((contentOption.other_category_thumb == "true") && (catimgthumb != ""))
							tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';
						if (contentOption.other_title == "true")
							tempHTML+='			<h5>'+title+'</h5>';			

						if (contentOption.other_intro == "true")
							tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

						if (contentOption.other_date == "true")
							tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
						
						tempHTML+='</a>';	
						tempHTML+='		</li>';
					}
				}          
				if (tempHTML != "")
				{
					newsdom.find(".wrapperVScrollFloat").prepend(tempHTML);                 
					newsdom.find(".wrapperVScroll").scrollTop(vScrollStep);
					newsdom.find(".wrapperVScroll").filter(':not(:animated)').animate({scrollTop : '+=' + (-vScrollStep)}, 500,function() {
						newsdom.find(".wrapperVScrollFloat li:gt("+(response.DATA.length-1)+")").remove();
						bindButton(); 
						resetSize();
					});
				} else {
					contentOption.offset += parseInt(contentOption.amount);
					bindButton();
				}
			  }
	        });
		}else {
			bindButton(); 
			resetSize();

		}
	}

    var goDown = function () {

        unBindButton();
        contentOption.offset += parseInt(contentOption.amount);
        var column_list = "content_id,category_id,image_thumbnail,title,intro,pubdate";
		var option = {method:"getContent",categoryID:contentOption.category_list,limit:contentOption.amount,offset:contentOption.offset,dateCurrentDiff:contentOption.current_date_diff,columnlist:column_list,fixdate:contentOption.fixdate,joinCategory:"true",baseoffset:contentOption.baseoffset};
		$.ajax({
		  type: "GET",
		  url: "/cfcustom/handlerfunction.cfc",
		  data: option,
		  dataType:"json",
		  success: function(response){
			var tempHTML = "";
			for(var i = 0; i < response.DATA.length; i++)
			{
				var imgthumb = response.DATA[i][$.inArray("IMAGE_THUMBNAIL",response.COLUMNS)].split(",")[0];
				var catimgthumb = response.DATA[i][$.inArray("CAT_IMAGE1",response.COLUMNS)].split(",")[0];
				var title = response.DATA[i][$.inArray("TITLE",response.COLUMNS)];
				var intro = response.DATA[i][$.inArray("INTRO",response.COLUMNS)];
				var tmSplit = response.DATA[i][$.inArray("PUBDATE",response.COLUMNS)].split(" ");
				var pubdate = tmSplit[0]+" "+tmSplit[1]+" "+tmSplit[2];
				var content_id = response.DATA[i][$.inArray("CONTENT_ID",response.COLUMNS)];

				if (i < contentOption.head_amount) {
					if (contentOption.head_title == "true" && contentOption.head_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
							
					tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';
					
					if ((contentOption.head_thumb == "true") && (imgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
					if ((contentOption.head_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';

					if (contentOption.head_title == "true")
						tempHTML+='			<h5>'+title+'</h5>';			

					if (contentOption.head_intro == "true")
						tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

					if (contentOption.head_date == "true")
						tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
					tempHTML+='</a>';	
					tempHTML+='		</li>';
				} else {
					if (contentOption.other_title == "true" && contentOption.other_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
							
					tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';
							
					if ((contentOption.other_thumb == "true") && (imgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
					if ((contentOption.other_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';

					if (contentOption.other_title == "true")
						tempHTML+='			<h5>'+title+'</h5>';			

					if (contentOption.other_intro == "true")
						tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

                   	if (contentOption.other_date == "true")
                    	tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
                    				
                    tempHTML+='</a>';
      				tempHTML+='		</li>';
				}
			}          
			if (tempHTML != "")
			{
				newsdom.find(".wrapperVScrollFloat").append(tempHTML);
				newsdom.find(".wrapperVScroll").scrollTop(-vScrollStep)
				newsdom.find(".wrapperVScroll").filter(':not(:animated)').animate({scrollTop : '+=' + vScrollStep}, 500,function() {
					newsdom.find(".wrapperVScrollFloat li:lt("+lengthList+")").remove();                                            
					newsdom.find(".wrapperVScroll").scrollTop(-vScrollStep)
					bindButton(); 
					resetSize();
				});
			} else {
				contentOption.offset -= parseInt(contentOption.amount);
				bindButton();
			}
		  }
        });


	}

	var goLeft = function () {
		unBindButton();
	if ($.trim(thisDate) != $.trim(newsdom.find(".date").html().split("&nbsp;&nbsp;")[0])) {
		contentOption.current_date_diff++;  
		if (contentOption.current_date_diff == 0)
			contentOption.offset = parseInt(contentOption.baseoffset);
		else
			contentOption.offset = 0;
		var column_list = "content_id,category_id,image_thumbnail,title,intro,pubdate";
		var option = {method:"getContent",categoryID:contentOption.category_list,limit:contentOption.amount,offset:contentOption.offset,dateCurrentDiff:contentOption.current_date_diff,columnlist:column_list,fixdate:contentOption.fixdate,joinCategory:"true",baseoffset:contentOption.baseoffset};
		$.ajax({
		  type: "GET",
		  url: "/cfcustom/handlerfunction.cfc",
		  data: option,
		  dataType:"json",
		  success: function(response){
			var dSplit = (newsdom.find(".date").html().split("&nbsp;&nbsp;")[0]).split("/");
			var d = new Date((Date.parse( dSplit[1]+"/"+dSplit[0]+"/"+dSplit[2]) ) + (24*60*60*1000));
			var dd = ( ("0"+d.getDate()).length > 2)?d.getDate():("0"+d.getDate());
			var mm = ( ("0"+(d.getMonth()+1)).length > 2)?(d.getMonth()+1):("0"+(d.getMonth()+1));
			newsdom.find(".date").html((dd+"/"+(mm)+"/"+(d.getYear()+1900)) + "&nbsp;&nbsp;" + newsdom.find(".date").html().split("&nbsp;&nbsp;")[1]);
			var tempHTML = "";
			tempHTML+='<li class="wrapperVScroll" style="overflow: hidden; height: 580px; width: 290px;float:left">';
			tempHTML+='	<ul class="wrapperVScrollFloat">';
			for(var i = 0; i < response.DATA.length; i++)
			{
				var imgthumb = response.DATA[i][$.inArray("IMAGE_THUMBNAIL",response.COLUMNS)].split(",")[0];
				var catimgthumb = response.DATA[i][$.inArray("CAT_IMAGE1",response.COLUMNS)].split(",")[0];
				var title = response.DATA[i][$.inArray("TITLE",response.COLUMNS)];
				var intro = response.DATA[i][$.inArray("INTRO",response.COLUMNS)];
				var tmSplit = response.DATA[i][$.inArray("PUBDATE",response.COLUMNS)].split(" ");
				var pubdate = tmSplit[0]+" "+tmSplit[1]+" "+tmSplit[2];
				var content_id = response.DATA[i][$.inArray("CONTENT_ID",response.COLUMNS)];

				if (i < contentOption.head_amount) {
					if (contentOption.head_title == "true" && contentOption.head_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
					
					tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';		
							
					if ((contentOption.head_thumb == "true") && (imgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
					if ((contentOption.head_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';

					if (contentOption.head_title == "true")
						tempHTML+='			<h5>'+title+'</h5>';			

					if (contentOption.head_intro == "true")
						tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

					if (contentOption.head_date == "true")
						tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
					
					tempHTML+='</a>';	
					tempHTML+='		</li>';
				} else {
					if (contentOption.other_title == "true" && contentOption.other_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
							
					tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';
							
					if ((contentOption.other_thumb == "true") && (imgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
					if ((contentOption.other_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';
					if (contentOption.other_title == "true")
						tempHTML+='			<h5>'+title+'</h5>';			

					if (contentOption.other_intro == "true")
						tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

					if (contentOption.other_date == "true")
						tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
					
					tempHTML+='</a>';	
						
					tempHTML+='		</li>';
				}
			}
			tempHTML+='	</ul>';
			tempHTML+='</li>';

			newsdom.find(".wrapperHScrollFloat").append(tempHTML);
				newsdom.find(".wrapperHScroll").filter(':not(:animated)').animate({scrollLeft : '+=' + (hScrollStep)}, 500,function() {
					newsdom.find(".wrapperVScroll:eq(0)").remove();
					newsdom.find(".wrapperHScroll").scrollLeft(-hScrollStep);
					bindButton();
					resetSize();
				});
		  }
        });                                     
	} else {
		bindButton();
	}
	}
	
	var goRight = function () { 
	    unBindButton();
		contentOption.current_date_diff--;
		if (contentOption.current_date_diff == 0)
			contentOption.offset = parseInt(contentOption.baseoffset);
		else
			contentOption.offset = 0;
		var column_list = "content_id,category_id,image_thumbnail,title,intro,pubdate";
		var option = {method:"getContent",categoryID:contentOption.category_list,limit:contentOption.amount,offset:contentOption.offset,dateCurrentDiff:contentOption.current_date_diff,columnlist:column_list,fixdate:contentOption.fixdate,joinCategory:"true",baseoffset:contentOption.baseoffset};
		$.ajax({
		  type: "GET",
		  url: "/cfcustom/handlerfunction.cfc",
		  data: option,
		  dataType:"json",
		  success: function(response){                    
			var dSplit = (newsdom.find(".date").html().split("&nbsp;&nbsp;")[0]).split("/");
			var d = new Date((Date.parse( dSplit[1]+"/"+dSplit[0]+"/"+dSplit[2]) ) - (24*60*60*1000));
			var dd = ( ("0"+d.getDate()).length > 2)?d.getDate():("0"+d.getDate());
			var mm = ( ("0"+(d.getMonth()+1)).length > 2)?(d.getMonth()+1):("0"+(d.getMonth()+1));
			newsdom.find(".date").html((dd+"/"+(mm)+"/"+(d.getYear()+1900)) + "&nbsp;&nbsp;" + newsdom.find(".date").html().split("&nbsp;&nbsp;")[1]);
			var tempHTML = "";
			tempHTML+='<li class="wrapperVScroll" style="overflow: hidden; height: 580px; width: 290px;float:left">';
			tempHTML+='	<ul class="wrapperVScrollFloat">';
			for(var i = 0; i < response.DATA.length; i++)
			{
				var imgthumb = response.DATA[i][$.inArray("IMAGE_THUMBNAIL",response.COLUMNS)].split(",")[0];
				var catimgthumb = response.DATA[i][$.inArray("CAT_IMAGE1",response.COLUMNS)].split(",")[0];
				var title = response.DATA[i][$.inArray("TITLE",response.COLUMNS)];
				var intro = response.DATA[i][$.inArray("INTRO",response.COLUMNS)];
				var tmSplit = response.DATA[i][$.inArray("PUBDATE",response.COLUMNS)].split(" ");
				var pubdate = tmSplit[0]+" "+tmSplit[1]+" "+tmSplit[2];
				var content_id = response.DATA[i][$.inArray("CONTENT_ID",response.COLUMNS)];

				if (i < contentOption.head_amount) {
					if (contentOption.head_title == "true" && contentOption.head_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
							
					tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';		
							
					if ((contentOption.head_thumb == "true") && (imgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
					if ((contentOption.head_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';

					if (contentOption.head_title == "true")
						tempHTML+='			<h5>'+title+'</h5>';			

					if (contentOption.head_intro == "true")
						tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

					if (contentOption.head_date == "true")
						tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
						
					tempHTML+='</a>';		
					tempHTML+='		</li>';
				} else {
					if (contentOption.other_title == "true" && contentOption.other_intro != "true") 
					  		tempHTML+='		<li class="list-newsModule" style="list-style:disc;margin-left:15px">';
						else
							tempHTML+='		<li class="list-newsModule">';
					
					tempHTML+='<a href="'+contentOption.contentBaseURL+'content/'+content_id+'">';		
							
					if ((contentOption.other_thumb == "true") && (imgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+imgthumb+'" />';
					if ((contentOption.other_category_thumb == "true") && (catimgthumb != ""))
						tempHTML+='			<img class="th-imgIndex" src="'+catimgthumb+'" />';
					if (contentOption.other_title == "true")
						tempHTML+='			<h5>'+title+'</h5>';			

					if (contentOption.other_intro == "true")
						tempHTML+='			<p class="detail-th-module">'+intro+'</p>';

					if (contentOption.other_date == "true")
						tempHTML+='			<p class="detail-th-module th-hotNewsDate">Published: '+pubdate+' </p>';
					tempHTML+='</a>';		
					tempHTML+='		</li>';
				}
			}
			tempHTML+='	</ul>';
			tempHTML+='</li>';
			newsdom.find(".wrapperHScrollFloat").prepend(tempHTML);
			newsdom.find(".wrapperHScroll").scrollLeft(hScrollStep);
			newsdom.find(".wrapperHScroll").filter(':not(:animated)').animate({scrollLeft : '+=' + (-hScrollStep)}, 500,function() {
				newsdom.find(".wrapperVScroll:eq(1)").remove();
				bindButton();
				resetSize();
			});
		  }
        });		
	}
 bindButton();   
 resetSize();
}

