

function popup(page) {
	window.open(page, 'preview', 'width=800,height=540,scrollbars');
}


function popup2(page) {
	window.open(page, 'preview', 'width=644,height=520,scrollbars');
}

function pickcolor(elm,elm2, color)
 {
    window.open('./colorpicker/colorpicker.htm#'+elm.id+'?'+elm2.id+'*'+color,'','location=0,status=0,scrollbars=0,width=550,height=325');
 }
 
 function wstaw()
 {
 
  if (document.getElementById('szerokosc').value.match(/^[0-9]{1,3}$/)) 
	{	
	
  
    document.getElementById('szerokosc').value
   
    var style = "style=\"font-family:"+document.getElementById('czcionka').value+"; font-size:1em; font-size-adjust:none; font-style:normal; font-variant:normal; font-weight:normal; line-height:normal; float: left; width: "+document.getElementById('szerokosc').value+"px; padding: 10px; background-color: "+"#"+document.getElementById('tlo_color').value+"; border: "+"1px solid #"+document.getElementById('obramowanie_color').value+"\"";
   //alert("2");
    var tresc = "<div "+style+">";
    
    if(document.getElementById('kat_0').checked)
    {
      tresc = tresc+"<div style=\"margin-bottom:2px;\"><strong style=\"color: "+"#"+document.getElementById('tytul_color').value+";\">"+document.getElementById('kat_0').value+"</strong><br/></div>";
    }
    
    tresc = tresc+"<ul style=\"margin-bottom: 0px; padding-left: 14px;\">";
    
    if(document.getElementById('kat_1').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/airconditioning-and-heating\">"+document.getElementById('kat_1').value+"</a></li>"; }
    if(document.getElementById('kat_2').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/carpentry\">"+document.getElementById('kat_2').value+"</a></li>"; }
    if(document.getElementById('kat_3').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/cleaning-up-after-buildings\">"+document.getElementById('kat_3').value+"</a></li>"; }
    if(document.getElementById('kat_4').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/electrical-works\">"+document.getElementById('kat_4').value+"</a></li>"; }
    if(document.getElementById('kat_5').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/general\">"+document.getElementById('kat_5').value+"</a></li>"; }
    if(document.getElementById('kat_6').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/handyman\">"+document.getElementById('kat_6').value+"</a></li>"; }
    if(document.getElementById('kat_7').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/job\">"+document.getElementById('kat_7').value+"</a></li>"; }
    if(document.getElementById('kat_8').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/joints\">"+document.getElementById('kat_8').value+"</a></li>"; }
    if(document.getElementById('kat_9').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/landscaping-and-gardening\">"+document.getElementById('kat_9').value+"</a></li>"; }
    if(document.getElementById('kat_10').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/painting-and-decorating\">"+document.getElementById('kat_10').value+"</a></li>"; }
    if(document.getElementById('kat_11').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/plastering-and-tiling\">"+document.getElementById('kat_11').value+"</a></li>"; }
    if(document.getElementById('kat_12').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/plumbing\">"+document.getElementById('kat_12').value+"</a></li>"; }
    if(document.getElementById('kat_13').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/tools-hire\">"+document.getElementById('kat_13').value+"</a></li>"; }
    if(document.getElementById('kat_14').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/transport\">"+document.getElementById('kat_14').value+"</a></li>"; }
    if(document.getElementById('kat_15').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/roofing\">"+document.getElementById('kat_15').value+"</a></li>"; }
    if(document.getElementById('kat_16').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/security-and-alarm-systems\">"+document.getElementById('kat_16').value+"</a></li>"; }
    if(document.getElementById('kat_17').checked){ tresc = tresc+"<li style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><a style=\"color: "+"#"+document.getElementById('kategorie_color').value+";\" href=\"http://www.building24.co.uk/windows-and-doors\">"+document.getElementById('kat_17').value+"</a></li>"; }
    
    tresc = tresc+"</ul>";
    
    //tresc = tresc+"<span style=\"margin-bottom: 0px; padding-left: 0px;\">";
    
    /*if(document.getElementById('kat_1').checked)
    {
      tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\"><div style=\"float: left; width:20px;\">&bull;&nbsp;&nbsp;</div><div style=\"float: left;\">"+document.getElementById('kat_1').value+"<br/></div></span>";
    }
    if(document.getElementById('kat_2').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_2').value+"<br/></span>"; }
    if(document.getElementById('kat_3').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_3').value+"<br/></span>"; }
    if(document.getElementById('kat_4').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_4').value+"<br/></span>"; }
    if(document.getElementById('kat_5').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_5').value+"<br/></span>"; }
    if(document.getElementById('kat_6').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_6').value+"<br/></span>"; }
    if(document.getElementById('kat_7').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_7').value+"<br/></span>"; }
    if(document.getElementById('kat_8').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_8').value+"<br/></span>"; }
    if(document.getElementById('kat_9').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_9').value+"<br/></span>"; }
    if(document.getElementById('kat_10').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_10').value+"<br/></span>"; }
    if(document.getElementById('kat_11').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_11').value+"<br/></span>"; }
    if(document.getElementById('kat_12').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_12').value+"<br/></span>"; }
    if(document.getElementById('kat_13').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_13').value+"<br/></span>"; }
    if(document.getElementById('kat_14').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_14').value+"<br/></span>"; }
    if(document.getElementById('kat_15').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_15').value+"<br/></span>"; }
    if(document.getElementById('kat_16').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_16').value+"<br/></span>"; }
    if(document.getElementById('kat_17').checked){ tresc = tresc+"<span style=\"padding-top: 3px; color: "+"#"+document.getElementById('kategorie_color').value+";\">&bull;&nbsp;&nbsp;"+document.getElementById('kat_17').value+"<br/></span>"; }
    */
    //tresc = tresc+"</span>";
    
    
    
    //alert("3");
    tresc = tresc+"</div>";
    //alert("4");
    document.getElementById('prewiew').innerHTML = tresc;
    document.getElementById('wynik').value = tresc; 
  }
  
  //alert()
 //alert("5");
 }
