if (top.location != self.location){
				top.location.replace(self.location);
			}

			if(document.location.protocol == 'http:'){

				var loc = new String(document.location);
					loc = loc.replace('http:','https:');
				document.location.replace(loc);
			}

$(document).ready(function(){
//Zakładki
var act='zk';
$('#tabers img').click(function(){
if(this.id!=act){
$('#a_'+act).css('display','none');
$("#"+act).attr('src','img/'+act+'.jpg');
$("#a_"+this.id).fadeIn();
act=this.id;
$("#"+this.id).attr('src','img/'+this.id+'1.jpg');
}
return false;
});
$('a').focus(function(){
$(this).blur();
});
//Pełna klauzula
$('.show1').click(function(){
$("#kla1").css('display','block');
$("#kla2").css('display','block');
return false;
});
$('.show').click(function(){
$('.partners').css('display','none');
$('#'+this.id+'_more').css('display','block');
return false;
});
$('.close_button').click(function(){
$("#kla1").css('display','none');
$("#kla2").css('display','none');
return false;
});
//Przezroczystość
$('.opacity_hover').mouseover(function(){
	$(this).css('opacity','0.7').css('filter','alpha(opacity=70)');
	
});
$('.opacity_hover').mouseout(function(){
	$(this).css('opacity','1');
	
});
$('.wups').click(function(){
	window.open(this.href);
	return false;
});
//Znikanie zawartości pól formularza
$('input, textarea').click(function(){
if(this.name=='name' && this.value=='Imię')	this.value='';
else if(this.name=='surname' && this.value=='Nazwisko')	this.value='';
else if(this.name=='pesel' && this.value=='Pesel')	this.value='';
else if(this.name=='phone' && this.value=='Telefon')	this.value='';
else if(this.name=='form_tresc' && this.value.substring(0,66)=='Wymyśl i wpisz hasło konkursowe promujące Kartę Kredytową Citibank') this.value='';
});
$('input, textarea').blur(function(){
if(this.name=='name' && this.value=='')	this.value='Imię';
else if(this.name=='surname' && this.value=='')	this.value='Nazwisko';
else if(this.name=='pesel' && this.value=='')	this.value='Pesel';
else if(this.name=='phone' && this.value=='')	this.value='Telefon';
else if(this.name=='form_tresc' && this.value=='')	this.value='Wymyśl i wpisz hasło konkursowe promujące Kartę Kredytową Citibank';
});

function checkpesel(v) {
	var tab_pesel = v.split('');
	var w = new Array(1,3,7,9);
	var wk = 0;
	for (var l=0; l<=9; l++) wk = (wk + tab_pesel[l]*w[l%4]) % 10;
	var k = (10-wk) % 10;
	if ( tab_pesel[10] != k ) return false;
	return true;

}

$('#wyslij').click(function(){
	var pola=document.forms[0].elements;
	var errmsg='';
	for (var i=0;i<pola.length;i++){
	if(pola[i] && pola[i]!=undefined && pola[i].type && pola[i].type!='submit'){
			if ( pola[i].name=='name' ){
					if (pola[i].value=='Imię' || pola[i].value==''){
						errmsg+="Wpisz imię\n";
					}
					else if(!/^[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ]{3,20}$/.test(pola[i].value)){
						errmsg+="Niepoprawna wartość pola imię\n";
					}
				}
				
			if ( pola[i].name=='surname' ){
					if (pola[i].value=='Nazwisko' || pola[i].value==''){
						errmsg+="Wpisz nazwisko\n";
					}
					else if(!/^[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ\-]{3,30}$/.test(pola[i].value)){
						errmsg+="Niepoprawna wartość pola nazwisko\n";
					}
				}
				
			if ( pola[i].name=='phone'){
					if (pola[i].value=='Telefon' || pola[i].value==''){
						errmsg+="Wpisz telefon\n";
					}
					else if(!/^\+*[0-9\s\-\(\)\+]{9,24}$/.test(pola[i].value)){
						errmsg+="Niepoprawna wartość pola telefon\n";
					}
				}
				
			if ( pola[i].name=='pesel' ){
					if (pola[i].value=='Pesel' || pola[i].value==''){
						errmsg+="Wpisz pesel\n";
					}
					else if(!/^[0-9]{11}$/.test(pola[i].value) || !checkpesel(pola[i].value) || pola[i].value==00000000000){
						errmsg+="Niepoprawna wartość pola pesel\n";
					}
				}
			if(pola[i].tagName.toLowerCase()=='textarea'){
			if(pola[i].value.substring(0,11)=='Twoje hasło') {
					errmsg+='Wpisz hasło\n';
					}
			}
			if ( pola[i].name=='agreed' || pola[i].name=='zgoda' ){
				if(!pola[i].checked){
					errmsg+="Musisz wyrazić zgodę na przetwarzanie danych\n";
				}
			}
		
		}
	}
	if(errmsg!='') {
				alert(errmsg);
				return false;
	}
	else {
	document.forms[0].submit();
	return false;
	}
});

function getUParam(par, fromString) {
	par=par.toLowerCase();
	qstr=window.location.search;
	if ( typeof fromString != "undefined" && typeof fromString != "function" && fromString!= '' ) {
		qstr=fromString;
	}
	qstr=qstr.toLowerCase();
	if ( qstr.indexOf('=') >=0 && qstr.indexOf(par) >=0 ) {
		var tmp = new RegExp(".*[\\?\\&]+"+par+"=([\\w\\d]+).*").exec(qstr);
		if (tmp) {
			return tmp[1];
		}
	} else { 
		return '';
	}
};
$('#OTH1').val(getUParam('prID'));
if(getUParam('bankierID')!='') $('#OTH3').val(getUParam('bankierID'));
else $('#OTH3').val(getUParam('moneyID'));
});