 $(document).ready(function(){ 

 
		var regex_colspan =   /^.*colspan:([0-9]){1,2}.*$/;
		var x=0;
		$("table.tableDetails td").each(function(){
			if (regex_colspan.test($(this).text())!=false){
				
				var cols =  "" + $(this).text().match(/colspan:[0-9]{1,2}/);
				var cols1 =  "" + $(this).text().match(/.*colspan:[0-9]{1,2}/);
				var newName = "" + cols1.split("colspan",1);
				$(this).text(newName);
				cols = cols.substring(8,13);
				cols = parseInt(cols);
				
				for(z=1;z<cols;z++){
					$(this).next().remove();
				}
				//alert("a");
				if ($.browser.msie) {
					this.setAttribute('colSpan', 10);
				} else {
					$(this).attr("colspan", cols);
				}
			}
		});




	if ($.browser.msie){
		$(".ne").css("margin-top","0px");
		$(".ne").css("height","150px");
	//	alert("a");
	}  


			if ($(".new_top_subpage").length!=0){
			$(".new_top_subpage").attr("id","top_new_flash");
			var fo = new FlashObject("/tpl/swf/top_podstrona.swf", "swf_home_top", "1000", "158", "8", "");
			fo.addParam("allowScriptAccess", "sameDomain");
			fo.addParam("quality", "high");
			fo.addParam("wmode", "transparent");
			fo.write("top_new_flash");
	}
		$("body").find("div.w0:first").addClass("new_top");
		$("body").find("div.bp1:first").css("margin-top","0px");
		
		$("div.new_right div.pr").css("margin-top", "0px")
	
        $('.transp_png, .pm, .plusik').pngFix();
		$('a.otwiera_na_szarym_tle').lightBox();
		$("#adres_korespondencyjny").click(function() {
			if ($(this).hasClass('active'))
			{
				$("#table_korespondencyjny").hide();
				$(this).removeClass("active");
			} else {
				$("#table_korespondencyjny").css("display", "table");
				$(this).addClass("active");
			}
			return true;
		});

		$("#aw_nie").click(function() {
			$(".tak_kiedy").hide();
		});
		$("#aw_tak").click(function() {
			$(".tak_kiedy").show();
		});

		$("#pk_nie").click(function() {
			$(".tak_programy").hide();
		});
		$("#pk_tak").click(function() {
			$(".tak_programy").show();
		});

		$('.newWyksztalcenie').click(newWyksztalcenie);
 		$('.newDoswiadczenie').click(newDoswiadczenie);

 });

document.FILE_ID = 0;

function newWyksztalcenie() {
	document.FILE_ID++;
	$table = $('#wyksztalcenie');
	$table.append('<tr><td class="spacer" colspan="2"></td></tr><tr><td class="b3"><label for="szkola_'+document.FILE_ID+'">Nazwa szkoły/uczelni:</label></td><td class="w20"><div class="inputdl"><input type="text" id="szkola_'+document.FILE_ID+'" name="szkola['+document.FILE_ID+']" /></div></td></tr><tr><td class="b3"><label for="zawod_'+document.FILE_ID+'">Zawód/specjalizacja/tytuł naukowy:</label></td><td class="w20"><div class="inputdl"><input type="text" id="zawod_'+document.FILE_ID+'" name="zawod['+document.FILE_ID+']" /></div></td></tr><tr><td class="b3"><label for="rok_ukonczenia_'+document.FILE_ID+'">Rok ukończenia:</label></td><td class="w20"><div class="inputdl"><input type="text" id="rok_ukonczenia_'+document.FILE_ID+'" name="rok_ukonczenia['+document.FILE_ID+']" /></div></td></tr>');
	return false;
}

document.WYKSZ_ID = 0;
function newDoswiadczenie() {
	document.WYKSZ_ID++;
	$table = $('#doswiad');
	$table.append('<tr><td class="spacer" colspan="2"></td></tr><tr><td class="b3"><label for="czas_trwania_'+document.WYKSZ_ID+'">Czas trwania:</label></td><td class="w20"><div class="inputdl"><input type="text" id="czas_trwania_'+document.WYKSZ_ID+'" name="czas_trwania['+document.WYKSZ_ID+']" /></div></td></tr><tr><td class="b3"><label for="nazwa_firmy_'+document.WYKSZ_ID+'">Nazwa firmy:</label></td><td class="w20"><div class="inputdl"><input type="text" id="nazwa_firmy_'+document.WYKSZ_ID+'" name="nazwa_firmy['+document.WYKSZ_ID+']" /></div></td></tr><tr><td class="b3"><label for="stanowisko_'+document.WYKSZ_ID+'">Stanowisko:</label></td><td class="w20"><div class="inputdl"><input type="text" id="stanowisko_'+document.WYKSZ_ID+'" name="stanowisko['+document.WYKSZ_ID+']" /></div></td></tr><tr><td class="b3"><label for="zakres_czynnosci_'+document.WYKSZ_ID+'">Podstawowy zakres czynności:</label></td><td class="w20"><div class="inputd2"><textarea class="b1" id="zakres_czynnosci_'+document.WYKSZ_ID+'" name="zakres_czynnosci['+document.WYKSZ_ID+']"></textarea></div></td></tr>');
	return false;
}	 
	 
	 
	function drukuj(adres) {
	window.open(adres,'_blank','toolbar=yes, location=no, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes, copyhistory=no, width=715, height=500')
}


plus = new Image();
plus.src = "tpl/g/plus.png"; 
minus = new Image();
minus.src = "tpl/g/minus.png";

tab=new Array();

function rozwin2(nr){
 
 // alert(nr);
  
 if (tab[nr]!=null){   
 
 $('#w'+nr).slideUp(200);
 tab[nr]=null;
 $('#a'+nr).attr('src', plus.src);
 } else {
 $('#w'+nr).slideDown(200);
 tab[nr]=1;
 $('#a'+nr).attr('src', minus.src);
 }
  
}





function rozwin(nr){
 
 // alert(nr);
 
 for (var i in tab){
 
	if (i!=nr){
		if (tab[i] != null){
		$('#w'+i).slideUp(200);
		tab[i]=null;
		$('#a'+i).attr('src', plus.src);
		}
	}
 }
 
  
 if (tab[nr]!=null){   
 
 $('#w'+nr).slideUp(200);
 tab[nr]=null;
 $('#a'+nr).attr('src', plus.src);
  
 } else {
 $('#w'+nr).slideDown(200);
 tab[nr]=1;
 $('#a'+nr).attr('src', minus.src);
 }
  
}





plus1 = new Image();
plus1.src = "tpl/g/plus1.png"; 
minus1 = new Image();
minus1.src = "tpl/g/minus1.png";

tab1=new Array();

function rozwin1(nr){
 
 // alert(nr);
 
  
 if (tab1[nr]!=null){   
 
 $('#w'+nr).slideUp(200);
 tab1[nr]=null;
 $('#a'+nr).attr('src', plus1.src);
  
 } else {
 $('#w'+nr).slideDown(200);
 tab1[nr]=1;
 $('#a'+nr).attr('src', minus1.src);
 }
  
}


function search_submit(){
 document.getElementById('fszukaj').submit();
}

function top_click(){
 location.href="/pl/";
}






function wyslij_stock(){

 var f=document.getElementById('xs');
 

if (
	f.odd.value != "DD" &&
	f.odm.value != "MM" &&
	f.odr.value != "RRRR" &&
    f.dod.value != "DD" &&
	f.dom.value != "MM" &&
	f.dor.value != "RRRR"
	) {
	
	  f.submit();
	  
	} else {
	
		alert("Wpisz poprawnie wszystkie dane w formularzu");
		
	}
	
}


function wyslij_new(){




 var f=document.getElementById('xs');
 
 
  if ( 
  
    (
	f.odd.value == "DD" &&
	f.odm.value == "MM" &&
	f.odr.value == "RRRR" &&
    f.dod.value == "DD" &&
	f.dom.value == "MM" &&
	f.dor.value == "RRRR"
	) && 
	(f.szukaj.value == "" || f.szukaj.value == "słowo" )
	) {
	alert("Wpisz poprawnie wszystkie dane w formularzu");
	return;
	}
	
	
	
	if (
	
	(
	f.odd.value != "DD" ||
	f.odm.value != "MM" ||
	f.odr.value != "RRRR" ||
    f.dod.value != "DD" ||
	f.dom.value != "MM" ||
	f.dor.value != "RRRR"
	) &&
	
	(
	f.odd.value != "DD" ||
	f.odm.value != "MM" ||
	f.odr.value != "RRRR" ||
    f.dod.value != "DD" ||
	f.dom.value != "MM" ||
	f.dor.value != "RRRR"
	)
	
	
	)  {

	f.submit();
	//alert("Wpisz poprawnie wszystkie dane w formularzu");
	//return;

	
	}
	
	
	
	
  
  

  
  
}



function mailInfo(info, page){
	var okno = window.open(page+"?i="+info, "", "width=500,height=400");
}
