//    To use this script, simply define the first or both variables below...

 
var image = "images/garafola_hotbtn-left.gif";	// The path to & name of the image.
 var link  = "javascript:window.open('http://mynb.mynjlistings.com/','window_popup_response','resizable,scrollbars,dependent');void 0";	//Link URL, if want the image to be a link.
 var alt  = "Search The Entire MLS";	//alt for image
 var flvwidth = "130";
 var flvheight = "56";
 var flvtime = "";
 var floaterCookieName = "";
 
/*
 ------------------------------------------------------------------------------
 
     Bobby Java Floater v2.1
     Created by:  Bobby Thompson (bobby@torgo.org)
     http://www.bobbyware.com/
     
     COMPATABILITY
     This script currrently works with each of the following browsers:
     Internet Explorer, FireFox, Netscape, Safari & Mozilla
     
     
     USAGE
     define the 'image' and optional 'link' variables, then put the following in
     the page that you want to add the floater to:
            <SCRIPT LANGUAGE="JavaScript" SRC="js/jfloat_cookie.js"></SCRIPT> 
     
     
     GENERAL INFORMTATION
     This JavaScript  file  will suspend  a logo image in  the lower  right hand
     corner of a  browser window.  Optionally,  the suspended  image can be used
     as a link.
     When   the  browser  window   is  resized  or   scrolled,  the  image  will
     automatically move back down to the lower  right corner.  When  it does, it
     will move in a "fluid" manner.
     
     This script was 100%  developed by me.  It was not influcenced by by  other
     symiler scripts.  I actually wrote this based off my first version (1.0) to
     solve a problem at  work,  and have  since greatly  expanded it.  So please
     don't copy my work.
     
     
     LEGAL
     You are free to use this script on any page you would like (even commercial
     pages),  The ONLY  qualification is that this comments  section MUST remain
     intacked...
     
     --------------------------------------------------------
     Copyright(c) 2002-2004, Bobby Thompson (bobby@torgo.org)
          http://www.torgo.org/
     --------------------------------------------------------
     143 ÄÄ
     
 ------------------------------------------------------------------------------
*/

var showFloater;

if ( floaterCookieName == "" ) { //if no cookie name is provided then always show floater
	showFloater = true;
	//document.write("<p>Cookie disabled.  Always Show Floater");
}
else {
	if ( getCookie(floaterCookieName) == "" ) { // cookie not found so show floater
		showFloater = true;
		// set cookie so it isn't shown the next time
		setFloaterCookie(floaterCookieName)
		//document.write("<p>Shown for first time.  Cookie " + floaterCookieName + " has been set");
	}
	else { // don't show the floater
		showFloater = false;
		//document.write("<p>Cookie " + floaterCookieName + " says to not play again");
	}
}

if ( showFloater ) {


try {

	document.write('<DIV ID="float_pane" STYLE="position:absolute;visibility:hidden;width:' + flvwidth + 'px;height:' + flvheight + 'px;z-index:10;">\n');
	if( link != "" )
	document.write('<A HREF="' + link + '">');
	document.write('<IMG SRC="' + image + '" BORDER="0" ALT="' + alt + '">');
	//document.write('<p>&nbsp;<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + flvwidth + '" height="' + flvheight + '" id="' + image + '" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + image + '" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#cccccc" /><embed src="' + image + '" quality="high" wmode="transparent" bgcolor="#cccccc" width="' + flvwidth + '" height="' + flvheight + '" name="' + image + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>');
	if( link != "" )
		document.write('</A>');
	document.write('\n</DIV>');

	var fl_oTop, fl_oLeft, fl_tTop, fl_tLeft, fl_tHeight, fl_tWidth, fl_tShow;
	var fl_cHeight = 0;
	var fl_cWidth = 0;
	
	getValues();
	if( fl_cHeight && fl_cWidth ) {
		setTop(fl_cHeight + document.body.scrollTop - (  eval(fl_tHeight) + 3 ));
		eval(fl_tShow);
		setInterval("floatRefresh()",5);
	}
	if(flvtime) { setTimeout("eval(fl_tHide)", flvtime); }
} catch(e) {}

}



	function checkAgent(_agent) {
		return( navigator.userAgent.toLowerCase().indexOf(_agent.toLowerCase()) != -1 );
	}
	function isMozilla() {
		return navigator.userAgent.lastIndexOf("/") == (navigator.userAgent.indexOf('Gecko/') + 5)
	}

	function getTop() {
		eval( "var _result = parseInt(" + fl_tTop + ")" );
		return _result;
	}
	function getLeft() {
		eval( "var _result = parseInt(" + fl_tLeft + ")" );
		return _result;
	}

	function setTop(_value) {
		eval( fl_tTop + " = _value" );
	}

	function floatRefresh() {
		getValues();
		fl_oTop = getTop() - (fl_cHeight + document.body.scrollTop - (  eval(fl_tHeight) + 3 ));
		if( fl_oTop < 0)
			setTop(getTop() + 1 + (Math.round(Math.abs(getTop() - (fl_cHeight + document.body.scrollTop - (  eval(fl_tHeight) ))) / 10)));
		if(  fl_oTop > 0 )
			setTop(getTop() - ( 1 + (Math.round(Math.abs(getTop() - (fl_cHeight + document.body.scrollTop - (  eval(fl_tHeight) ))) / 10))));
	}
	function getValues() {
		if( checkAgent("Safari") ) {
			fl_cHeight = document.body.clientHeight;
			fl_cWidth = document.body.clientWidth;
			fl_tTop = "float_pane.style.pixelTop";
			fl_tLeft = "float_pane.style.pixelLeft";
			fl_tHeight = "float_pane.offsetHeight+20";
			fl_tWidth = "float_pane.offsetWidth";
			fl_tShow = "float_pane.style.visibility = 'visible'";
			fl_tHide = "float_pane.style.visibility = 'hidden'";
		} else if( checkAgent("MSIE") ) {
			fl_cHeight = document.body.clientHeight;
			fl_cWidth = document.body.clientWidth;
			fl_tTop = "float_pane.style.pixelTop";
			fl_tLeft = "float_pane.style.pixelLeft";
			fl_tHeight = "float_pane.offsetHeight+100";
			fl_tWidth = "float_pane.offsetWidth";
			fl_tShow = "float_pane.style.visibility = 'visible'";
			fl_tHide = "float_pane.style.visibility = 'hidden'";
		} else if( checkAgent("FireFox") || isMozilla()) {
			fl_cHeight = document.body.clientHeight;
			fl_cWidth = document.body.clientWidth;
			fl_tTop = "float_pane.style.top";
			fl_tLeft = "float_pane.style.left";
			fl_tHeight = "float_pane.offsetHeight+33";
			fl_tWidth = "float_pane.offsetWidth";
			fl_tShow = "float_pane.style.visibility = 'visible'";
			fl_tHide = "float_pane.style.visibility = 'hidden'";
		} else if( checkAgent("Netscape") ) {
			fl_cHeight = document.body.clientHeight;
			fl_cWidth = document.body.clientWidth;
			fl_tTop = "document.getElementById('float_pane').style.top";
			fl_tLeft = "document.getElementById('float_pane').style.left"
			fl_tHeight = "document.getElementById('float_pane').offsetHeight";
			fl_tWidth = "document.getElementById('float_pane').offsetWidth";
			fl_tShow = "document.getElementById('float_pane').style.visibility = 'visible'";
			fl_tHide = "document.getElementById('float_pane').style.visibility = 'hidden'";
		}
	}


function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function setFloaterCookie(c_name)
{
document.cookie=c_name+ "=1;" 
}