
function scl_rss_bc_grid(container_id) {
this.container_div_id = container_id;
this.container=document.getElementById(this.container_div_id);
this.description_length=60; 

//this.proxy_url = "http://systemcorebeta-g.co.uk/wp-content/themes/dmi-news-1a/scl_rss_bc_grid.php"
this.proxy_url = "http://dminews.dmionline.net/wp-content/themes/dmi-news-1a/scl_rss_bc_grid.php"

this.holder_id="businesscom";
this.link_id="title";
this.link_class="businesscom_title";
this.link_target="_blank";
this.description_id="description";

this.left_link="https://secure.business.com/registration/suggestasite.jsp?partner=4912001";
this.left_text ="FEATURED LISTINGS";
this.left_id="businesscom_link_left";
this.left_target="_blank";

this.right_link="https://secure.business.com/registration/suggestasite.jsp?partner=4912001";
this.right_text="FEATURE YOUR SITE";
this.right_id="businesscom_link_right";
this.right_target="_blank";

this.xmlString="";
this.xmlObject = false;
this.scl_request=null;
this.xmlDoc = null;

this.insert_holder_msg();
this.scl_new_request();

setTimeout ( this.scl_get_xml(), 250 );
}


scl_rss_bc_grid.prototype.scl_stateChanged = function(e) { 
this.scl_got_xml();
}


scl_rss_bc_grid.prototype.scl_loadXML=function() {
if (window.ActiveXObject)
  {
	this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	this.xmlDoc.async="false";
	this.xmlDoc.loadXML(this.xmlString);
	this.render();
  }
else if (document.implementation && document.implementation.createDocument)
  {
 	this.xmlDoc=document.implementation.createDocument("","",null);
	var parser=new DOMParser();
	this.xmlDoc=parser.parseFromString(this.xmlString,"application/xml");
	this.render();
  }
else
  {
  alert('Your browser cannot handle this script');
  }
}


scl_rss_bc_grid.prototype.insert_holder_msg=function() {
var t = '';
t+='<div id="'+this.holder_id+'">';
t+='<p>Loading content...</p>';
t+='</div>';
this.container.innerHTML= t;
}

scl_rss_bc_grid.prototype.render=function() {
var t = '';
t+='<div id="'+this.holder_id+'">';
t+='<div id="'+this.right_id+'"><a href="'+this.right_link+'" target="'+this.right_target+'">'+this.right_text+'</a></div>';
t+='<div id="'+this.left_id+'"><a href="'+this.left_link+'" target="'+this.left_target+'">'+this.left_text+'</a></div>';
t+='<div class="clear"></div>';
t+='<table>';
t+='<tr>';
t+='<td><a id="'+this.link_id+'11'+'" class="'+this.link_class+'" href="'+this.xmlDoc.getElementsByTagName("url")[0].childNodes[0].nodeValue+'" target="'+this.link_target+'">'+this.xmlDoc.getElementsByTagName("title")[0].childNodes[0].nodeValue+'</a><div id="'+this.description_id+'11'+'">'+this.xmlDoc.getElementsByTagName("description")[0].childNodes[0].nodeValue.substr(0,this.description_length)+'...'+'</div></td>';
t+='<td><a id="'+this.link_id+'12'+'" class="'+this.link_class+'" href="'+this.xmlDoc.getElementsByTagName("url")[1].childNodes[0].nodeValue+'" target="'+this.link_target+'">'+this.xmlDoc.getElementsByTagName("title")[1].childNodes[0].nodeValue+'</a><div id="'+this.description_id+'12'+'">'+this.xmlDoc.getElementsByTagName("description")[1].childNodes[0].nodeValue.substr(0,this.description_length)+'...'+'</div></td>';
t+='<td><a id="'+this.link_id+'13'+'" class="'+this.link_class+'" href="'+this.xmlDoc.getElementsByTagName("url")[2].childNodes[0].nodeValue+'" target="'+this.link_target+'">'+this.xmlDoc.getElementsByTagName("title")[2].childNodes[0].nodeValue+'</a><div id="'+this.description_id+'13'+'">'+this.xmlDoc.getElementsByTagName("description")[2].childNodes[0].nodeValue.substr(0,this.description_length)+'...'+'</div></td>';
t+='</tr>';
t+='<tr>';
t+='<td><a id="'+this.link_id+'21'+'" class="'+this.link_class+'" href="'+this.xmlDoc.getElementsByTagName("url")[3].childNodes[0].nodeValue+'" target="'+this.link_target+'">'+this.xmlDoc.getElementsByTagName("title")[3].childNodes[0].nodeValue+'</a><div id="'+this.description_id+'21'+'">'+this.xmlDoc.getElementsByTagName("description")[3].childNodes[0].nodeValue.substr(0,this.description_length)+'...'+'</div></td>';
t+='<td><a id="'+this.link_id+'22'+'" class="'+this.link_class+'" href="'+this.xmlDoc.getElementsByTagName("url")[4].childNodes[0].nodeValue+'" target="'+this.link_target+'">'+this.xmlDoc.getElementsByTagName("title")[4].childNodes[0].nodeValue+'</a><div id="'+this.description_id+'22'+'">'+this.xmlDoc.getElementsByTagName("description")[4].childNodes[0].nodeValue.substr(0,this.description_length)+'...'+'</div></td>';
t+='<td><a id="'+this.link_id+'23'+'" class="'+this.link_class+'" href="'+this.xmlDoc.getElementsByTagName("url")[5].childNodes[0].nodeValue+'" target="'+this.link_target+'">'+this.xmlDoc.getElementsByTagName("title")[5].childNodes[0].nodeValue+'</a><div id="'+this.description_id+'23'+'">'+this.xmlDoc.getElementsByTagName("description")[5].childNodes[0].nodeValue.substr(0,this.description_length)+'...'+'</div></td>';
t+='</tr>';
t+='</table>';
t+='</div>';
this.container.innerHTML= t;
}


scl_rss_bc_grid.prototype.scl_new_request=function() {
var  rc = null;
   try {
     this.scl_request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       this.scl_request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         this.scl_request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         this.scl_request = null;
alert("Error initializing XMLHttpRequest!")
       }  
     }
   }
}


scl_rss_bc_grid.prototype.scl_got_xml= function() {
	var agt=navigator.userAgent.toLowerCase();
	var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
     if (this.scl_request.readyState == 4) {
       if (this.scl_request.status == 200 || this.scl_request.status == 203 || (is_safari && (typeof(this.scl_request.status) == 'undefined')) || true) {
        this.xmlString = this.scl_request.responseText; //set global
   	     this.scl_loadXML();
       } else {
;//       	      alert("status is " + this.request.status);
	  }	
     }
}

scl_rss_bc_grid.prototype.scl_get_xml= function() {
	var	myobj=this;
	myobj.scl_request.open('POST', this.proxy_url, true); //post type request
	myobj.scl_request.onreadystatechange = function() { return myobj.scl_stateChanged(); };
	myobj.scl_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); //for use with post
	myobj.scl_request.send("");
}

