/* usuniecie blura z linków*/
function BlurLinks(){
	if(document.getElementById){
			aElement=document.getElementsByTagName('a');
			for(i=0;i<aElement.length;i++){
				aElement[i].onfocus=new Function("if(this.blur)this.blur()");
			}
	}
}
/*
	Funkcja do resetowania formularza
*/
	
	function resetForm(formName,action) {
		var myString = "document."+formName+"."+action+"();";
		eval(myString);
	}

/*
	Funkcje do zmiany właciwoci inputów	
*/
	function changeProperty(/*object*/ID){
		document.getElementById(ID).className = 'InputTextActiv';
	}
	function refreshProperty(/*object*/ID){
		ID.className = 'InputText';
	}

/*
	Funkcje do zmiany właciwoci inputów w poleceniu strony	
*/
	function changePropertyPolec(/*object*/ID,/*value*/OldValue){
		document.getElementById(ID).className = 'InputTextActiv';
		document.getElementById(ID).value = OldValue;
	}
	function refreshPropertyPolec(/*object*/ID){
		ID.className = 'InputText';
	}

/*Funkcja do otwierania wycentrowanego popupa*/

	function openCenteredPopup( url , name , width , height ) {
		x = (screen.width - width)/2;
		y = (screen.height - height)/2;
		window.open(url,name,'width='+width+',height='+height+',left='+x+',top='+y);
	}

/*
	Funkcja do wyświetlania odpowiedzi 	
*/
	function showAnswer( /*mixed*/ id ){
		if (document.getElementById(id)){
			if (document.getElementById(id).style.display == "none"){
				document.getElementById(id).style.display = "block";}
			else {document.getElementById(id).style.display = "none";}
		}
	}

/*
	Funkcja obsługująca uzupełnianie selectów z rokiem i miesiącem w nowościach
*/

function updateMonths() {
	selectedYear = document.getElementById('y').options[document.getElementById('y').selectedIndex].value;
	tableWithMonths = years[selectedYear];
	with (document.getElementById('m')) {
		for(i=options.length-1;i>0;i--) options[i] = null; // null out in reverse order (bug workarnd)
		for(i=0;i<tableWithMonths.length;i++){
			options[i+1] = new Option(tableWithMonths[i]["label"],tableWithMonths[i]["value"]);
			if (tableWithMonths[i]["selected"] == "true") {
				options[i+1].selected = true;
			}
		}
	}
}

/*
	Funkcja sprawdzająca, czy nie wybrano w selekcie z miesiącami (w nowościach) pierwszego 
	elementu (z napisem "wybierz")
*/

function checkMonth( oSelect ) {
	if (oSelect.selectedIndex != 0) {
		document.getElementById("newsDate").submit();
		return true;
	} else {
		return false;
	}
}




/* OPENMAIL */
function dodaj(){
	okno = window.open('','','width=290,height=260');
	with(document.subform) {
		jump=action+'?job=dodaj_email&email='+(email.value)+'&lista='+(lista.value)+'&redirect_brak_emaila='+(redirect_brak_emaila.value)+'&redirect_email_niepraw='+(redirect_email_niepraw.value)+'&redirect_email_juz_jest='+(redirect_email_juz_jest.value)+'&redirect_dodano='+(redirect_dodano.value)+'&redirect_usunieto='+(redirect_usunieto.value)+'&redirect_brak_w_bazie='+(redirect_brak_w_bazie.value)
	}
	//alert(jump);
	okno.location = jump;
}
function usun(){
	okno = window.open('','','width=290,height=260');
	with(document.subform) {
		jump=action+'?job=usun_email&email='+(email.value)+'&lista='+(lista.value)+'&redirect_brak_emaila='+(redirect_brak_emaila.value)+'&redirect_email_niepraw='+(redirect_email_niepraw.value)+'&redirect_email_juz_jest='+(redirect_email_juz_jest.value)+'&redirect_dodano='+(redirect_dodano.value)+'&redirect_usunieto='+(redirect_usunieto.value)+'&redirect_brak_w_bazie='+(redirect_brak_w_bazie.value)
	}
	
	okno.location = jump;
}
