function changeSrc(el,img){
	if(el!=null){
		el.src=img;
	}
}

function changeTlo(el,tlo){
	if(el!=null){
		el.className=tlo;
	}
}

function czy_usun(linkp,komunikat){
	if(confirm(komunikat)){
		location.href=linkp;
	}
}


function zaznacz_checkboxy(formularz,tablica,statusel) {
	var elts=(typeof(formularz.elements[tablica+'[]'])!= 'undefined') ? formularz.elements[tablica+'[]'] : '';
	var elts_cnt = (typeof(elts.length) != 'undefined') ? elts.length : 0;
	if (elts_cnt){
		for (var i = 0; i < elts_cnt; i++){ 
		 	elts[i].checked=statusel;
		}
  } else { 
		elts.checked = statusel;
	}
}


function dodajtag(FormName,FieldName,tag,prompttext) {
	if (tag=='b'){ tag_prompt='bold'; }
	if (tag=='i'){ tag_prompt='italic'; }
	inserttext = prompt(prompttext+'\n<'+tag+'>xxx</'+tag+'>','');
	if ((inserttext != null) && (inserttext != '')) {
		document.forms[FormName].elements[FieldName].value += '<'+tag+'>'+inserttext+'</'+tag+'>';
	}
	document.forms[FormName].elements[FieldName].focus();
}

function emotikony_obrazek(pole,znaczek) {
  emotikony_pole=document.getElementById(pole);
  emotikony_pole.value=emotikony_pole.value+znaczek;
  emotikony_pole.focus();
}


function popup_image(okno,imageURL,imageTitle,w,h,margines){

	if(margines==''){
		$margines=0;
	}

	w=w+(2*margines);
	h=h+(2*margines);
	
	PositionY=(screen.height-h)/2; 
	if (PositionY<0){
		PositionY=0;
	}
	
	PositionX=(screen.width-w)/2; 
	if (PositionY<0){
		PositionY=0;
	}	
	
	
  var imgWin = window.open('',okno,'scrollbars=no,resizable=1,width='+w+',height='+h+',left='+PositionX+',top='+PositionY);
	//popup blockers should not cause errors
  if( !imgWin ) { 
		return true; 
	}

	imgWin.moveTo(PositionX,PositionY);
	imgWin.resizeTo(w,h);	
  imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><\/head><body style="margin:0px; padding:0px; text-align:center"><div style="padding:'+margines+'px">'+'<img src="'+imageURL+'" alt=\"\" style=\"cursor:pointer\" onclick=\"window.close();\" />'+'<\/div><\/body><\/html>');
	
	imgWin.document.close();	
	
  if( imgWin.focus ) { 
		imgWin.focus(); 
	}

}

function popup_open(okno,adres,w,h,margines) {

	if(margines==''||!margines||margines=='undefined'||isNaN(margines)){
		margines=0;
	}

	w=w+margines;
	h=h+margines;

	top_okno=(screen.height-h)/2; 
	if (top_okno<0){
		top_okno=0;
	}
	left_okno=(screen.width-w)/2; 
	
	if (left_okno<0){
		left_okno=0;
	}

	imgWin=window.open(adres,okno,'top='+top_okno+',left='+left_okno+',width='+w+',height='+h+',toolbar=no,menubar=no,location=no,directories=no,alwaysRaised=no,status=no,scrollbars=no,resizable=yes,fullscreen=0');
	
	imgWin.moveTo(left_okno,top_okno);
	imgWin.resizeTo(w,h);	
			
	//popup blockers should not cause errors
  if( !imgWin ) { 
		return true; 
	}		
	
  if( imgWin.focus ) { 
		imgWin.focus(); 
	}

} 

function spr_email(email){
	var forma_email=/^(?:(?:\w\-*)+\.?)*\w+@(?:(?:\w\-*)+\.)+\w{1,4}$/;
	return forma_email.test(email);
}

String.prototype.trim=function(){
	return this.replace(/^\s*|\s*$/g,"");
}


function AppInit(){

	baner_br=0;
	baner_ile=0;
	var banery_lista=new Array();	
	baner_panel=document.getElementById('banery_poziom');
		
	bannersInit();
	
	if(baner_ile){
		newBanner();
	}
}

function bannersInit(){

	if(baner_panel){
	
		banery_lista=baner_panel.getElementsByTagName('div');		
		baner_ile=banery_lista.length;
			
	}
	
}

function newBanner(){
	speed=2500;
	
	for(i=0;i<baner_ile;i++){
		banery_lista[i].style.display='none';
	}
	banery_lista[baner_br].style.display='';	
	
	if(baner_br==(baner_ile-1)){
		baner_br=0;
	} else {
		baner_br++;
	}
	setTimeout("newBanner()",speed);	
	
}


//** Tab Content script- Š Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06
//** Last modified: karnet, Jan 14th, 07

var enabletabpersistence=1; // enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object();

function TabContentExpandContent(linkobj) {
  var ulid=linkobj.parentNode.parentNode.id; // id of UL element
  var ullist=document.getElementById(ulid).getElementsByTagName("li"); // get list of LIs corresponding to the tab contents
  for (var i=0; i<ullist.length; i++) {
      ullist[i].className=""; //deselect all tabs
      if (typeof tabcontentIDs[ulid][i]!="undefined") // if tab content within this array index exists (exception: More tabs than there are tab contents)
         document.getElementById(tabcontentIDs[ulid][i]).style.display='none'; //hide all tab contents
  }
  linkobj.parentNode.className="TabSelected";  // highlight currently clicked on tab
  document.getElementById(linkobj.getAttribute("rel")).style.display='block'; //expand corresponding tab content
  TabContentSaveSelectedId(ulid, linkobj.getAttribute("rel"));
}

function TabContentExpandTab(tabcontentid, tabnumber) { // interface for selecting a tab (plus expand corresponding content)
  var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber];
  if (thetab.getAttribute("rel")) TabContentExpandContent(thetab);
}

function TabContentSaveIds(ulid, relattribute) { // save ids of tab content divs
  if (typeof tabcontentIDs[ulid]=="undefined") // if this array doesn't exist yet
     tabcontentIDs[ulid]=new Array();
  tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute;
}

function TabContentSaveSelectedId(ulid, selectedtabid) { // set id of clicked on tab as selected tab id & enter into cookie
  if (enabletabpersistence==1) // if persistence feature turned on
     TabContentSetCookie(ulid, selectedtabid);
}

function TabContentGetUlListLinkById(ulid, tabcontentid) { //returns a tab link based on the ID of the associated tab content
  var ullist=document.getElementById(ulid).getElementsByTagName("li");
  for (var i=0; i<ullist.length; i++) {
      if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid) {
         return ullist[i].getElementsByTagName("a")[0];
         break;
      }
  }
}

function TabContentInitialize() {
  var uls=document.getElementsByTagName("ul");
  for (var i=0; i<uls.length; i++) if (uls[i].getAttribute("id")&&uls[i].getAttribute("id").substr(0,3)=='Tab') {
      arguments[i]=uls[i].getAttribute("id");
      // old behavior // for (var i=0; i<arguments.length; i++){ // loop through passed UL ids
      if (enabletabpersistence==0 && TabContentGetCookie(arguments[i])!="") // clean up cookie if persist=off
         TabContentSetCookie(arguments[i], "");
      var clickedontab=TabContentGetCookie(arguments[i]); // retrieve ID of last clicked on tab from cookie, if any
      var ulobj=document.getElementById(arguments[i]);
      var ulist=ulobj.getElementsByTagName("li"); // array containing the LI elements within UL
      for (var x=0; x<ulist.length; x++) { // loop through each LI element
          var ulistlink=ulist[x].getElementsByTagName("a")[0]
          if (ulistlink.getAttribute("rel")) {
             TabContentSaveIds(arguments[i], ulistlink.getAttribute("rel")); // save id of each tab content as loop runs
             ulistlink.onclick=function(){
               TabContentExpandContent(this);
               ulistlink.blur();
               return false;
             }
             if (ulist[x].className=="TabSelected" && clickedontab=="") // if a tab is set to be selected by default
                TabContentExpandContent(ulistlink); // auto load currenly selected tab content
          }
      } //end inner for loop
      if (clickedontab!="") { // if a tab has been previously clicked on per the cookie value
         var culistlink=TabContentGetUlListLinkById(arguments[i], clickedontab);
         if (typeof culistlink!="undefined") // if match found between tabcontent id and rel attribute value
            TabContentExpandContent(culistlink) // auto load currenly selected tab content
         else // else if no match found between tabcontent id and rel attribute value (cookie mis-association)
         TabContentExpandContent(ulist[0].getElementsByTagName("a")[0]); // just auto load first tab instead
      }
  } //end outer for loop
}

function TabContentGetCookie(Name){
  var re=new RegExp(Name+"=[^;]+", "i"); // construct RE to search for target name/value pair
  if (document.cookie.match(re)) // if cookie found
     return document.cookie.match(re)[0].split("=")[1]; // return its value
  return "";
}

function TabContentSetCookie(name, value) {
  document.cookie = name+"="+value; // cookie value is domain wide (path=/)
}


function adv_closeOut() { 
	adv=document.getElementById('adv_layer');
  adv.style.visibility='hidden';
  adv.style.display='none';
}

function player_play4(pole,plik,wlacz){

	 flashembed(pole, 
		{
			src:'player/FlowPlayerClassic.swf',
			width: 450, 
			wmode:'opaque',
			height: 300
		},
		{config: {   
			autoPlay: wlacz,
			usePlayOverlay:false,
			autoBuffering: wlacz,
			controlBarBackgroundColor:'0x000000',
			splashImageFile:'img/film.jpg',			
			initialScale: 'scale',
			loop:false,
			playList: [ { url: plik } ]

		}} 
	);			
				
}