// mca.js - MyCustomAds

// -- defaults --
var mca_adEngine = 'http://www.dressupforhalloween.com/cgi-bin/ads/showads.cgi';
var mca_adWidthDefault = 250;
var mca_adHeightDefault = 250;
var mca_adFrameBorder = 0;
// -- -- -- -- -- -- -- -- -- --

var w = window; 

if (w.mca_adWidth == null) {
  mca_adWidth = mca_adWidthDefault;
}

if (w.mca_adHeight == null) {
  mca_adHeight = mca_adHeightDefault;
}

// -- flag - Ad format dimension - set flag if horizontal ad, i.e. ads side by side
var horizAd = 0;
var adAspectRatio = mca_adWidth/mca_adHeight;
if ( adAspectRatio > 1 ) horizAd = 1;

mca_adEngine += '?h=' + horizAd;

// If ad theme exists, process it and append to ad engine URL; set the 't' parameter in the URL
if ( w.mca_adTheme != null ) {
	var themeParamVal = mca_adTheme.replace(/ /g, '%20');
	mca_adEngine += '&t=' + themeParamVal;
}

doIframe();


function dq(v){ /* double quote */
	return v!=null?'"'+v+'"':'""'
}
function doIframe() {
	document.write('<ifr' + 'ame' +
				' name="mca_adsFrame"' +
				' width=' + dq(mca_adWidth) +
				' height=' + dq(mca_adHeight) + 
				' frameborder=' + dq(mca_adFrameBorder) +
				' src=' + dq(mca_adEngine) + 
				' marginwidth="0"' +
				' marginheight="0"' +
				' vspace="0"' +
				' hspace="0"' +
				' allowtransparency="true"' +
				' scrolling="no"></ifr' + 'ame>');
}