// (C)Copyright 2000-2002 Feedmeback.com Ltd. All Rights Reserved.
// Feedmeback technologies and business methods are patent pending.

IE4 = (document.all) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
Mac = (navigator.appVersion.indexOf("Mac")!=-1) ? 1 : 0;
ver4 = (IE4 || NS4) ? 1 : 0;
flag=1;

if (!IE4) {
	document.write("&nbsp;");
	document.close();
	exit;
}

var bgColor,linkColor;
if (!bgColor) {
	bgColor = document.bgColor;
	if (bgColor == '#ffffff') {
		bgColor='#a0b0e0';
		if (!linkColor) linkColor='#fffa00';
	}
}
fpStyle = " background:'" + bgColor + "'; ";
fpLink = ""; if (linkColor) fpLink = " color:'" + linkColor + "'; ";
dhtml = "<STYLE TYPE='text/css'><!-- \n";
dhtml += "#fpollAnchor { position:relative; width:167px; height:217; visibility: visible;" + fpStyle + "}; \n";
dhtml += "#fpollDiv { position:absolute; left:0px; top:1px; font-size:15px; text-align:left;" + fpStyle + "}; \n";
dhtml += "#fpollContent { position:relative; left:1px; top:1px; width:165px; height:170; z-index:0; background: #ffffff; }; \n";
dhtml += ".fpNotice {font-size: 10px;  text-align: center; font-family: Arial, Helvetica, sans-serif;};\n";
//background: white; color: #5300D5;   
dhtml += "A.fpNotice:link, A.fpNotice:visited, A.fpNotice:active { font-size: 11px; text-decoration: none; }; \n";
dhtml += "A.fpNotice:hover { " + fpLink + " }; \n";
dhtml += "A.fpollDiv:link, A.fpollDiv:visited, A.fpollDiv:active { font-size: 16px;  text-decoration: none; }; \n";
dhtml += "A.fpollDiv:hover { " + fpLink + "}; \n";
dhtml += "--></STYLE> \n";

dhtml += "<DIV id='fpollAnchor'> \n";
dhtml += "<DIV id='fpollDiv' onload='oLev.startResize()'> \n";
dhtml += "&nbsp;<a target='_blank' class=fpollDiv href='http://www.f-polls.com' alt='f-Polls.com homepage'><B>Feedback Poll</B></a>";
dhtml += "<IFRAME id='fpollContent' border=0 frameborder=0 scrolling=no marginheight=4 marginwidth=5 allowTransparency='true' ";
dhtml += "src='http://www.f-polls.com/load.php3";
dhtml += "?loc=" + escape(location.href) + "&ref=" + escape(document.referrer);
//dhtml += "?bgColor=" + bgColor.replace(/#/gi,"%23");
dhtml += "'></IFRAME>\n";

dhtml += '<table width=100%><tr><td class=fpNotice nowrap><a target="_blank" class=fpNotice href="http://www.feedmeback.com" alt="Feedmeback.com Ltd. homepage">';
dhtml += '&#169; 2000-';
	cy = (new Date()).getFullYear();
	if (cy<2001) cy='2001';
dhtml += cy;
dhtml += ' Feedmeback.com<br>Pat.pending All rights reserved</a></td></tr></table>';
dhtml += "</DIV></DIV>";

//alert (dhtml);
//document.write ("<DIV ID='fpollDiv' onload='oLev.startResize()'><IFRAME name='fpollContent' STYLE='position:absolute; left:0px; top:7px; width:167px; height:188; z-index:10;' frameborder=0 scrolling=no marginheight=0 background=transparent src='load.php3'></IFRAME></DIV>");
//document.write ("<STYLE TYPE='text/css'>#fpollDiv { position:absolute; left:20px; top:100px; color:#555555; background:darkblue; font-family:verdana, arial, sans-serif; font-size:12px; }</STYLE>");
//document.write ("<DIV ID='fpollDiv' onload='oLev.startResize()'><LAYER name='fpollContent' src='http://www.feedmeback.com/load.php3'></LAYER><NOLAYER><IFRAME name='fpollContent' STYLE='position:absolute; left:0px; top:7px; width:167px; height:188; z-index:10;' frameborder=0 scrolling=no marginheight=0 background=white src='http://www.feedmeback.com/load.php3'></IFRAME></NOLAYER></DIV>");
//document.write ("<DIV ID='fpollDiv' onload='oLev.startResize()'><TEXTAREA id='report' rows=1 cols=20 wrap=physical style='font-family:arial'></TEXTAREA><IFRAME name='fpollContent' STYLE='position:absolute; left:0px; top:27px; width:167px; height:188; z-index:10;' frameborder=0 scrolling=no marginheight=0 background=transparent  src='http://www.feedmeback.com/load.php3'></IFRAME></DIV>");
//<TEXTAREA id='report' rows=1 cols=20 wrap=physical style='font-family:arial'></TEXTAREA>
//report.innerText="msg";

document.write(dhtml);
document.close();


var oLev = {
	yTarget		: 85,
	xTarget		: 100,
	callRate	: 30,
	slideTime	: 1500,
	resize		: true,
	resizeRate	: 320,
	move		: false,
	maxDiff		: IE4 ? document.body.clientHeight : window.innerHeight,
	isIE		: IE4,
	fpDiv		: document[IE4 ? "all" : "layers"]["fpollDiv"],
	fpCont		: document[IE4 ? "all" : "layers"]["fpollContent"],
	fpAnc		: document[IE4 ? "all" : "layers"]["fpollAnchor"],
	fpLink		: document[IE4 ? "all" : "layers"]["fpollLink"]
}

window.setInterval("oLev.main( )", oLev.callRate)
if ( IE4 ) window.setInterval("oLev.resize( )", oLev.resizeRate);

oLev.startResize = function ( ) {
 	this.resize = true ;
	//this.yTarget = parseInt(this.isIE ? this.fpAnc.style.offsetY : this.fpAnc.top);
	//this.xTarget = parseInt(this.isIE ? this.fpAnc.style.offsetX : this.fpAnc.left);
	//oLev.moveOnAnchor('fpollDiv', 'fpollAnchor');
}

oLev.moveOnAnchor = function (abs,rel) {
	var now	= new Date( );
	this.C = now.getTime( );

    if (IE4) {
        this.xTarget = document.all[rel].offsetLeft;
        this.yTarget = document.all[rel].offsetTop;
//		document.all[abs].style.posLeft = document.all[rel].offsetLeft;
//		document.all[abs].style.posTop = document.all[rel].offsetTop;
    } else 
	if (NS4) {
        document.layers[abs].left = document.layers[rel].pageX;
        document.layers[abs].top = document.layers[rel].pageY;
    }
}

oLev.resize = function ( ) {
return;
	if ( !this.isIE || !this.resize || !document.frames['fpollContent']['fpLoaded'])
		return;
	
	var fpA = document.all('fpollAnchor');
	var fpD = document.all('fpollDiv');
	var fpC = document.frames('fpollContent');
	var fpM = document.frames('fpollContent')['fpMargin'];
	var fpB = fpC.document.body;
	var fpBody = document.frames('fpollContent').document.body;

	fpA.style.backgroundColor = document.bgColor;
	fpA.style.pixelWidth  = fpB.scrollWidth;
	fpA.style.pixelHeight = fpB.scrollHeight + 7; // Dragging top frame size...
	fpD.style.backgroundColor = document.bgColor;
	fpD.style.pixelWidth  = fpB.scrollWidth;
	fpD.style.pixelHeight = fpB.scrollHeight + 7; // Dragging top frame size...

//	this.fpDiv.all.fpollContent.style.pixelHeight = document.frames('fpollContent').document.body.scrollHeight;
	this.fpDiv.all.fpollContent.style.pixelHeight = fpBody.scrollHeight;

	fpM.bgColor = document.bgColor;
	fpM.fgColor = document.text;
}

// Main loop. Updates targetY, and decides whether to start
// the animation over again, continue an existing animation,
// or do nothing at all.
oLev.main = function( ) {
//alert(eval(document.frames('fpollContent').document.body));

	if ( !this.move ) return;

	this.currentY	= this.isIE ? this.fpDiv.style.pixelTop : this.fpDiv.top;
	this.scrollTop	= this.isIE ? document.body.scrollTop : window.pageYOffset;
	var newTargetY	= this.scrollTop + this.yTarget;

	if ( this.currentY != newTargetY ) {

		if ( newTargetY != this.targetY ) {
			this.targetY = newTargetY;
			this.slideInit( );
		}
		this.slide( );
	}
}

// .slideInit( ). Initializes the slide animation. Sets properties
// of the oLev object that will represent the various paramaters
// for the sine wave function.
oLev.slideInit = function( ) 
{
	var now	= new Date( );
	
	this.A = this.targetY - this.currentY;
	this.B = Math.PI / ( 2 * this.slideTime );
	this.C = now.getTime( );

	if (Math.abs(this.A) > this.maxDiff) {
		this.D = this.A > 0 ? this.targetY - this.maxDiff : this.targetY + this.maxDiff;
		this.A = this.A > 0 ? this.maxDiff : -this.maxDiff;
	} else {
		this.D = this.currentY;
	}
}


// .slide( ). Moves the oLev one frame. Its rate decreases and
// is defined by a sine wave.
oLev.slide = function( ) {
 	var now		= new Date( );
	var newY	= this.A * Math.sin( this.B * ( now.getTime( ) - this.C ) ) + this.D;
	//newY		= Math.round( newY/16 )*16 ;// todo: netscape radio buttons display bug

	if (( this.A > 0 && newY > this.currentY ) ||
		( this.A < 0 && newY < this.currentY )) {

			if ( this.isIE )this.fpDiv.style.pixelTop = newY;
			else			this.fpDiv.top = newY;
	}
}
 

// Drag and drop functionality
activeEl = IE4 ? document.all.fpollDiv : document.fpollDiv;

currentX = currentY = 0;
whichEl = null;
dragIndex = "fpollD-none";
	
function grabEl(e) {
	if (IE4) {
		whichEl = event.srcElement;

		while (whichEl.id.indexOf(dragIndex) == -1) {
			whichEl = whichEl.parentElement;
			if (whichEl == null) { return }
         	if (whichEl.id.indexOf(dragIndex) != -1) { break }
		}
	}
	else {
		mouseX = e.pageX;
		mouseY = e.pageY;

		for ( i=0; i<document.layers.length; i++ ) {
			tempLayer = document.layers[i];
			if ( tempLayer.id.indexOf(dragIndex) == -1 ) { continue }
			if ( (mouseX > tempLayer.left) && (mouseX < (tempLayer.left + tempLayer.clip.width)) && (mouseY > tempLayer.top) && (mouseY < (tempLayer.top + tempLayer.clip.height)) ) {
				whichEl = tempLayer;
			}
		}

		if (whichEl == null) { return};
	}

	oLev.move = false;

	if (whichEl != activeEl) {
		if (IE4) { whichEl.style.zIndex = activeEl.style.zIndex + 1 }
			else { whichEl.moveAbove(activeEl) };
		activeEl = whichEl;
	}

	if (IE4) {
		whichEl.style.pixelLeft = whichEl.offsetLeft;
		whichEl.style.pixelTop = whichEl.offsetTop;

		currentX = (event.clientX + document.body.scrollLeft);
		currentY = (event.clientY + document.body.scrollTop); 
	} else {
		currentX = e.pageX;
		currentY = e.pageY;

		document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = moveEl;
	}
}
	
function moveEl(e) {
	if (whichEl == null) { return };

	if (IE4) {
		newX = (event.clientX + document.body.scrollLeft);
		newY = (event.clientY + document.body.scrollTop);
	} else {
		newX = e.pageX;
		newY = e.pageY;
	}

	distanceX = (newX - currentX);
	distanceY = (newY - currentY);
	currentX = newX;
	currentY = newY;

	if (IE4) {
		whichEl.style.pixelLeft += distanceX;
		whichEl.style.pixelTop += distanceY;
		event.returnValue = false;
	} else {
		whichEl.moveBy(distanceX,distanceY);
	}

	oLev.yTarget += distanceY;
}
	
function checkEl() {
	if (whichEl!=null) { return false };
}

function dropEl() {
	if (NS4) { document.releaseEvents(Event.MOUSEMOVE) }
	whichEl = null;
	//oLev.move = true;
}

function cursEl() { 
	if (IE4) {                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
		tmpEl = event.srcElement;
		while (tmpEl.id.indexOf(dragIndex) == -1) {
			tmpEl = tmpEl.parentElement;
			if (tmpEl == null) { return };
		}
		if (event.srcElement.id.indexOf(dragIndex) != -1)
			event.srcElement.style.cursor = "move";
	}
}

//main drag & drop	
if (ver4) {
	if (NS4) {
		document.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
	}
	else {
		document.onmousemove = moveEl;
		document.onselectstart = checkEl;
		document.onmouseover = cursEl;
	}
	document.onmousedown = grabEl;
	document.onmouseup = dropEl;
}







