/***********************************************
* Ajax Includes script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

//Included file MUST be from the same domain as the page displaying it.
var boxes = new Array("box1.htm","box2.htm","box3.htm","box4.htm","box5.htm","box6.htm","box7.htm","box8.htm"); // specify the various include boxes
val = boxes.length;
rnd = (Math.floor(Math.random() * val)+1);
var rootdomain="http://"+window.location.hostname

function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously 
page_request.send(null)
writecontent(page_request)
}

function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
document.write(page_request.responseText)
}

// Insert banner 

// BANNER OBJECT
function topBanner(topobjName){
	this.topobj = topobjName;
	this.topaNodes = [];
	this.topcurrentBanner = 0;
	
};

// ADD NEW BANNER
topBanner.prototype.add = function(topbannerType, topbannerPath, topheight, topwidth, tophyperlink) {
	this.topaNodes[this.topaNodes.length] = new topNode(this.obj +"_"+ this.topaNodes.length, topbannerType, topbannerPath, topheight, topwidth, tophyperlink);
};

// Node object
function topNode(topname, topbannerType, topbannerPath, topheight, topwidth, tophyperlink) {
	this.topname = topname;
	this.topbannerType = topbannerType;
	this.topbannerPath = topbannerPath;
	this.topheight = topheight
	this.topwidth = topwidth;
	this.tophyperlink= tophyperlink;
//	alert (topname +"|" + topbannerType +"|" + topbannerPath +"|" + topheight +"|" + topwidth + "|" + tophyperlink);
};

// Outputs the banner to the page
topBanner.prototype.toString = function() {
	var str = ""
	for (var iCtr=0; iCtr < this.topaNodes.length; iCtr++){
		str = str + '<span name="'+this.topaNodes[iCtr].topname+'" '
		str = str + 'id="'+this.topaNodes[iCtr].topname+'" ';
		str = str + 'class="m_banner_show" ';
		str = str + 'align="center" ';
		str = str + 'valign="top" >\n';
		if (this.topaNodes[iCtr].tophyperlink != ""){
			str = str + '<a href="'+this.topaNodes[iCtr].tophyperlink+'">';
		}
			
		if ( this.topaNodes[iCtr].topbannerType == "FLASH" ){
			str = str + '<OBJECT '
			str = str + 'classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
			str = str + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '
			str = str + 'WIDTH="'+this.topaNodes[iCtr].topwidth+'" '
			str = str + 'HEIGHT="'+this.topaNodes[iCtr].topheight+'" '
			str = str + 'id="bnr_'+this.topaNodes[iCtr].topname+'" '
			str = str + 'ALIGN="middle" '
			str = str + '>'
			str = str + '<PARAM NAME="movie" VALUE="'+ this.topaNodes[iCtr].topbannerPath + '">'
			str = str + '<PARAM NAME="quality" VALUE="high">'
			str = str + '<PARAM NAME="wmode" VALUE="transparent">'
			str = str + '<EMBED ';
			str = str + 'src="'+this.topaNodes[iCtr].topbannerPath+'" '
			str = str + 'quality="high"'
			str = str + 'WIDTH="'+this.topaNodes[iCtr].topwidth+'" '
			str = str + 'HEIGHT="'+this.topaNodes[iCtr].topheight+'" '
			str = str + 'NAME="bnr_'+this.topaNodes[iCtr].topname+'" '
			str = str + 'ALIGN="center" wmode="transparent" '
			str = str + 'TYPE="application/x-shockwave-flash" '
			str = str + 'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">'
			str = str + '</EMBED>'
			str = str + '</OBJECT>'
		}
		else if ( this.topaNodes[iCtr].topbannerType == "IMAGE" ){
			str = str + '<img src="'+this.topaNodes[iCtr].topbannerPath+'" ';
			str = str + 'border="0" ';
			str = str + 'height="'+this.topaNodes[iCtr].topheight+'" ';
			str = str + 'width="'+this.topaNodes[iCtr].topwidth+'">';
		}

		if (this.topaNodes[iCtr].tophyperlink != ""){
			str = str + '</a>';
		}

		str += '</span>';
	}
	return str;
};
