var bstpst_submitUrl_Internal = window.location.href;

var bstpst_Service0_Internal = 'TWEETMEME';
var bstpst_Service1_Internal = 'FACEBOOK';
var bstpst_Service2_Internal = 'DIGG';
var bstpst_Service3_Internal = 'REDDIT';
var bstpst_Service4_Internal = 'BUZZUP';
var bstpst_Service5_Internal = 'SPHINN';
var bstpst_Service6_Internal = 'DZONE';

var bstpst_AdsenseID_Internal = '';

var bstpst_Style_Internal = 'http://www.boostpost.com/images/button_bg_tfd.png';

var bstpst_Docking_Internal = '2'; //bottom left

var bstpst_button_UUID = "";

var bstpst_frame_UUID = "";

function bstpst_showFrame(bstpst_SourceElement)
{
	bstpst_initialize();

	var tvoFrame = document.getElementById(bstpst_button_UUID);
	

	var tviTopOffset = 0;
	var tviLeftOffset = 0;

	switch (bstpst_Docking_Internal)
	{
		case '0':
		{
			tviTopOffset = -270;
			tviLeftOffset = 0;
			break;
		}
		case '1':
		{
			tviTopOffset = -270;
			tviLeftOffset = -267;
			break;
		}
		case '2':
		{
			tviTopOffset = 25;
			tviLeftOffset = 0;
			break;
		}
		case '3':
		{
			tviTopOffset = 1;
			tviLeftOffset = -267;
			break;
		}
	}
	tvoFrame.style.top = bstpst_findPositionTop(bstpst_SourceElement)+ tviTopOffset + "px";
	tvoFrame.style.left = bstpst_findPositionLeft(bstpst_SourceElement) + tviLeftOffset + "px";

	tvoFrame.style.visibility="visible";
}
function bstpst_showItems()
{
	window.parent.location.href='http://www.boostpost.com/showitems.php?submitUrl='+encodeURIComponent(bstpst_submitUrl_Internal)+'&AdsenseID='+bstpst_AdsenseID_Internal;
}
//source: http://www.quirksmode.org/js/findpos.html
function bstpst_initialize()
{
	if (typeof(bstpst_submitUrl) != 'undefined')
	{
		bstpst_submitUrl_Internal = bstpst_submitUrl;		
	}

	if (typeof(bstpst_Docking) != 'undefined')
		bstpst_Docking_Internal = bstpst_Docking;

	if (typeof(bstpst_Service0) != 'undefined')
		bstpst_Service0_Internal = bstpst_Service0;

	if (typeof(bstpst_Service1) != 'undefined')
		bstpst_Service1_Internal = bstpst_Service1;

	if (typeof(bstpst_Service2) != 'undefined')
		bstpst_Service2_Internal = bstpst_Service2;

	if (typeof(bstpst_Service3) != 'undefined')
		bstpst_Service3_Internal = bstpst_Service3;

	if (typeof(bstpst_Service4) != 'undefined')
		bstpst_Service4_Internal = bstpst_Service4;

	if (typeof(bstpst_Service5) != 'undefined')
		bstpst_Service5_Internal = bstpst_Service5;

	if (typeof(bstpst_Service6) != 'undefined')
		bstpst_Service6_Internal = bstpst_Service6;

	if (typeof(bstpst_AdsenseID) != 'undefined')
		bstpst_AdsenseID_Internal = bstpst_AdsenseID;



	var bstpst_SourceElement = document.getElementById(bstpst_frame_UUID);
	var bstpst_Test = document.getElementById(bstpst_button_UUID);
	if (bstpst_Test!=null)
	{
		return;
	}
		
	var bstpst_Frame = document.createElement("DIV");
	
	bstpst_Frame.id = generateGuid();

	bstpst_Frame.style.position = "absolute";
	
	bstpst_Frame.style.width = "400px";
	bstpst_Frame.style.height = "225px";
	
	bstpst_Frame.style.backgroundImage = "url('http://www.boostpost.com/images/black50.png')";
	bstpst_Frame.style.padding = "8px";
	bstpst_Frame.style.border = "0px solid black";
	bstpst_Frame.style.zIndex = 100;
	bstpst_Frame.style.visibility = "hidden";
	
	var bstpst_Script3 = document.createElement("IFRAME");
	
	bstpst_Script3.frameBorder = 0;
	bstpst_Script3.src = "http://www.boostpost.com/Boosts.php?submitUrl="+encodeURIComponent(bstpst_submitUrl_Internal) + "&Service0=" + bstpst_Service0_Internal+ "&Service1=" + bstpst_Service1_Internal+ "&Service2=" + bstpst_Service2_Internal+ "&Service3=" + bstpst_Service3_Internal+ "&Service4=" + bstpst_Service4_Internal+ "&Service5=" + bstpst_Service5_Internal+ "&Service6=" + bstpst_Service6_Internal+ "&AdsenseID=" + bstpst_AdsenseID_Internal;
	bstpst_Script3.width="400px";
	bstpst_Script3.height="225px";
	
	bstpst_Script3.onmouseout = bstpst_hideFrame;
	
	bstpst_Frame.appendChild(bstpst_Script3);
	
	bstpst_SourceElement.appendChild(bstpst_Frame);
}
function bstpst_findPositionTop(fvoSourceObject)
{
	var tvoSourceObject = fvoSourceObject;
	var tviTop = 0;	
	if ( tvoSourceObject.offsetParent )
	{
		do
		{			
			tviTop += (tvoSourceObject.offsetTop-tvoSourceObject.scrollTop+tvoSourceObject.clientTop);
		}while (tvoSourceObject = tvoSourceObject.offsetParent);
	}
	return tviTop;
}
function bstpst_findPositionLeft(fvoSourceObject)
{
	var tvoSourceObject = fvoSourceObject;
	var tviLeft = 0;
	if ( tvoSourceObject.offsetParent )
	{
		do
		{
			tviLeft += (tvoSourceObject.offsetLeft-tvoSourceObject.scrollLeft+tvoSourceObject.clientLeft);
		}while (tvoSourceObject = tvoSourceObject.offsetParent);
	}
	return tviLeft;
}
function bstpst_hideFrame()
{
	var tvoFrame = document.getElementById(bstpst_button_UUID);
	tvoFrame.style.visibility="hidden";
}
function generateGuid()
{

	var result, i, j;
	result = '';
	for(j=0; j<32; j++)
	{
		if( j == 8 || j == 12|| j == 16|| j == 20)
		result = result + '-';
		i = Math.floor(Math.random()*16).toString(16).toUpperCase();
		result = result + i;
	}
	bstpst_button_UUID = "bstpst_button_" + result;
	return bstpst_button_UUID;
} 
function generateGuidFrame()
{

	var result, i, j;
	result = '';
	for(j=0; j<32; j++)
	{
		if( j == 8 || j == 12|| j == 16|| j == 20)
		result = result + '-';
		i = Math.floor(Math.random()*16).toString(16).toUpperCase();
		result = result + i;
	}
	bstpst_frame_UUID = "bstpst_frame_" + result;
	return bstpst_frame_UUID;
} 
function getStyle()
{
	if (typeof(bstpst_Style) != 'undefined')
		bstpst_Style_Internal = bstpst_Style;
	return bstpst_Style_Internal;
}
document.write ('<a href="javascript:bstpst_showItems();">');
document.write ('<img src="' + getStyle() + '" border="0" onmouseover="bstpst_showFrame(this);" />');
document.write ('</a><div id="'+ generateGuidFrame() +'"></div>');