//This script detects the following:
//Flash
//Windows Media Player
//Java
//Shockwave
//RealPlayer
//QuickTime
//Acrobat Reader
//SVG Viewer


var agt=navigator.userAgent.toLowerCase();
var ie  = (agt.indexOf("msie") != -1);
var ns  = (navigator.appName.indexOf("Netscape") != -1);
var win = ((agt.indexOf("win")!=-1) || (agt.indexOf("32bit")!=-1));
var mac = (agt.indexOf("mac")!=-1);

if (ie && win) {	pluginlist = detectIE("SWCtl.SWCtl.1","Shockwave Director") + detectIE("ShockwaveFlash.ShockwaveFlash.1","Shockwave Flash");  }
if (ns || !win) {
		nse = ""; for (var i=0;i<navigator.mimeTypes.length;i++) nse += navigator.mimeTypes[i].type.toLowerCase();
		pluginlist = detectNS("image/svg-xml","SVG Viewer") + detectNS("application/x-director","Shockwave Director") + detectNS("application/x-shockwave-flash","Shockwave Flash") + detectNS("audio/x-pn-realaudio-plugin","RealPlayer") + detectNS("video/quicktime","QuickTime") + detectNS("application/x-mplayer2","Windows Media Player") + detectNS("application/pdf","Acrobat Reader");
}

function detectIE(ClassID,name) { result = false; document.write('<SCRIPT LANGUAGE=VBScript>\n on error resume next \n result = IsObject(CreateObject("' + ClassID + '"))</SCRIPT>\n'); if (result) return name+','; else return ''; }
function detectNS(ClassID,name) { n = ""; if (nse.indexOf(ClassID) != -1) if (navigator.mimeTypes[ClassID].enabledPlugin != null) n = name+","; return n; }

pluginlist += navigator.javaEnabled() ? "Java," : "";
if (pluginlist.length > 0) pluginlist = pluginlist.substring(0,pluginlist.length-1);

function DisplayAds(nID,Types,nNum,sClassName,sClassNameText,ExcludeList,SearchTerms) {

	var scriptpath = "";
	var time = new Date();
	randnum= (time.getTime());
	if (pluginlist.indexOf("Flash")!=-1) {
		bFlash = true;
	} else {
		bFlash = false;
	}	

	scriptpath = "http://" + location.host;
				
	script =  '<SCRIPT language="JavaScript" SRC="' + scriptpath + '/ads.php?nID=' + nID + '&Types=' + escape(Types) + '&adArea=Sections' + '&nNum=' + nNum + '&sClassName=' + escape(sClassName) + '&sClassNameText=' + escape(sClassNameText) + '&ExcludeList=' + escape(ExcludeList) + '&SearchTerms=' + escape(SearchTerms) + '&bFlash=' + bFlash + '&randnum=' + randnum + '">';
	script = script + '<\/SCRIPT>';
	document.write (script);  
}


function DisplayCatAds(nID,Types,nNum,sClassName,sClassNameText,ExcludeList) {

	var scriptpath = "";
	var time = new Date();
	randnum= (time.getTime());
	if (pluginlist.indexOf("Flash")!=-1) {
		bFlash = true;
	} else {
		bFlash = false;
	}	
				
	scriptpath= "http://" + location.host;

	script =  '<SCRIPT language="JavaScript" SRC="' + scriptpath + '/ads.php?nID=' + escape(nID) + '&Types=' + escape(Types) + '&adArea=Categories' + '&nNum=' + nNum + '&sClassName=' + escape(sClassName) + '&sClassNameText=' + escape(sClassNameText) + '&ExcludeList=' + escape(ExcludeList) + '&bFlash=' + bFlash + '&randnum=' + randnum + '">';
	script = script + '<\/SCRIPT>';
	
	document.write (script);  
	   
}


function DisplayAd(nID,nContentID,sClassName,sClassNameText) {
	
	var scriptpath = "";
	var time = new Date();
	randnum= (time.getTime());
	if (pluginlist.indexOf("Flash")!=-1) {
		bFlash = true;
	} else {
		bFlash = false;
	}	
				
	scriptpath= "http://" + location.host;

	script =  '<SCRIPT language="JavaScript" SRC="' + scriptpath + '/ads.php?nID=' + escape(nID) + '&nContentID=' + escape(nContentID) + '&adArea=Content' + '&sClassName=' + escape(sClassName) + '&sClassNameText=' + escape(sClassNameText) + '&bFlash=' + bFlash + '&randnum=' + randnum + '">';
	script = script + '<\/SCRIPT>';
	
	document.write (script);  
	   
}
