$('.corner').corner();
$('.corner1').corner();
$('.corner2').corner();
$('.corner3').corner();

// popup dialog
$.fx.speeds._default = 600;
$(function() {
    $( "#dialog" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 300
    });
    $( "#rabatybsc" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 250
    });
    $( "#rabatypro" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 250
    });
    $( "#rabatysrv" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 270
    });
    $( "#rabatypre" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 250
    });
    $( "#rabaty5p6p" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 250
    });
    $( "#rabatyo6p" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 250
    });
    $( "#rabaty6b6p" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500
    });
    $( "#rabatyo6b" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 250
    });
    $( "#rabaty5c6s" ).dialog({
        autoOpen: false,
        show: "blind",
        hide: "explode",
        width: 500,
        height: 270
    });
    

    $( "#opener" ).click(function() {
        $( "#dialog" ).dialog( "open" );
        return false;
    });
    $( "#opener2" ).click(function() {
        $( "#dialog" ).dialog( "open" );
        return false;
    });
    $( "#openerabatybsc" ).click(function() {
        $( "#rabatybsc" ).dialog( "open" );
        return false;
    });
    $( "#openerabatypro" ).click(function() {
        $( "#rabatypro" ).dialog( "open" );
        return false;
    });
    $( "#openerabatysrv" ).click(function() {
        $( "#rabatysrv" ).dialog( "open" );
        return false;
    });
    $( "#openerabatypre" ).click(function() {
        $( "#rabatypre" ).dialog( "open" );
        return false;
    });
    $( "#openerabaty5p6p" ).click(function() {
        $( "#rabaty5p6p" ).dialog( "open" );
        return false;
    });
    $( "#openerabatyo6p" ).click(function() {
        $( "#rabatyo6p" ).dialog( "open" );
        return false;
    });
    $( "#openerabaty6b6p" ).click(function() {
        $( "#rabaty6b6p" ).dialog( "open" );
        return false;
    });
    $( "#openerabatyo6b" ).click(function() {
        $( "#rabatyo6b" ).dialog( "open" );
        return false;
    });
    $( "#openerabaty5c6s" ).click(function() {
        $( "#rabaty5c6s" ).dialog( "open" );
        return false;
    });
});

$(function() {
    $('#gallery a').lightBox({
        fixedNavigation:true,
        overlayBgColor: '#FFF',
	overlayOpacity: 0.6,
	imageLoading: './img/lightbox-ico-loading.gif',
	imageBtnClose: './img/lightbox-btn-close.gif',
	imageBtnPrev: './img/lightbox-btn-prev.gif',
	imageBtnNext: './img/lightbox-btn-next.gif',
	containerResizeSpeed: 350,
	txtImage: 'Obrazek',
	txtOf: 'z'
    });   
});

function validate(f,v,a,x){for(a=0;x=f[a++];) if((v=window[x.getAttribute('valid')])&&!v(x.value)) {alert(x.getAttribute('alert'));return!x.focus()}}
function niepuste(x){return x>''}
function ismail(e){return /^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/i.test(e)}

function przepisz(ch){  // przepisuje dane teleadresowe w formularzu zamówienia
  var pierwszy=new Array();  var drugi=new Array();
  pierwszy[0]=document.getElementById('imie');		drugi[0]=document.getElementById('imie2');
  pierwszy[1]=document.getElementById('nazwisko');	drugi[1]=document.getElementById('nazwisko2');

  pierwszy[2]=document.getElementById('ulica');		drugi[2]=document.getElementById('ulica2');
  pierwszy[3]=document.getElementById('nr');			drugi[3]=document.getElementById('nr2');
  pierwszy[4]=document.getElementById('kod');		drugi[4]=document.getElementById('kod2');
  pierwszy[5]=document.getElementById('miasto');	drugi[5]=document.getElementById('miasto2');
	
  if (ch.checked) for (i=0; i<drugi.length; i++)  drugi[i].value=pierwszy[i].value;
  else for (i=0; i<drugi.length; i++)  drugi[i].value='';
}

function isthesame()
{
    var obrazek = document.form1.Obrazek.value;

    if(document.form1.Kod.value == obrazek)
        return true;
    else{
        document.form1.Kod.focus();
        return false;
    }
}

function ischecked()
{
    if(document.form1.reg.checked)
        return true;
    else
        return false;
}
