		/* FLOWPLAYER */
		function przeladuj(id) {
			if (id == -1){
				document.getElementById('reklama_300').style.display = 'none';
				document.getElementById('dane_filmu').style.display = 'block';
				//odliczanie();
			}
			else {
				document.getElementById('dane_filmu').style.display = 'none';
				document.getElementById('reklama_300').style.display = 'block';
				odliczanie();
			}
		}

		function js_program(id){
			ile_js = 7;
			for (cc = 0; cc < ile_js; cc++){
				document.getElementById('pr_'+cc).style.backgroundImage = '';
				document.getElementById('pr_'+cc).style.color = '#666666';
				document.getElementById('tabela_'+cc).style.display = 'none';
			}

			document.getElementById('pr_'+id).style.backgroundImage = 'none';
			document.getElementById('pr_'+id).style.color = '#0970B2';
			document.getElementById('tabela_'+id).style.display = 'block';
		}


function powiadom(id){
	if (id > 0) {
		document.getElementById('pz').style.visibility = 'visible';
		document.getElementById('pz_film').value = id;
	}
}
function powiadom_close(id){
	document.getElementById('pz').style.visibility = 'hidden';
}
/*function sprawdzAdres(email) {
	var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;
	if (dobryEmail.test(email))
		return true
	else 
		return false;
}*/
function sprawdzAdres (emailStr) {
	var checkTLD=1;
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	var matchArray=emailStr.match(emailPat);
	if (matchArray==null) {
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	for (iq=0; iq<user.length; iq++) {
		if (user.charCodeAt(iq)>127) {
			return false;
		}
	}
	for (iq=0; iq<domain.length; iq++) {
		if (domain.charCodeAt(iq)>127) {
			return false;
		}
	}
	if (user.match(userPat)==null) {
		return false;
	}
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var iq=1;iq<=4;iq++) {
			if (IPArray[iq]>255) {
				return false;
			}
		}
		return true;
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (iq=0;iq<len;iq++) {
		if (domArr[iq].search(atomPat)==-1) {
			return false;
		}
	}
	if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {
		return false;
	}
	if (len<2) {
		return false;
	}
	return true;
}
function explodeArray(item,delimiter) { 
	tempArray=new Array(1); 
	var Count=0; 
	var tempString=new String(item); 

	while (tempString.indexOf(delimiter)>0) { 
		tempArray[Count]=tempString.substr(0,tempString.indexOf(delimiter)); 
		tempString=tempString.substr(tempString.indexOf(delimiter)+1,tempString.length-tempString.indexOf(delimiter)+1); 
		Count=Count+1 
	} 

	tempArray[Count]=tempString; 
	return tempArray; 
}
function trim(str) {
	var	str = str.replace(/^\s\s*/, ''),
		ws = /\s/,
		i = str.length;
	while (ws.test(str.charAt(--i)));
	return str.slice(0, i + 1);
}
function powiadom_send(){
	id = document.getElementById('pz_film').value;
	if (id > 0){
		nad = document.getElementById('pz_nad').value;
		adr = document.getElementById('pz_adr').value;
		
		al = '';

		if (nad == '')
			al += "Nie podano adresu nadawcy!\n";
		else if (!sprawdzAdres(nad))
			al += "'" + nad + "' nie jest poprawnym adresem e-mail!\n";
		if (adr == '')
			al += "Nie podano adresu odbiorcy!\n";
		else {
			tab = new Array();
			tab = explodeArray(adr,',');
			send = '';

			for (ix = 0; ix < tab.length; ix++){
				odb = trim(tab[ix]);
				if (odb != ''){
					if (!sprawdzAdres(odb))
						al += "'" + odb + "' nie jest poprawnym adresem e-mail!\n";
					else
						send = send + odb + ',';
				}
			}
					
			if (send == '')
				al += "Nie podano adresu odbiorcy!\n";
		}

		if (al != '')
			alert(al);
		else {
			document.getElementById('pz_form').style.display = 'none';
			document.getElementById('pz_wait').style.display = 'block';
			x_powiadomZnajomego(id,nad,send,powiadomKomunikat);
		}
	}
}

function powiadomKomunikat(ans){
	eval(ans);
	if (odp){
		document.getElementById('pz_buu').style.display = 'none';
		document.getElementById('pz_jupi').style.display = 'block';
		document.getElementById('pz_nad').value = '';
		document.getElementById('pz_adr').value = '';
	}
	else {
		document.getElementById('pz_jupi').style.display = 'none';
		document.getElementById('pz_buu').style.display = 'block';
	}

	document.getElementById('pz_form').style.display = 'block';
	document.getElementById('pz_wait').style.display = 'none';
}

function problemo(){
	var result = confirm("Aby prawidłowo odtwarzać filmy w Telewizji B2BTV powinieneś mieć zainstalowany najnowszą wersję Adobe Flash Player.\n\nJeżeli chcesz zainstalować Adobe Flash Player, kliknij przycisk OK. Zostaniesz przeniesiony na stronę instalacyjną, tam kliknij \"Agree and install now\" i postępuj zgodnie z komunikatami.\n\nJeżeli nie chcesz niczego instalować, kliknij ANULUJ.");
	if(result){
		location.href='http://www.adobe.com/go/getflashplayer';
	}
	else{
		return false;
	}
}


