// INSTALACJA PASKA NA STRONIE:
// WKLEIC PONIZSZY KOD WEWNATRZ BODY STRONY
// 
// <script type="text/javascript" src="http://ankieta.workservice.pl/javascript/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() {

	var divHTML = '<div id="announcementFeed" style="width:100%; height:30px; padding-top:0px; font-size:11px; background-color:#1f6ba9; color:white; text-align:left;">';
	divHTML += '	<table cellpadding="0" cellspacing="0" border="0" width="100%">';
	divHTML += '	<tr>';
	divHTML += '		<td style="width:170px; height:30px; text-align:center; vertical-align: middle;">';
	divHTML += '			<a href="http://lepszapraca.workservice.pl/index.php/oferty_pracy" style="color:white; text-decoration: none">';
	divHTML += '				<div style="width: 150px; text-align: left; padding-left: 20px;"><b>Oferty lepszej pracy:<img src="/design/inwestorski/images/left_banner_arrow.gif" style="width:9px; height: 7px; float: none; padding-left: 10px;"></b></div>';
	divHTML += '			</a>';
	divHTML += '		</td>';
	divHTML += '		<td height="30">';
	divHTML += '			<iframe src="http://ankieta.workservice.pl/temp/announcement/list/recent.do?targetSystem=lepsza_praca" id="feedFrame" width="100%" height="30" frameborder="0" border="0" marginheight="0" marginwidth="0" scrolling="no"></iframe>';
	divHTML += '		</td>';
	divHTML += '	</tr>';
	divHTML += '	</table>';
	divHTML += '</div>';


	var announcementsDiv = document.getElementById("wrapper");
	announcementsDiv.innerHTML = divHTML;
}



// *********************************************************
// * 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 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;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth : 
		document.documentElement && document.documentElement.clientWidth ? 
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? 
		document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0) 
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ? 
		document.documentElement.clientHeight : 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;
}
