fitplein_get_script_tag();

// create iframe
function fitplein_create_iframe()
{ 
	fitplein_strip_banner(fitplein_las_type);
	
	iframe = document.createElement("iframe"); 
	iframe.setAttribute("src", "http://www.leadstats.net/page/fitplein/view3.php?cid="+fitplein_cid+"&ctid="+fitplein_ctid+"&type="+fitplein_las_type+"&back="+parent.location.href); 
	iframe.style.border = '0px none';
	iframe.style.background = 'none';
	
	iframe.id = 'fitplein_las_iframe';
	iframe.width = (isNaN(fitplein_banner_width)) ? '100%' : fitplein_banner_width + 'px'; 
	iframe.height = (isNaN(fitplein_banner_height)) ? '100%' : fitplein_banner_height + 'px'; 
	
	// textlink
	if (fitplein_las_type == 'textlink')
	{
		iframe.height = '25px';
	}
	if (fitplein_las_type == 'textlink_image')
	{
		iframe.height = '30px';
	}
	// content block
	else if (fitplein_las_type == 'content_block')
	{
		iframe.width = '300px';
		iframe.height = '150px';
	}
	// picture block
	else if (fitplein_las_type == 'picture_block')
	{
		iframe.width = '300px';
		iframe.height = '190px';
	}
	
	iframe.allowTransparency = "true";
	iframe.marginWidth = 0;
	iframe.marginHeight = 0;
	iframe.scrolling = 'no';
	iframe.frameBorder = 0;
	iframe.hspace = 0;
	iframe.vspace = 0;
}

function fitplein_get_script_tag()
{ 
	var scripts = document.getElementsByTagName('script') 
	fitplein_create_iframe();
	
	for (var i = 0 ; i < scripts.length; i++)
	{ 
		if (scripts[i].src.indexOf('www.leadstats.net') > -1)
		{
			scripts[i].parentNode.appendChild(iframe);
		}
	} 
}

function fitplein_strip_banner(type)
{
	var stripped = type.split('_');
	
	fitplein_banner_width = parseInt(stripped[1]);
	fitplein_banner_height = parseInt(stripped[2]);
}