/***********************************************************
	Bannerboxes feeds code
	
	wanna cut, copy, and steal this code... go ahead.
***********************************************************/
// make sure that all the required parameters are present
if (typeof(bannerboxes_table_background_color) == "undefined"){
	bannerboxes_table_background_color = "6699CC";
}
if (typeof(bannerboxes_ad_background_color) == "undefined"){
	bannerboxes_ad_background_color = "FFFFFF";
}
if (typeof(bannerboxes_text_color) == "undefined"){
	bannerboxes_text_color = "000000";
}
if (typeof(bannerboxes_link_color) == "undefined"){
	bannerboxes_link_color = "0000FF";
}
if (typeof(bannerboxes_yourad_link_color) == "undefined"){
	bannerboxes_yourad_link_color = "FFFFFF";
}
if (typeof(bannerboxes_quadrant) == "undefined"){
	bannerboxes_quadrant = "";
}
if (typeof(bannerboxes_quadrant) == "undefined"){
	bannerboxes_quadrant = "";
}

// create the urlstring from the parameters that were passed
var bannerboxes_urlstring = '<scr' + 'ipt type=text/javascript ' +
	'src="http://feeds.bannerboxes.com/?' +
	'adspot=' + bannerboxes_quadrant  +
	'&bannerboxes_table_background_color=' + bannerboxes_table_background_color  +
	'&bannerboxes_ad_background_color=' + bannerboxes_ad_background_color +
	'&bannerboxes_link_color=' + bannerboxes_link_color +
	'&bannerboxes_text_color=' + bannerboxes_text_color +
	'&bannerboxes_yourad_link_color=' + bannerboxes_yourad_link_color;

// see if the bannerboxes_search_engine_param was passed.
// if so grab the value of the url parameter that is associated with it.
// this is only used for search engines.
if (typeof(bannerboxes_search_engine_param) != "undefined"){

	// functions to make it easy to grab the value.
	function geturlparam(str){
		var params = URLdecode(document.location.search);
		var params = params.slice(1,params.length);
		var n = params.split("&");
			
		m = new Array();
		
		for(a=0; a <= (n.length - 1); a++){
			m[a] = n[a].split("=");
		}
		
		for(a=0; a <= (m.length - 1); a++){
			if(m[a][0] == str){
				return m[a][1];
			}
		}
		
		return "";
	}
	
	function URLencode(str) {
		if(typeof(encodeURIComponent) == 'function') {
			return encodeURIComponent(str);
		}else{
			return escape(str);
		}
	}
	
	function URLdecode(str) {
		if(typeof(decodeURIComponent) == 'function') {
			return decodeURIComponent(str);
		}else{
			return unescape(str);
		}
	}

	// grab the value and add it to the urlstring variable.
	thekeyword = geturlparam(bannerboxes_search_engine_param).replace(/\+/gi, ' ');
	bannerboxes_urlstring += '&keyword=' + URLencode(thekeyword);
}

// finish creating the urlstring variable
bannerboxes_urlstring += '"></scr' + 'ipt>';

// call the ad engine.
document.write(bannerboxes_urlstring);