var AmmasAffiliateName = 'AmmasAffiliate' + bid + Math.round(Math.random()*999999999);
var AmmasIframeWidth = 468;
var AmmasIframeHeight = 60;
if(typeof color=="undefined") var color='A8D0E0';
if(typeof fcolor=="undefined") var fcolor='000000';
if(typeof avatar=="undefined") var avatar=1;
if(typeof qbox=="undefined") var qbox=1;
if(typeof twod=="undefined") var twod=0;
if(type == 'bluebox' || type == 'redbox' || type == 'greenbox' || type == 'perfectbluebox' || type == 'blackbox') 
{AmmasIframeWidth = 200; AmmasIframeHeight = 200;}
else if(type == '720x90b' || type == '720x90a' || type == '720x90r' || type == '720x90g' || type == '720x90p') 
{AmmasIframeWidth = 720; AmmasIframeHeight = 90;}
else if(type == 'skyscraper') {AmmasIframeWidth = 120; AmmasIframeHeight = 600;}
else if(type == 'verticalbox') {AmmasIframeWidth = 140; AmmasIframeHeight = 450;}
else if(type == 'leaderboard') {AmmasIframeWidth = 728; AmmasIframeHeight = 90;}

var AmmasAffiliateURL = "http://publisher.ammas.com/process_affiliate_theme.cfm?bid="+bid+"&type="+type+"&avatar="+avatar+"&qbox="+qbox+"&twod="+twod;

function AmmasAffiliateCreateLayer() {
   document.write('<span id="'+AmmasAffiliateName+'"></span>');
}

function AmmasAffiliatePopulateIframe() {
   document.getElementById(AmmasAffiliateName).innerHTML += '<iframe src="' + AmmasAffiliateURL + '" width="' + AmmasIframeWidth + '" height="' + AmmasIframeHeight + '" allowtransparency="true" scrolling="no" id="AmmasAffiliateIframe" name="AmmasAffiliateIframe" marginwidth="0" marginheight="0" vspace="0" hspace="0" frameborder="0"></iframe>';
}

function AmmasAffiliateInit() {
   AmmasAffiliateCreateLayer();
   AmmasAffiliatePopulateIframe();
}

AmmasAffiliateInit();
