var ad_width  = 0;
var ad_height = 0;

if(typeof ad_venue == 'undefined')
{
	ad_venue = 'All';
}

if(typeof ad_state == 'undefined')
{
	ad_state = '';
}

if(typeof ad_cat == 'undefined')
{
	ad_cat = '';
}

if(ad_type == 'leaderboard')
{
	ad_width  = 728;
	ad_height = 90;
}
else if(ad_type == 'wide-skyscraper')
{
	ad_width  = 160;
	ad_height = 600;
}
else if(ad_type == 'rectangle')
{
	ad_width  = 180;
	ad_height = 150;
}
else if(ad_type == 'button1')
{
	ad_width  = 120;
	ad_height = 90;
}

if(ad_width > 0 && ad_height > 0)
{
	var query = 'venue='+ad_venue+'&type='+ad_type;
	// states
	var states = ad_state.split(',');
	for(var i = 0; i < states.length; i++)
	{
		query += '&state[]='+states[i];
	}
	// cats
	var cats = ad_cat.split(',');
	for(var i = 0; i < cats.length; i++)
	{
		query += '&cat[]='+cats[i];
	}

	document.write('<iframe src="http://www.eventplannersassociation.com/scripts/ad.php?'+query+'" width="'+ad_width+'" height="'+ad_height+'" frameborder="0" scrolling="no" ></iframe>');
}