// JavaScript Document

function mainInitHoverFS()
{
 	writeHoverDivFS();
	loadFS();
}

function loadFS()
{
	doctype = document.compatMode.toString().toLowerCase();

	if (doctype.indexOf("css") != -1) 	setInterval(locateFixedCssFS, 100);
	else					setInterval(locateJavaFS, 50);

	setTimeout(startFadeInLoopFS, 20000);
}


function locateFixedCssFS()
{
	 lay=document.getElementById('floatlayer');
 	 
	 lay.style.position='fixed';
	 	 
	 lay.style.left = getWidgetLocationWidthFS() + "px";
	 lay.style.top  = getWidgetLocationHeightFS() + "px";
}


function setHandFS()
{
	if (parseFloat(lay.style.opacity) != 0)	document.body.style.cursor = 'hand';
}


function writeHoverDivFS()
{
	document.write("<div id=\"floatlayer\" style=\"display:none;width:1px;background:#d0d0ff;border:none;padding:10px;opacity:.00;filter:alpha(opacity=0)\" onclick=\"javascript:followsiteshow('', this);\" onmouseover=\"javascript:setHandFS();\" onmouseout=\"document.body.style.cursor = 'default';\">");
	document.write("<font face=\"Verdana\" size=\"2\"><b>Favorite Site?</b><br>");
	document.write("Get notified when this website is updated. <u><font color=\"#0000FF\">Click Here</font></u>.</font>");
	document.write("</div>");
}


function getWidgetLocationHeightFS()
{
 		return getBrowserHeightFS() - 60;
}


function getWidgetLocationWidthFS()
{
 		return getBrowserWidthFS() - 450;
}


function getBrowserHeightFS()
{
 	if (window.innerHeight != 0 && typeof window.innerHeight != 'undefined') return window.innerHeight;
	if (document.documentElement.clientHeight != 0 && typeof document.documentElement.clientHeight != 'undefined') return document.documentElement.clientHeight;
	if (document.body.clientHeight != 0 && typeof document.body.clientHeight != 'undefined') return document.body.clientHeight;
}


function getBrowserWidthFS()
{
 	if (window.innerWidth != 0 && typeof window.innerWidth != 'undefined') return window.innerWidth;
	if (document.documentElement.clientWidth != 0 && typeof document.documentElement.clientWidth != 'undefined') return document.documentElement.clientWidth;
	if (document.body.clientWidth != 0 && typeof document.body.clientWidth != 'undefined') return document.body.clientWidth;
}


function startFadeInLoopFS()
{
	setInterval(fadeInFS, 50);
}


function fadeInFS()
{
	lay=document.getElementById('floatlayer');
	lay.style.display = "";
	i = parseFloat(lay.style.opacity);
	i = i + 0.05;
	
	if (i < 0.90)
	{
	 	 lay.style.opacity = i;
		 lay.style.filter = 'alpha(opacity=' + (i * 100) + ')';
		 lay.style.width = '400px';
	}
}


function locateJavaFS()
{
	lay=document.getElementById('floatlayer');
	
	lay.style.display = "";
	lay.style.position='absolute';
	lay.style.top= document.body.scrollTop + getWidgetLocationHeightFS();
	lay.style.left= document.body.scrollLeft + getWidgetLocationWidthFS();
}


function followsiteshow(legacy, myself, followsite_url, followthis_subject)
{
		if (followsite_url == '')		followsite_url = location.href; 
		if (followthis_subject == '')	followthis_subject = document.title; 
		
		var setting1354=020; 
		
		var mydiv=myself.getElementsByTagName('img'); 
		
		if (mydiv && mydiv[0])
		{
		 	 myself = mydiv[0]; 
			 setting1354=0; 
		}

		var posArr = FSgetPos(myself); 
		
		var windowSizeArr = FSgetWindowSize();
		var topPos = posArr[1]+setting1354+1; 
		var leftPos = posArr[0]; 
		var offsetArr = FSgetOffset(); 
		
		var lElement=document.getElementById('followthis_layer'); 
		lElement.style.display='block'; 
		if (leftPos-offsetArr[0]+lElement.clientWidth+25>windowSizeArr[0])leftPos=leftPos-lElement.clientWidth; 
		if (topPos-offsetArr[1]+lElement.clientHeight+myself.clientHeight+25>windowSizeArr[1])topPos=topPos-lElement.clientHeight-25; 
		
		lElement.style.left=leftPos+'px'; 
		
		var setTop = topPos + myself.clientHeight;
		
		if (legacy == '') lElement.style.top=topPos+myself.clientHeight+'px';
		else		  lElement.style.top=(topPos+myself.clientHeight - 15)+'px';
		
		if (followthis_hidden)
		{

		 	 var trueLeftPos=leftPos+lElement.clientWidth; 
			 var trueLeftTop=topPos+lElement.clientHeight; 
			 
			 var eElement=document.getElementsByTagName('embed'); 
			 var eElementPosArr=0;
			 var eElementLeft=0;
			 var eElementTop=0; 
			 
			 for (i=0; i<eElement.length; i++)
			 {
			 		 eElementPosArr=FSgetPos(eElement[i]); 
					 eElementLeft=eElementPosArr[0]; 
					 eElementTop=eElementPosArr[1]; 
					 
					 if (leftPos<eElementLeft+eElement[i].clientWidth && topPos<eElementTop+eElement[i].clientHeight && 
					 		 trueLeftPos>eElementLeft && trueLeftTop>eElementTop && eElement[i].style.visibility!='hidden')
					 {
					 		 	 eElement[i].style.visibility='hidden';
			 		 }
			 }
		}
		
		return false; 
}


function FSgetPos(oElement)
{
 		var top=0;
		var left=0; 
		
		do 
		{
		 	 left+=oElement.offsetLeft; 
			 top+=oElement.offsetTop;
			 oElement=oElement.offsetParent; 
		}
		while (oElement); 
		
		return [left,top]; 
}


function FSgetWindowSize()
{
 		var winWidth=0; 
		var winHeight=0; 

		if (typeof(window.innerWidth)=='number')
		{
		 	 winWidth=window.innerWidth; 
			 winHeight=window.innerHeight;
		}
		else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
		{
		 	 winWidth=document.documentElement.clientWidth; 
			 winHeight=document.documentElement.clientHeight; 
		}
		else if (document.body && (document.body.clientWidth || document.body.clientHeight))
		{
		 	 winWidth=document.body.clientWidth; 
			 winHeight=document.body.clientHeight; 
		}
		
		return [winWidth,winHeight]; 
}

function FSgetOffset()
{
 		var offsetLeft=0; 
		var offsetTop=0; 
		
		if (typeof(window.pageYOffset)=='number')
		{
		 	 offsetTop=window.pageYOffset; 
			 offsetLeft=window.pageXOffset; 
		}
		else if (document.body && (document.body.scrollLeft || document.body.scrollTop))
		{
		 	 offsetTop=document.body.scrollTop; 
			 offsetLeft=document.body.scrollLeft; 
		}
		else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
		{
		 	 offsetTop=document.documentElement.scrollTop; 
			 offsetLeft=document.documentElement.scrollLeft; 
		}

		return [offsetLeft,offsetTop]; 
}

function showFollowSiteBox( )
{
followthis_hidden = true; 

var boxContent ='<div id="followthis_layer" style="z-index: 1001; position: absolute; display: none">'; 
boxContent+='<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" '; 
boxContent+='width="350" height="200" bgcolor="#FFFFFF"><tr><td width="100%"><iframe src ="http://www.followsite.com/pop/?url=' + document.URL + '" width="100%" '; 
boxContent+='height="100%" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe></td></tr><tr><td width="100%" height="25" '; 
boxContent+='bgcolor="#C0C0C0"><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"><tr><td><font '; 
boxContent+='face="Arial" size="1">&nbsp;Thank You</font></td><td><p align="right"><b><font face="Arial" '; 
boxContent+='size="2"><a style="color: #000000; text-decoration: none" href="javascript:followsiteBoxHide();">Close Window</a>&nbsp;&nbsp;'; 
boxContent+='</font></b></p></td></tr></table></td></tr></table>\n'; 
boxContent+='\x3c/div>\n'; 

divObj=document.createElement('div'); 
divObj.innerHTML = boxContent; 
document.body.insertBefore(divObj,document.body.firstChild); 
divObj.style.zIndex=2000000; 
}

function followsiteBoxHide()
{
 	 var mydif = document.getElementById('followthis_layer');
   mydif.style.display = "none";
}


showFollowSiteBox(); 
//mainInitHoverFS();