nws_adbar_url = 'http://ads.netoon.com/dealbar.php?client_id=' + escape(nws_ad_client_id.toLowerCase())

displayAD();

function displayAD()
{
	validateParameters();

	if(window.nws_ad_client_id != null && window.nws_ad_client_id != '')
		appendURLEscape('client_id' , window.nws_ad_client_id);

	if(window.nws_ad_type != null && window.nws_ad_type != '')
		appendURLEscape('type' , window.nws_ad_type);

	if(window.nws_word_wrapping != null && window.nws_word_wrapping != '')
		appendURLEscape('wrapping' , window.nws_word_wrapping);

	if(window.nws_ad_row != null && window.nws_ad_row != '')
		appendURLEscape('row' , window.nws_ad_row);
	if(window.nws_ad_col != null && window.nws_ad_col != '')
		appendURLEscape('col' , window.nws_ad_col);
	if(window.nws_ad_section_width != null && window.nws_ad_section_width != '')
		appendURLEscape('section_width' , window.nws_ad_section_width);
	if(window.nws_ad_section_height != null && window.nws_ad_section_height != '')
		appendURLEscape('section_height' , window.nws_ad_section_height);
	if(window.nws_ad_width != null && window.nws_ad_width != '')
		appendURLEscape('width' , window.nws_ad_width);
	if(window.nws_ad_height != null && window.nws_ad_height != '')
		appendURLEscape('height' , window.nws_ad_height);
		
	if(window.nws_ad_image_width != null && window.nws_ad_image_width != '')
		appendURLEscape('image_width' , window.nws_ad_image_width);
	if(window.nws_ad_image_height != null && window.nws_ad_image_height != '')
		appendURLEscape('image_height' , window.nws_ad_image_height);

	if(window.nws_ad_color_bg != null && window.nws_ad_color_bg != '')
		appendURLEscape('color_bg' , window.nws_ad_color_bg);
	if(window.nws_ad_color_border != null && window.nws_ad_color_border != '')
		appendURLEscape('color_border' , window.nws_ad_color_border);
	if(window.nws_ad_color_title != null && window.nws_ad_color_title != '')
		appendURLEscape('color_title' , window.nws_ad_color_title);
	if(window.nws_ad_color_price != null && window.nws_ad_color_price != '')
		appendURLEscape('color_price' , window.nws_ad_color_price);
	if(window.nws_ad_color_vendor != null && window.nws_ad_color_vendor != '')
		appendURLEscape('color_vendor' , window.nws_ad_color_vendor);
	
	if(window.nws_ad_cat != null && window.nws_ad_cat != '')
		appendURLEscape('cat' , window.nws_ad_cat);
	
	if(window.nws_ad_vendor_class != null && window.nws_ad_vendor_class != '')
		appendURLEscape('vendor_class' , window.nws_ad_vendor_class);

	if(window.nws_ad_vendor_list != null && window.nws_ad_vendor_list != '')
		appendURLEscape('vendor_list' , window.nws_ad_vendor_list);
	
	if(window.nws_ad_open_target != null && window.nws_ad_open_target != '')
		appendURLEscape('target' , window.nws_ad_open_target);
	
	if(window.nws_ad_redirect_type != null && window.nws_ad_redirect_type != '')
		appendURLEscape('redirect_type' , window.nws_ad_redirect_type);

	if(window.nws_ad_redirect_type != null && window.redirect_base_url != '')
		appendURLEscape('rbs' , window.redirect_base_url);

	document.write('<ifr' + 'ame' +
				   ' name="nws_ads_iframe"' +
				   ' width=' + addquote(window.nws_ad_width) +
				   ' height=' + addquote(window.nws_ad_height) +
				   ' src=' + addquote(window.nws_adbar_url) +
				   ' frameborder=0'+
				   ' allowtransparency="true"' +
				   ' marginwidth="0"' +
				   ' marginheight="0"' +
				   ' vspace="0"' +
				   ' hspace="0"' +
				   ' scrolling="no">' +
				   '<i' + 'mg height="1" width="1" border="0" ' +
				   'src="http://adtracker.netoon.com/hotbar.gif"' +
				   ' />' +
				   ' </ifr' + 'ame>');
}

function errorHandler() 
{
  	displayAD();
  	return true;
}

function addquote(str) 
{
	return str != null ? '"'+str+'"' : '""';
}

function appendURLEscape(param, value) 
{
  	if (value != null)
  	{
	  	if (typeof(encodeURIComponent) == 'function') 
	  	{
			nws_adbar_url += '&' + param + '=' + encodeURIComponent(value);
	  	}
	  	else 
	  	{
			nws_adbar_url += '&' + param + '=' + escape(value);
	  	}
 	}
}


function validateParameters()
{
	nws_ad_width = nws_ad_width == null ? '' : nws_ad_width;
	nws_ad_height = nws_ad_height == null ? '' : nws_ad_height;

	if(nws_ad_width == '')
		nws_ad_width = 120;
	if(nws_ad_height == '')
		nws_ad_height = 120;
}