function changecss(theClass,element,value) {
	//Last Updated on June 23, 2009
	//documentation for this script at
	//http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html
	 var cssRules;

	 var added = false;
	 for (var S = 0; S < document.styleSheets.length; S++){

    if (document.styleSheets[S]['rules']) {
	  cssRules = 'rules';
	 } else if (document.styleSheets[S]['cssRules']) {
	  cssRules = 'cssRules';
	 } else {
	  //no rules found... browser unknown
	 }

	  for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
	   if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
	    if(document.styleSheets[S][cssRules][R].style[element]){
	    document.styleSheets[S][cssRules][R].style[element] = value;
	    added=true;
		break;
	    }
	   }
	  }
	  if(!added){
	  if(document.styleSheets[S].insertRule){
			  document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);
			} else if (document.styleSheets[S].addRule) {
				document.styleSheets[S].addRule(theClass,element+': '+value+';');
			}
	  }
	 }
	}

  function setActive(eid){
	document.getElementById('div1').className='not_active';
	document.getElementById('div2').className='not_active';
	document.getElementById('div3').className='not_active';
	document.getElementById('div4').className='not_active';
 
	if(eid==1){
		document.getElementById('div1').className='active';
	}else if(eid==2){
		document.getElementById('div2').className='active';
	}else if(eid==3){
		document.getElementById('div3').className='active';
	}  else if(eid==4){
		document.getElementById('div4').className='active';
	}
	
	whenLoad(eid);
};


function setActiveMultiTab(id_active, id_n_1, id_n_2, id_n_3, id_n_4, id_n_5){

	if(id_active>0){
		document.getElementById('div'+id_active).className='active';
	}
	if(id_n_1>0){
		document.getElementById('div'+id_n_1).className='not_active';
	}
	if(id_n_2>0){
		document.getElementById('div'+id_n_2).className='not_active';
	}
	if(id_n_3>0){	
		document.getElementById('div'+id_n_3).className='not_active';
	}
 	if(id_n_4>0){	
		document.getElementById('div'+id_n_4).className='not_active';
	}
	if(id_n_5>0){	
		document.getElementById('div'+id_n_5).className='not_active';
	}
	
	whenLoadMultiTab(id_active, id_active, id_n_1, id_n_2, 0)
};

function whenLoadMultiTab(a_active, a_1, a_2, a_3, a_4) {
//alert('Prefresh');
	//nieaktywny
	
	if(a_1>0){
		changecss('#a_'+a_1,'border-bottom','1px solid #757575');
		changecss('#a_'+a_1,'background','#F1EFE2');
	}	
	if(a_2>0){
		changecss('#a_'+a_2,'border-bottom','1px solid #757575');
		changecss('#a_'+a_2,'background','#F1EFE2');
	}
	if(a_3>0){
		changecss('#a_'+a_3,'border-bottom','1px solid #757575');
		changecss('#a_'+a_3,'background','#F1EFE2');
	}
	if(a_4>0){
		changecss('#a_'+a_4,'border-bottom','1px solid #757575');
		changecss('#a_'+a_4,'background','#F1EFE2');
	}

//aktywny element
	if(a_active>0){
		changecss('#a_'+a_active,'border-bottom','1px solid #FFFFFF');
		changecss('#a_'+a_active,'background','#FFFFFF');
	}
		
};


function whenLoad(eid) {
//alert('Prefresh');
	//nieaktywny
changecss('#a1','border-bottom','1px solid #757575');
changecss('#a1','background','#F1EFE2');
changecss('#a2','border-bottom','1px solid #757575');
changecss('#a2','background','#F1EFE2');
changecss('#a3','border-bottom','1px solid #757575');
changecss('#a3','background','#F1EFE2');
changecss('#a4','border-bottom','1px solid #757575');
changecss('#a4','background','#F1EFE2');

//aktywny element
	if(eid==1){
		changecss('#a1','border-bottom','1px solid #FFFFFF');
		changecss('#a1','background','#FFFFFF');
	}else if(eid==2){
		changecss('#a2','border-bottom','1px solid #FFFFFF');
		changecss('#a2','background','#FFFFFF');
	}else if(eid==3){
		changecss('#a3','border-bottom','1px solid #FFFFFF');
		changecss('#a3','background','#FFFFFF');
	}  else if(eid==4){
		changecss('#a4','border-bottom','1px solid #FFFFFF');
		changecss('#a4','background','#FFFFFF');
	}
		
};

function photo(obr) {
  window.open(obr, 'Prezentacja',"toolbar=no,directories=no,width=547,height=787,status=no,scrollbars=no,resizable=yes,menubar=no, top=50, left=50");
//window.open("photo.php?img="+obr,"","toolbar=no,directories=no,width=450,height=620,status=no,scrollbars=no,resizable=no,menubar=no, top=50, left=325")
}

