function boxPreview() {
    var cols = $('#cols').val();
    var rows = $('#rows').val();
    var html = '<div style="padding: 5px; text-align: right;"><a href="javascript:void(0);" onclick="$(\'#preview\').hide();">zamknij</a></div>';
    for(var i =0; i < rows; i++) {
        for (var t=0; t < cols; t++) {
            html+= '<div style="float: left; width: 75px; height: 75px; float: left; border: 1px #666666 solid; margin:2px;">'+(t+1)+'</div>';
        }
        html+= '<div style="clear:both;"></div>';
    }
    $('#preview').html(html);
    $('#preview').fadeIn();
}

function creationPreview(domain) {
    var currentTime = new Date();
    var html = '<div style="padding: 5px; text-align: right;"><a href="javascript:void(0);" onclick="$(\'#img_preview\').hide();">zamknij</a></div>';
    html += '<img src="http://'+domain+'/preview?header_bg=' + $('#header_bg').val().replace('#', '');
    html+= '&header_color=' + $('#header_color').val().replace('#', '');
    html+= '&price_color=' + $('#price_color').val().replace('#', '');
    html+= '&top_color=' + $('#top_color').val().replace('#', '');
    html+= '&border_color=' + $('#border_color').val().replace('#', '');
    html+= '&background=' + $('#background').val().replace('#', '') + '&t=' + currentTime.getTime();
    html+= '" border="0" >';
    
    $('#img_preview').html(html);
    $('#img_preview').show();
}

function showCode(place, img, cols, rows, click_host) {
    var html = '<div style="text-align: right;"><a href="javascript:void(0)" onclick="$(\'#' + place +'\').slideUp();">zamknij</a></div><br/>';
    html += '<b>Skopiuj poniższy kod i wstaw go na swojej aukcji</b>\n\n<br/><textarea readonly style="width:450px; height: 185px;"><div>\n';
    html += '<div style="background: #94b2ff; width: 700px; color: #ffffff; font-size: 10px; text-align: right">Powered by <a href="http://www.mamaukcje.pl/galeria/'+place.substr(0,32)+'">mamaukcje</a></div>\n';
    html += '<img src="' + img + '" usemap="#' + place + '" border="0">\n';
    var nr = 1;
    html += '<map name="' + place + '">\n';
    var x = 0;
    var y = 0;
    var width = 175;
    var height = 190;
    var p = '';
    for (var t=0; t < rows; t++) {
        for (var w=0; w < cols; w++) {
            var cords = new Array(x, y , x+width, y+height);
            p = cords.join(',');
            html += '<area shape="rect" coords="' + p + '" href="http://' + click_host + '/click/' + place + ';' + nr + '">\n';
            nr++;
            x += width;
        }
        
        x = 0;
        y += height;
    }
    
    html += '</div>\n</div>\n</textarea>';
    $('#'+place).html(html);
    $('#'+place).slideDown();
}
