// 	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
var DOM = (document.getElementsByTagName);
var ns6 = (DOM && !document.all)?true:false;
var ie5 = (DOM && document.all)?true:false;
var ie4 = (!DOM && document.all)?true:false;
var ns4 = (!DOM && !document.all)?true:false;
window.defaultStatus = "SEMESTR - Ogólnopolski Miesiecznik Studencki";

var dzis = new Date();
var 
dzisRok = dzis.getYear();
var nastepnyRok = new Date(dzisRok+1, 0, 1);
var poprzedniRok = new Date(dzisRok, 0, 1);
var dni = new Array('Niedziele', 'Poniedzialek', 'Wtorek', 'Srode', 'Czwartek', 'Piatek', 'Sobote');
var mies = new Array('Styczenia', 'Lutego', 'Marca', 'Kwietnia', 'Maja', 'Czerwca', 'Lipca', 'Sierpnia', 'Wrzesnia', 'Pazdziernika', 'Listopada', 'Grudnia');

var doKoncaDni = Math.round((nastepnyRok.getTime()-dzis.getTime())/1000/60/60/24);

var colors =  new Array();
colors[0] = "#CCCCCC";
colors[1] = "#999999";
colors[2] = "#666666";
colors[3] = "#333333";
colors[4] = "#000000"

var licznikNapisow= 0;
var licznikKolorow = 0;
var startFadeOut = false;
var timer=false;
var obrazki = new Array();


function wyczysc(nazwa){
	if (nazwa.value=="tutaj wpisz tekst"){
		nazwa.value = ""; 
	}
}
function sprawdz(){
	var el = document.forms['logowanie'].elements;
	if (el['login'].value=='') { alert("Nie podalas (-les) loginu"); return false; }
	if (el['pass'].value=='') { alert("Nie podalas (-les) hasla"); return false; }
	return true;
}
function writit(id,color,txt){ //zmienna color okresla jaki kolor ma byc przeslany
	if (!txt) txt = "Mamy godzine "+podajCzas();
	if (DOM){
		x = document.getElementById(id);
		x.innerHTML = '""';
		x.innerHTML = '<DIV  style="color:'+color+'";>' +txt+'</DIV>';
	}
	else if (ie4){
		x = document.all[id];
		x.innerHTML = '<DIV style="color:'+color+'">' + txt + '</DIV>';
	}
	else if (ns4){
		x = document.layers[id];
		text2 = '<CENTER><P style="color:'+color+'">'+txt + '</P></CENTER>';
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}
function colorsFadeIn(){
	++licznikKolorow;
	if (licznikKolorow >=colors.length) {
		licznikKolorow=0;
		++licznikNapisow;
		startFadeOut=true;
	}
	return colors[licznikKolorow];
}
function colorsFadeOut()//ta funkcja musi byc wywolana po colorsFadeIn bo jest zalezna od zmiennej globalnej tamze ustawianej
{
	if (licznikKolorow <= colors.length-2)	return colors[colors.length-licznikKolorow-2];
	else return colors[0];	
}
function txtFadeIn()
{
	if (licznikNapisow >= text.length) {
		licznikNapisow=0;
	}
	return text[licznikNapisow];
}
function txtFadeOut() //ta funkcja mus byc wywolana po txtFadeIn bo jest zalezna od zmiennej globalne tamze ustawianej
{
	var numerOut = licznikNapisow-1;
	if (!licznikNapisow) numerOut = text.length-1;
	return text[numerOut];
}
function fade()
{
	writit('zegarek1',colorsFadeIn(),txtFadeIn());
	if (startFadeOut) {
		writit('zegarek2',colorsFadeOut(),txtFadeOut());		
	}
	if (licznikKolorow != colors.length-1) {
		timer = setTimeout('fade()',250);
	} else {
		timer = setTimeout('fade()',2500);
	}
}
function podajCzas(){
	var data = new Date();
	var sekundy = data.getSeconds();
	var minuty = data.getMinutes();
	var godziny = data.getHours();
	czas = (godziny < 10 ? '0'+godziny:godziny) + ':';
	czas += (minuty <10 ? '0'+minuty:minuty) + ':';
	czas += sekundy < 10 ? '0'+sekundy:sekundy;
	return czas;
}
function okienkoMejl(adres){
		if (adres.substring(0, 2) == 'id'){
			var adres = 'http://www.semestr.pl/mejl.php?' + adres;
		}
		var wys = 320;
		var szer = 400;
		var srodekX = screen.availWidth/2;
				srodekX -= szer/2;
		var srodekY = screen.availHeight/2;
				srodekY -= wys/2;
		if (document.all){
				var nowe = window.open(adres,'mejl',"'scrollbars=0, HEIGHT="+wys+",WIDTH="+szer+",top="+srodekY+",left="+srodekX+"'")		
		}
		else {
				var nowe = window.open(adres,  'mejl', "',HEIGHT="+wys+", WIDTH="+szer+", screenY="+srodekY+", screenX="+srodekX+"'");
		}
		nowe.focus();
}
function otworz(adres, nazwa, szer, wys){
	var srodekX = screen.availWidth/2;
				srodekX -= szer/2;
	var srodekY = screen.availHeight/2;
				srodekY -= wys/2;
	var ustawienia = 'scrollbars=yes,height='+wys+',width='+szer+',';
	if (document.all){
			ustawienia +='top='+srodekY+',left='+srodekX;
	}
	else {
			ustawienia += 'screenY='+srodekY+', screenX='+srodekX;
	}
	ustawienia +=',resizable=yes'
	nowe = window.open(adres,nazwa,ustawienia)
	nowe.focus();
}

function pokazSchowaj(id){
		if (DOM)
			za = document.getElementById(id);
		else if (ie4)
			za = document.all[id];
		else
			return;
		var wyswietl = (za.style.display == 'none') ? true:false;
		//alert(wyswietl);
		if (wyswietl) {
			za.style.display = 'block'
			za.style.position = 'relative';
		} else {
			za.style.display = 'none'
			za.style.position = 'absolute';
		}
}
function wszystkie(c){
		if (DOM){
			/*zmienna miastaIlosc jest przesylana przez PHP do przegladarki */
			for (i=0; i<miastaIlosc; i++){
					var id = document.getElementById('miasto'+i);
					if (c == "pokaz"){
						id.style.display = 'block';
						id.style.position = 'relative';
					}else if  (c == "chowaj"){
						id.style.position = 'absolute';
						id.style.display = 'none'
					}
			}
		}	else {
				alert('Prosimy o uzywanie przegladarek IE5, NS6 lub nowszych');
		}
}
function selectURL(s) {
	var gourl = s.options[s.selectedIndex].value;
	window.top.location.href = gourl; 
}
function menuPokazSchowaj(lewa)
{
	if (!lewa) {
		var nazwa = 'prawa';
		var img = document.images['prawaStrzalka'];
	} else  {
		var nazwa = 'lewa';
		var img = document.images['lewaStrzalka'];
	}
	
	if (DOM)
		var lew = document.getElementById(nazwa);
	else if (ie4)
		var lew = document.all[nazwa]
	
	if (lew.style.display=='block') {
		lew.style.display='none';
		if (!lewa) 
			img.src = 'http://www.semestr.pl/shared/lewa.gif';
		else 
			img.src = 'http://www.semestr.pl/shared/prawa.gif';
	} else {
		lew.style.display='block';
		if (lewa) 
			img.src = 'http://www.semestr.pl/shared/lewa.gif';
		else 
			img.src = 'http://www.semestr.pl/shared/prawa.gif';
	}
}
var natTimer = '';
var nat = '';
function myFocus()
{
	this.focus();
}
function reklama()
{
	if (!top.location.search){
		var srodekX = screen.availWidth/2;
		    srodekX -= 570/2;
		var srodekY = screen.availHeight/2;
		    srodekY -= 380/2;
		var reklama = window.open('reklama/natolin.html','reklama','width=570,height=380,top='+srodekY+',left='+srodekX+',directories=1,location=1,menubar=1,scrollbars=1,status=0,toolbar=1,resizable=1')
		reklama.blur();
	}
}
function f ()
{
	//fade();
	if (window.location == 'http://www.semestr.pl/')otworz('/reklama/2.html','reklama',560,422); //popup
}
function zmienObrazek(imgName, file)
{
	document.images[imgName].src = file;
}
function ustawXY(divX, divY, obj)
{
	//najpierw pobieramy aktualne rozmiary warstwy
	var divWidth = obj.offsetWidth;
	var divHeight = obj.offsetHeight;
	//pozniej do x i y dodajemy wys, przewijania
	if (ie4 || ie5){
		divY += document.body.scrollTop;
		divX += document.body.scrollLeft;
	}
	var zaNisko = (eval((divY-document.body.scrollTop)+ parseInt(divHeight)) > document.body.clientHeight)?true:false;
	//zmienna okreslajaca czy jest poza  widocznym obszarem w poziomie :D
	var zaSzer = (eval((divX-document.body.scrollLeft)+ parseInt(divWidth)) +20> document.body.offsetWidth)?true:false;
	//no i jezeli wystaje i w pionie i w poziomie to trzeba dac wyswietlanie "nad" kursorem
	//tak zeby "dymek" nie zakrywal linku bo wtedy onMouseOut sie wlaczy i dymek zniknie
	//czyli unieszkodliwi sam siebie :D
	if (zaSzer && zaNisko){
		obj.style.left  =	divX - 15 - divWidth;
		obj.style.top   = 	divY - 15 - divHeight;
		return;
	}
	//teraz juz sa pojedyncze warunki dla poziomu
	obj.style.left = (zaSzer)?eval(document.body.clientWidth+document.body.scrollLeft - divWidth -15):divX;
	//i pionu
	obj.style.top  = (zaNisko)?eval(document.body.clientHeight+document.body.scrollTop-divHeight-15):divY;
}
function pobierzMysz (e)
{	
	var divX = 0;
	var divY= 0;
	if (ns6 || ie5) 
		var tip = document.getElementById('tip');
	else if (ie4)
		var tip = document.all['tip'];
	if (ns6)  {
		divX = e.pageX+10; 
		divY = e.pageY+10;
	} else if (ie5) {
		divX = event.clientX + 10;
		divY = event.clientY + 10;
	}
	//window.status= 'blee'+divX+'  '+divY;
	ustawXY(divX, divY, tip);
}
function Pokaz(str) 
{
	if (str=="Brak opisu" || !str) return;
	if (ns6 || ie5)
		var tip = document.getElementById('tip');
	else if (ie4)
		var tip = document.all['tip'];
	tip.style.width = 150
	tip.innerHTML = str;
	tip.style.visibility = 'visible';
	tip.style.display = 'block'
}
function Ukryj(Blok) 
{ 
	if (ns6 || ie5) 
		var tip = document.getElementById('tip')
	 else if  (ie4) 
		var tip = document.all['tip'];
	tip.style.visibility="hidden"; 
	tip.style.display = 'none'
	tip.innerHTML = '';
}