<!--

/*
 * Datadive static content code
 * Description: lets you specify some HTML code that will be kept visable on
 *              screen at all times, preventing it from scrolling out of the
 *              visible window area when the web page is scrolled on any direction.
 * By: gjm@datadive.com
 * Created: 2002-08-20
 */

//TODO: object orientate this a bit to remove this stuff from the global name space

ddsc_locY=0;
ddsc_scrollOffsetY=12;
ddsc_code=false;


           
//alert('MOZ: '+MOZ+' ; IE: '+IE+' ; NS4:'+NS4);
/*
daCnt=0;
function daAlert(msg) {
	if(daCnt<3) {
		alert(msg);
		daCnt++;
	}
}
*/


function staticContent(daHTML,daX,daY,daCode) {
	if (MOZ||IE) {
		document.write('<div id="ddscc" style="visibility:hidden; Position:Absolute; Left:'+daX+'px; Top:'+daY+'px; Z-Index:99;clip:">');
	} else if (NS4) {
		document.write('<layer z-index="99" visibility="hidden" name="ddscc" left="'+daX+'" top="'+daY+'">');
	}

	document.write(daHTML);

	if (MOZ||IE) {
		document.write('</div>');
	} else if (NS4) {
		document.write('</layer>');
	}
	if (MOZ||IE||NS4) {
		
		if (MOZ){
			ddsc=document.getElementById("ddscc").style;
			ddsc.visibility="visible";
		} else if (IE) {
			ddsc=document.all("ddscc").style;
			ddsc.visibility = "visible";
		} else if (NS4) {
			ddsc=document.layers["ddscc"];
			ddsc.visibility="show";
		}
		ddsc_locY=daY;
		if(daCode) {
			ddsc_code=daCode;
		}
		
		setTimeout('ddsc_keepStatic()', 1)
	}
}

function ddsc_keepStatic() {
	if(MOZ) {
		winY = window.pageYOffset;
		currentY=parseInt(ddsc.top);
	}else if (IE) {
		winY = document.body.scrollTop;
		currentY=ddsc.pixelTop;
	} else if (NS4) {
		winY = window.pageYOffset;
		currentY=ddsc.top;
	}
	if (MOZ||IE||NS4) {
		if(winY>=ddsc_locY) {
			scrollby=(ddsc_scrollOffsetY+winY-currentY)/2;
		} else {
			scrollby=(ddsc_locY-currentY)/2;
		}			
		//if(scrollby!=0) alert(scrollby);
		if(scrollby>1) {
			scrollby = Math.ceil(scrollby);
		} else if(scroll<-1) {
			scrollby = Math.floor(scrollby);
		} else if(scrollby>0 && scrollby<1) { //handle when last scroll step is odd (1/2=0.5)
			scrollby = 1;
		} else if(scrollby<0 && scrollby>-1) {//handle when last scroll step is odd (-1/2=-0.5)
			scrollby = -1;
		} 
        if(scrollby!=0) {
			if (MOZ) {
				ddsc.top=(parseInt(ddsc.top)+scrollby)+'px';
			} else if (IE) {
				ddsc.pixelTop+=scrollby;
			} else if (NS4) {
				ddsc.top+=scrollby;
			}
		}
        if(scrollby!=0) {
			if(ddsc_code!=false) {
				eval(ddsc_code);
			}
		}

		setTimeout('ddsc_keepStatic()', 20);
	}
}



// -->