/*var url = "getRss.php?";
var channel = 1;
var section = 1;

$(function() {
	getWidgetContent(1,1,url);
});*/

/*function getWidgetContent(channelID, sectionID,url) {
 $.ajax( {
 type :"GET",
 url : "http://c2csection.com/ftp/c2c/c2c-temp//1/1.xml",//url+"channel="+channel+"&section="+section,
 //url : "1/1.xml",
 dataType :"xml",
 success : function(xml) {
 $('#give_help_go').empty();
 $(xml).find('item').each( function() {
 var c2cTitle_text = $(this).find('title').text();
 var url_text = $(this).find('url').text();
 // var section_text = $(this).find('section').text();
 // var position_text = $(this).find('position').text();

 $('<span></span>').html(
 '<a target="_blank" href=' + url_text + '>' + c2cTitle_text
 + '</a><br />').appendTo('#give_help_go');
 });
 }
 });
 }*/
var intervalId;

function getC2CLinks(interval, targetId) {
	//getACDText(targetId);
	intervalId = setInterval(getACDText, interval, targetId);
}
function stopGetLinks(){
	clearInterval(intervalId);
}
function getACDTextOld(divID) {
	
	if (ACD.error == '') {
		var xml = ACD.responseText;
		$('#' + divID).empty();
		$(xml).find('item').each( function() {
		
			var c2cTitle_text = $(this).find('c2ctitle').text();
			var url_text = $(this).find('url').text();
			// var section_text = $(this).find('section').text();
			// var position_text = $(this).find('position').text();
				$('<span></span>').html('<a target="_blank" href=' + url_text + '>'	+ c2cTitle_text + '</a><br />').appendTo('#' + divID);
				
			});
	} else {
		alert(ACD.error);
		//stopGetLinks();
	}
}

function getACDText(){
	var xml = ACD.responseText;
	$('#give_help_go').empty();

	var browser=navigator.appName;
	if (browser=="Microsoft Internet Explorer") {
        var counter = 0;
        var iexml;
		if (xml && (typeof xml == "string")) {
			iexml = new ActiveXObject("Microsoft.XMLDOM");
			iexml.async = false;
			iexml.loadXML(xml);
		} else {
			iexml = xml;
		}

		$(iexml).find('item').each( function() {
			var c2cTitle_text = $(this).find('c2ctitle').text();
			var url_text = $(this).find('url').text();
			// var section_text = $(this).find('section').text();
			// var position_text = $(this).find('position').text();

			$('<span></span>').html(
					'<a target="_blank" href=' + url_text + '>' + c2cTitle_text
							+ '</a><br />').appendTo('#give_help_go');
            counter = counter + 1;
            if (counter == 3) {
                return false;
            }
        });
	} else {
        var counter = 0;
        $(xml).find('item').each( function() {
			var c2cTitle_text = $(this).find('c2ctitle').text();
			var url_text = $(this).find('url').text();
			// var section_text = $(this).find('section').text();
			// var position_text = $(this).find('position').text();

			$('<span></span>').html(
					'<a target="_blank" href=' + url_text + '>' + c2cTitle_text
							+ '</a><br />').appendTo('#give_help_go');
            counter = counter + 1;
            if (counter == 3) {                
                return false;
            }
        });
	}

}
