
// <script type="text/javascript" src="http://skąd ma brać ten plik ->//announcements.js"></script>
// <script type="text/javascript">
// 	initAnnouncements();
// </script>
// ********************************************************

function createCookie(name,value,hours) {
	if (hours) {
		var date = new Date();
		date.setTime(date.getTime()+(hours*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function toggleFeed() {
	if (announcementFeed_obj.sx < 0) {
		announcementFeed_obj.sx = 0;
	} else {
		announcementFeed_obj.sx = -160;
	}
	createCookie('startingPosX', announcementFeed_obj.sx, 3);
}

function initAnnouncements() {
	writeDivs();
	var cookie = readCookie('startingPosX');
	var posX = 0;
	if (cookie) {
		posX = parseInt(cookie);
	}
	JSFX_FloatDiv("announcementFeed", posX, 0, true).flt();
	JSFX_FloatDiv("wrapper", 0, -30, false).flt();
}

function writeDivs() {
	document.write('<div id="wrapper" style="position:absolute; overflow:hidden; width: 100%; height:30px; bottom:30px;">');
	document.write('<div id="announcementFeed" style="position:absolute; filter:alpha(opacity=80);-moz-opacity:.8;opacity:.8; width:100%; height:30px; padding-top:0px; font-size:11px; background-color:#A15991; color:white; text-align:left; z-index:999;">');
	document.write('	<table cellpadding="0" cellspacing="0" border="0" width="100%">');
	document.write('	<tr>');
	document.write('		<td style="width:150px; height:30px; text-align:center;">');
	document.write('			<a href="javascript:toggleFeed()" style="color:white">');
	document.write('				<b>Gorące oferty pracy:</b>');
	document.write('			</a>');
	document.write('		</td>');
	document.write('		<td height="30">');
	document.write('			<iframe src="http://bsbelchatow.nazwa.pl/select/employee/js/recent.do" id="feedFrame" width="100%" height="30" frameborder="0" border="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>');
	document.write('		</td>');
	document.write('		<td style="width:150px; height:30px; text-align:center; color:white">');
	document.write('			<a href="javascript:toggleFeed()" style="color:white">');
	document.write('				<b>schowaj pasek>>></b>');
	document.write('			</a>');
	document.write('		</td>');
	document.write('	</tr>');
	document.write('	</table>');
	document.write('</div>');
	document.write('</div>');
}



// *********************************************************
// * You may use this code for free on any web page provided that
// * these comment lines and the following credit remain in the code.
// * TopLeft Floating Div from http://www.javascript-fx.com
// ********************************************************
var ns = (navigator.appName.indexOf("Netscape") != -1);
var opera = (navigator.appName.indexOf("Opera") != -1);
var d = document;
var px = document.layers ? "" : "px";
function JSFX_FloatDiv(id, sx, sy, ignoreY) {
	var el = d.getElementById ? d.getElementById(id) : d.all ? d.all[id] : d.layers[id];
	window[id + "_obj"] = el;
	if(d.layers)el.style = el;
	el.cx = el.sx = sx;
	el.cy = el.sy = sy;
	el.sP = function(x,y) {
		this.style.left = x + px;
		if (!ignoreY) {
			this.style.top = y + px;
		}
	};
	el.init=false;
	el.flt=function() {
		var pX, pY;
		if (this.sx >= 0) {
			pX = 0;
		} else {
			if (ns || opera) {
				pX = innerWidth;
			} else {
				if (document.documentElement && document.documentElement.clientWidth) {
					pX = document.documentElement.clientWidth;
				} else {
					pX = document.body.clientWidth;
				}
			}
		}
		if (ns || opera) {
			pY = pageYOffset;
		} else {
			if (document.documentElement && document.documentElement.scrollTop) {
				pY = document.documentElement.scrollTop;
			} else {
				pY = document.body.scrollTop;
			}
		}
		if(this.sy < 0) {
			if (ns || opera) {
				pY += innerHeight;
			} else {
				if (document.documentElement && document.documentElement.clientHeight) {
					pY += document.documentElement.clientHeight;
				} else {
					pY += document.body.clientHeight;
				}
			}
		}
		this.cx += (pX + this.sx - this.cx)/8;
		this.cy += (pY + this.sy - this.cy)/8;
		if(!this.init) {
			this.init=true;
			this.cx = pX+this.sx;
			this.cy = pY+this.sy;
		}
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.flt()", 10);
	}
	return el;
}

