<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
} // Exit if accessed directly
$config = get_option( 'bowsxWpApn' );
?>
    <script type="text/javascript">
        var oAmazilonTag = {
            'typ': 'template',
            'template': '',
            'asin': '',
            'tag': '',
            'tplInfobox': '',
            'tplHidelegend': '',
            'tplStars': '',
            'tplPrime': '',
            'tplSavings': '',
            'tplPname': '',
            'tplButtontext': '',
            'tplButtonTpl': 0,
            'tplHeaderlegend': '',
            'tplImagelegend': '',
            'tplProductlegend': '',
            'tplPricelegend': '',
            'tplSavingslegend': '',
            'tplRatingslegend': '',
            'tplPrimelegend': '',
            'tplButtonlegend': '',
            'tplStatelegend': '',
            'tplFeatures': '',
            'tplFmax': '',
            'false': ''
        };

        loadTag3 = function (oTag) {
            if (typeof oTag == 'object') {
                if (oTag.typ && (oTag.typ == 'vergleich' || oTag.typ == 'vergleich2')) {
                    jQuery('#amazilon-tabcontent-generator-3 .template').val(oTag.typ);
                    delete oTag.template;
                }
                if (oTag.template) {
                    if (oTag.template.substring(oTag.template.length - 1) == 's') {
                        jQuery('#amazilon-tabcontent-generator-3 .template').val(oTag.template.substring(0, oTag.template.length - 1));
                        jQuery('#amazilon-tabcontent-generator-3 .schatten').prop('checked', true);
                    } else {
                        jQuery('#amazilon-tabcontent-generator-3 .template').val(oTag.template);
                        jQuery('#amazilon-tabcontent-generator-3 .schatten').removeProp('checked');
                    }
                }
                if (oTag.asin) {
                    jQuery('#amazilon-tabcontent-generator-3 .asin').val(oTag.asin);
                }
                if (oTag.tracking) {
                    jQuery('#amazilon-tabcontent-generator-3 .tracking').val(oTag.tracking);
                }
                if (oTag.tplPname) {
                    if (oTag.tplPname != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-pname').val(oTag.tplPname);
                    }
                }
                if (oTag.tplHeaderlegend) {
                    if (oTag.tplHeaderlegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-headerlegend').val(oTag.tplHeaderlegend);
                    }
                }
                if (oTag.tplImagelegend) {
                    if (oTag.tplImagelegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-imagelegend').val(oTag.tplImagelegend);
                    }
                }
                if (oTag.tplProductlegend) {
                    if (oTag.tplProductlegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-productlegend').val(oTag.tplProductlegend);
                    }
                }
                if (oTag.tplPricelegend) {
                    if (oTag.tplPricelegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-pricelegend').val(oTag.tplPricelegend);
                    }
                }
                if (oTag.tplSavingslegend) {
                    if (oTag.tplSavingslegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-savingslegend').val(oTag.tplSavingslegend);
                    }
                }
                if (oTag.tplRatingslegend) {
                    if (oTag.tplRatingslegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-ratingslegend').val(oTag.tplRatingslegend);
                    }
                }
                if (oTag.tplPrimelegend) {
                    if (oTag.tplPrimelegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-primelegend').val(oTag.tplPrimelegend);
                    }
                }
                if (oTag.tplButtonlegend) {
                    if (oTag.tplButtonlegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-buttonlegend').val(oTag.tplButtonlegend);
                    }
                }
                if (oTag.tplStatelegend) {
                    if (oTag.tplStatelegend != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-statelegend').val(oTag.tplStatelegend);
                    }
                }
                if (oTag.tplButtontext) {
                    if (oTag.tplButtontext != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-buttontext').val(oTag.Buttontext);
                    }
                }
                if (oTag.tplButtonTpl) {
                    if (oTag.tplButtonTpl != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-buttontpl').val(oTag.ButtonTpl);
                    }
                }
                if (oTag.tplInfobox) {
                    if (oTag.tplInfobox == '1') {
                        jQuery('#amazilon-tabcontent-generator-3 .infobox').prop('checked', true);
                    }
                }
                if (oTag.tplHidelegend) {
                    if (oTag.tplHidelegend == '1') {
                        jQuery('#amazilon-tabcontent-generator-3 .hidelegend').prop('checked', true);
                    }
                }
                if (oTag.tplStars) {
                    if (oTag.tplStars == '1') {
                        jQuery('#amazilon-tabcontent-generator-3 .stars').prop('checked', true);
                    }
                }
                if (oTag.tplSavings) {
                    if (oTag.tplSavings == 'false') {
                        jQuery('#amazilon-tabcontent-generator-3 .savings').prop('checked', true);
                    }
                }
                if (oTag.tplPrime) {
                    if (oTag.tplPrime == 'false') {
                        jQuery('#amazilon-tabcontent-generator-3 .prime').prop('checked', true);
                    }
                }
                if (oTag.tplFeatures) {
                    if (oTag.tplFeatures != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-features').val(oTag.tplFeatures);
                    }
                }
                if (oTag.tplFmax) {
                    if (oTag.tplFmax != '') {
                        jQuery('#amazilon-tabcontent-generator-3 .tpl-fmax').val(oTag.tplFmax);
                    }
                }
                apnReload3();
            }
        }

        jQuery(document).ready(function () {
            jQuery('#amazilon-tabcontent-generator-3 .apn[type="checkbox"]').each(function (index, value) {
                jQuery(this).change(apnReload3);
            });
            jQuery('#amazilon-tabcontent-generator-3 select.apn').each(function (index, value) {
                jQuery(this).change(apnReload3);
            });
            jQuery('#amazilon-tabcontent-generator-3 .apn[type="text"], #amazilon-tabcontent-generator-3 .apn[type="number"]').each(function (index, value) {
                jQuery(this).keyup(apnReload3);
            });
            jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-button').click(function () {
                apnSearch3();
                return false;
            });
            jQuery('#amazilon-tabcontent-generator-3 .amazilon-shorten-button').click(apnShorten3);
            var c = Cookies.get('amazilonAsin');
            if (typeof c !== 'undefined') {
                jQuery('#amazilon-tabcontent-generator-3 .asin').val(c);
            }
            apnReload3();
			<?php
			if ( isset( $_GET['fieldId'] ) && ! empty( $_GET['fieldId'] ) ) {
				echo 'var oObj = jQuery( window.parent.jQuery( \'#' . esc_attr( $_GET['fieldId'] ) . '\' ) ).val(); if(oObj) { loadTag3( jQuery.parseJSON( oObj ) ); } ';
			}
			?>
        });
        apnSearch3 = function () {
            jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-results').show();
            jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-results-inner').html('<img src="<?php echo admin_url( 'images/spinner.gif' );  ?>">');
            var data = {
                'action': 'amazilonSearch',
                'security': '<?php echo wp_create_nonce( 'amazilonCC' . date( 'Ym' ) ); ?>',
                'q': jQuery('#amazilon-tabcontent-generator-3 .amazilon-search').val(),
                'sIndex': jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-sindex').val()
            };

            jQuery.post(ajaxurl, data, function (response) {
                jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-results-inner').html(response);
                jQuery('#amazilon-tabcontent-generator-3 a.amazilon-search-result-entry').each(function (index, value) {
                    jQuery(this).click(apnSetAsin3).click(function () {
                        return false;
                    });
                });
                jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-results-inner').fadeIn();
            });
        }

        apnSetAsin3 = function () {
            oAsin = jQuery('#amazilon-tabcontent-generator-3 .asin');
            if (jQuery('#amazilon-tabcontent-generator-3 .template').val() == 'vergleich' || jQuery('#amazilon-tabcontent-generator-3 .template').val() == 'vergleich2') {
                if (oAsin.val().length > 0) {
                    oAsin.val(oAsin.val() + ',');
                }
                oAsin.val(oAsin.val() + jQuery(this).data('asin'));
            } else {
                oAsin.val(jQuery(this).data('asin'));
            }
            oAsin.trigger('keyup');
            jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-results').fadeOut();
        }

        apnShorten3 = function () {
            var data = {
                'action': 'amazilonShorten',
                'security': '<?php echo wp_create_nonce( 'amazilonCC' . date( 'Ym' ) ); ?>',
                'scode': jQuery('#amazilon-tabcontent-generator-3 .apnAusgabe').val()
            };

            jQuery.post(ajaxurl, data, function (response) {
                var j = jQuery.parseJSON(response);
                if (j.status == 'ok') {
                    jQuery('#amazilon-tabcontent-generator-3 input.amazilon-shortened-input').val(j.data);
                    jQuery('#amazilon-tabcontent-generator-3 label.amazilon-shortened-label').show();
                } else {
                    alert(j.msg);
                }
            });
        }

        apnReload3 = function () {
            var oAusgabe = jQuery('#amazilon-tabcontent-generator-3 .apnAusgabe');
            jQuery('#amazilon-tabcontent-generator-3 label.amazilon-shortened-label').hide();
            var sAsin = jQuery('#amazilon-tabcontent-generator-3 .asin').val();
            var sTemplate = jQuery('#amazilon-tabcontent-generator-3 .template').val();
            var sTracking = jQuery('#amazilon-tabcontent-generator-3 .tracking').val();
            var sTplPname = jQuery('#amazilon-tabcontent-generator-3 .tpl-pname').val();
            var sTplHeaderlegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-headerlegend').val();
            var sTplImagelegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-imagelegend').val();
            var sTplProductlegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-productlegend').val();
            var sTplPricelegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-pricelegend').val();
            var sTplSavingslegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-savingslegend').val();
            var sTplRatingslegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-ratingslegend').val();
            var sTplPrimelegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-primelegend').val();
            var sTplButtonlegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-buttonlegend').val();
            var sTplStatelegend = jQuery('#amazilon-tabcontent-generator-3 .tpl-statelegend').val();
            var sTplButtontext = jQuery('#amazilon-tabcontent-generator-3 .tpl-buttontext').val();
            var sTplButtonTpl = jQuery('#amazilon-tabcontent-generator-3 .tpl-buttontpl').val();
            var iTplFeatures = jQuery('#amazilon-tabcontent-generator-3 .tpl-features').val();
            var iTplFmax = jQuery('#amazilon-tabcontent-generator-3 .tpl-fmax').val();
            var bSchatten = jQuery('#amazilon-tabcontent-generator-3 .schatten').prop('checked');
            var bInfobox = jQuery('#amazilon-tabcontent-generator-3 .infobox').prop('checked');
            var bHidelegend = jQuery('#amazilon-tabcontent-generator-3 .hidelegend').prop('checked');
            var bStars = (jQuery('#amazilon-tabcontent-generator-3 .stars') ? jQuery('#amazilon-tabcontent-generator-3 input.stars').prop('checked') : false);
            var bSavings = (jQuery('#amazilon-tabcontent-generator-3 .savings') ? jQuery('#amazilon-tabcontent-generator-3 input.savings').prop('checked') : false);
            var bPrime = (jQuery('#amazilon-tabcontent-generator-3 .prime') ? jQuery('#amazilon-tabcontent-generator-3 input.prime').prop('checked') : false);

            if (sTemplate != 'vergleich' && sTemplate != 'vergleich2') {
                jQuery('#amazilon-tabcontent-generator-3 .schattenl').show();
                jQuery('#amazilon-tabcontent-generator-3 .savingsl').hide();
                jQuery('#amazilon-tabcontent-generator-3 .primel').hide();
                jQuery('#amazilon-tabcontent-generator-3 .multiAsin').hide();
            } else {
                jQuery('#amazilon-tabcontent-generator-3 .schattenl').hide();
                jQuery('#amazilon-tabcontent-generator-3 .savingsl').show();
                jQuery('#amazilon-tabcontent-generator-3 .primel').show();
                jQuery('#amazilon-tabcontent-generator-3 .multiAsin').show();
                sTplPname = '';
            }
            if (sTemplate == 'tpl-7') {
                jQuery('#amazilon-tabcontent-generator-3 .tpl-buttontpll').hide();
            } else {
                jQuery('#amazilon-tabcontent-generator-3 .tpl-buttontpll').show();
            }
            if (sTemplate == 'vergleich2') {
                jQuery('#amazilon-tabcontent-generator-3 .hidelegendl').show();
                jQuery('#amazilon-tabcontent-generator-3 .divergentlegend').show();
                jQuery('#amazilon-tabcontent-generator-3 .featuresl').show();
            } else {
                jQuery('#amazilon-tabcontent-generator-3 .hidelegendl').hide();
                jQuery('#amazilon-tabcontent-generator-3 .divergentlegend').hide();
                if (sTemplate == 'tpl-2' || sTemplate == 'tpl-5' || sTemplate == 'tpl-6') {
                    jQuery('#amazilon-tabcontent-generator-3 .featuresl').show();
                } else {
                    jQuery('#amazilon-tabcontent-generator-3 .featuresl').hide();
                    iTplFeatures = '';
                    iTplFmax = '';
                }
                sTplHeaderlegend = '';
                sTplImagelegend = '';
                sTplProductlegend = '';
                sTplPricelegend = '';
                sTplSavingslegend = '';
                sTplRatingslegend = '';
                sTplPrimelegend = '';
                sTplButtonlegend = '';
                sTplStatelegend = '';
            }
            if (bHidelegend) {
                jQuery('#amazilon-tabcontent-generator-3 .divergentlegend input').attr('disabled', 'disabled');
                jQuery('#amazilon-tabcontent-generator-3 .divergentlegend').css('opacity', .5);
                sTplHeaderlegend = '';
                sTplImagelegend = '';
                sTplProductlegend = '';
                sTplPricelegend = '';
                sTplSavingslegend = '';
                sTplRatingslegend = '';
                sTplPrimelegend = '';
                sTplButtonlegend = '';
                sTplStatelegend = '';
            } else {
                jQuery('#amazilon-tabcontent-generator-3 .divergentlegend input').removeAttr('disabled');
                jQuery('#amazilon-tabcontent-generator-3 .divergentlegend').css('opacity', 1);
            }

            if (sAsin == '' || sAsin.length < 10) {
                oAusgabe.val('<?php _e( 'Please insert the 10-digit ASIN.', 'amazilon' ); ?>');
                jQuery('#amazilon-tabcontent-generator-3 .amazilon-vorschau').hide();
                jQuery('#amazilon-tabcontent-generator-3 .apnInsert').hide();
                return;
            }

            if (sAsin.length == 10) {
                Cookies.set('amazilonAsin', sAsin);
            }

            oAmazilonTag = {
                'typ': (sTemplate == 'vergleich' || sTemplate == 'vergleich2' ? sTemplate : 'template'),
                'asin': sAsin,
                'tag': sTracking,
                'tplInfobox': (bInfobox ? '1' : ''),
                'tplHidelegend': (bHidelegend ? '1' : ''),
                'tplStars': (bStars ? '1' : ''),
                'tplSavings': (bSavings ? 'false' : ''),
                'tplPrime': (bPrime ? 'false' : ''),
                'tplPname': sTplPname,
                'tplHeaderlegend': sTplHeaderlegend,
                'tplImagelegend': sTplImagelegend,
                'tplProductlegend': sTplProductlegend,
                'tplPricelegend': sTplPricelegend,
                'tplSavingslegend': sTplSavingslegend,
                'tplRatingslegend': sTplRatingslegend,
                'tplPrimelegend': sTplPrimelegend,
                'tplButtonlegend': sTplButtonlegend,
                'tplStatelegend': sTplStatelegend,
                'tplButtontext': sTplButtontext,
                'tplButtonTpl': sTplButtonTpl,
                'tplFeatures': iTplFeatures,
                'tplFmax': iTplFmax,
                'false': ''
            };

            if (oAmazilonTag.typ == 'vergleich' || oAmazilonTag.typ == 'vergleich2') {
                oAmazilonTag.template = '';
            } else {
                oAmazilonTag.template = sTemplate + (bSchatten ? 's' : '');
            }

            var data = {
                'action': 'amazilonPreview',
                'security': '<?php echo wp_create_nonce( 'amazilonCC' . date( 'Ym' ) ); ?>',
                'template': sTemplate + (sTemplate != 'vergleich' && sTemplate != 'vergleich2' && bSchatten ? 's' : ''),
                'bInfobox': (bInfobox ? 1 : 0),
                'bHidelegend': (bHidelegend ? 1 : ''),
                'bStars': (bStars ? 1 : 0),
                'tplSavings': (bSavings ? 'false' : ''),
                'tplPrime': (bPrime ? 'false' : ''),
                'sTplPname': sTplPname,
                'sTplHeaderlegend': sTplHeaderlegend,
                'sTplImagelegend': sTplImagelegend,
                'sTplProductlegend': sTplProductlegend,
                'sTplPricelegend': sTplPricelegend,
                'sTplSavingslegend': sTplSavingslegend,
                'sTplRatingslegend': sTplRatingslegend,
                'sTplPrimelegend': sTplPrimelegend,
                'sTplButtonlegend': sTplButtonlegend,
                'sTplStatelegend': sTplStatelegend,
                'sTplButtontext': sTplButtontext,
                'sTplButtonTpl': sTplButtonTpl,
                'iTplFeatures': iTplFeatures,
                'iTplFmax': iTplFmax,
                'asin': sAsin,
                'tracking': sTracking
            };

            jQuery.post(ajaxurl, data, function (response) {
                jQuery('#amazilon-tabcontent-generator-3 .amazilon-vorschaubox').html(response);
                jQuery('#amazilon-tabcontent-generator-3 .amazilon-tooltip').each(function (idx, el) {
                    jQuery(el).tooltip();
                });
            });
            jQuery('#amazilon-tabcontent-generator-3 .amazilon-vorschau').show();
            oAusgabe.val('');

            if (sTemplate != 'vergleich' && sTemplate != 'vergleich2') {
                oAusgabe.val(oAusgabe.val() + '[apn typ="template" template="' + sTemplate + (bSchatten ? 's' : '') + '" asin="' + sAsin + '"' + (sTracking != '' ? ' tag="' + sTracking + '"' : '') + (bInfobox ? ' tpl-infobox="true"' : '') + (bStars ? ' tpl-stars="true"' : '') + (sTplButtontext != '' ? ' tpl-buttontext="' + sTplButtontext + '" ' : '') + (sTplButtonTpl != '' ? ' tpl-buttontpl="' + sTplButtonTpl + '"' : '') + ' false=""' + (sTplPname != '' ? ' tpl-pname="' + sTplPname + '"' : '') + (iTplFeatures != 0 ? ' tpl-features="' + iTplFeatures + '"' : '') + (iTplFmax != 0 && iTplFmax < 500 && iTplFmax > 0 ? ' tpl-fmax="' + iTplFmax + '"' : '') + ']' + "\n");
            } else {
                oAusgabe.val(oAusgabe.val() + '[apn typ="' + sTemplate + '" asin="' + sAsin + '"' + (sTracking != '' ? ' tag="' + sTracking + '"' : '') + (bInfobox ? ' tpl-infobox="true"' : '') + ((sTemplate == 'vergleich2' && bHidelegend) ? ' tpl-hidelegend="1"' : '') + (bStars ? ' tpl-stars="true"' : '') + (bSavings ? ' tpl-savings="false"' : '') + (bPrime ? ' tpl-prime="false"' : '') + ' tpl-buttontext="' + (sTplButtontext ? sTplButtontext : '') + '" tpl-buttontpl="' + (sTplButtonTpl != '' ? sTplButtonTpl : '') + '" false=""' + (sTplHeaderlegend != '' ? ' tpl-headerlegend="' + sTplHeaderlegend + '"' : '') + (sTplImagelegend != '' ? ' tpl-imagelegend="' + sTplImagelegend + '"' : '') + (sTplProductlegend != '' ? ' tpl-productlegend="' + sTplProductlegend + '"' : '') + (sTplPricelegend != '' ? ' tpl-pricelegend="' + sTplPricelegend + '"' : '') + (sTplSavingslegend != '' ? ' tpl-savingslegend="' + sTplSavingslegend + '"' : '') + (sTplRatingslegend != '' ? ' tpl-ratingslegend="' + sTplRatingslegend + '"' : '') + (sTplPrimelegend != '' ? ' tpl-primelegend="' + sTplPrimelegend + '"' : '') + (sTplButtonlegend != '' ? ' tpl-buttonlegend="' + sTplButtonlegend + '"' : '') + (sTplStatelegend != '' ? ' tpl-statelegend="' + sTplStatelegend + '"' : '') + (iTplFeatures != 0 ? ' tpl-features="' + iTplFeatures + '"' : '') + (iTplFmax != 0 && iTplFmax < 500 && iTplFmax > 0 ? ' tpl-fmax="' + iTplFmax + '"' : '') + ']' + "\n");
            }
            jQuery('#amazilon-tabcontent-generator-3 .apnInsert').show();
        }
        amazilonInsertShortCode3 = function (sStr, fieldId) {
            if (fieldId === undefined) {
                fieldId = '_mce';
            }
            if (fieldId == '_mce') {
                window.parent.tinyMCE.activeEditor.execCommand('mceInsertContent', 0, sStr);
            } else if (fieldId == '_qtags') {
                window.parent.QTags.insertContent(sStr);
            } else {
                jQuery(window.parent.jQuery('#' + fieldId)).val(JSON.stringify(oAmazilonTag));
            }
            window.parent.tb_remove();
        }
    </script>
    <h1><?php _e( 'Template Shortcode generator', 'amazilon' ); ?> - <?php _e( 'Amazilon', 'amazilon' ); ?></h1>

    <div class="block">
        <p><?php _e( 'Put the 10-digit product-ASIN into the field and select a template. You will recieve a finished ShortCode. Mark, copy and insert the ShortCode into your article. ',
				'amazilon' ); ?></p>
    </div>

    <div class="block">
        <p><b><?php _e( 'Search on Amazon', 'amazilon' ); ?></b><br/>
            <label for="amazilon-search" style="display: inline-block; width: 150px;"><?php _e( 'Searchterm',
					'amazilon' ); ?>: </label><input type="text" name="amazilon-search" class="amazilon-search" value=""
                                                     size="35" maxlength="" style="width: 350px;"><br/><label
                    for="sIndex" style="width: 150px; display: inline-block;"><?php _e( 'Area', 'amazilon' ); ?>
                : </label><select name="amazilon-search-sindex" class="amazilon-search-sindex"
                                  style="width: 350px;"><?php
				$sIndexes = amazilonGetSearchindexes( 'de' );
				foreach ( $sIndexes AS $sIndex => $aEntry ) {
					echo '<option value="' . esc_attr( $sIndex ) . '">' . esc_attr( $aEntry['title'] ) . '</option>';
				}

				?></select><br/>
            <label style="display: inline-block; width: 150px;">&nbsp;</label><a name="amazilon-search-button"
                                                                                 class="amazilon-search-button amazilon-button-3"
                                                                                 href="#"
                                                                                 style="width: initial;"><?php _e( 'Search on Amazon',
					'amazilon' ); ?></a></p>
    </div>

    <div name="amazilon-search-results" class="amazilon-search-results block"
         style="display: none; position: relative;"><a href="#"
                                                       onclick="jQuery('#amazilon-tabcontent-generator-3 .amazilon-search-results').fadeOut();"><span
                    class="tb-close-icon"></span></a>
        <p><b><?php _e( 'Search results', 'amazilon' ); ?></b></p>
        <p><?php _e( 'Just click to select', 'amazilon' ); ?>:</p>
        <p name="amazilon-search-results-inner" class="amazilon-search-results-inner"></p></div>

    <div class="block">
        <p>
            <label for="asin"
                   style="display: inline-block; width: 300px;"><?php _e( 'Put in the wanted <a href="https://amazilon.com/faq/#asin" target="_blank">Produkt-ASIN</a>.',
					'amazilon' ); ?>:</label><input type="text" class="apn asin" name="asin" value=""
                                                    style="width: 18em;" maxlength=""><br/>
            <span name="multiAsin" class="multiAsin" style="display: none;"><b><?php _e( 'Comparison table',
						'amazilon' ); ?>:</b> <?php _e( 'Put the wanted product-ASIN into the input field, separeted by a comma. To highlight put a bang (!) behind the ASIN. ',
					'amazilon' ); ?><br/><br/></span>
            <label for="tracking"
                   style="display: inline-block; width: 300px;"><?php _e( 'Use an alternate Tracking-ID (Alternate-21) ',
					'amazilon' ); ?>:</label><input type="text" class="apn tracking" name="tracking" value=""
                                                    style="width: 18em;" maxlength=""><br>
            <label for="tpl-pname" style="display: inline-block; width: 300px;"><?php _e( 'Use divergent product name',
					'amazilon' ); ?>:</label><input type="text" class="apn tpl-pname" name="tpl-pname" value=""
                                                    style="width: 18em;" maxlength=""><br/>
            <label for="buttontext" style="display: inline-block; width: 300px;"><?php _e( 'Button label',
					'amazilon' ); ?>:</label><input type="text" class="apn tpl-buttontext" name="tpl-buttontext"
                                                    value="" style="width: 18em;" maxlength=""><br/>
            <label for="template" style="display: inline-block; width: 300px;"><?php _e( 'Select a layout',
					'amazilon' ); ?>:</label><select name="template" class="apn template" style="width: 18em;">
                <option value="tpl-1"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '1' ); ?></option>
                <option value="tpl-2"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '2' ); ?>*</option>
                <option value="tpl-3"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '3' ); ?></option>
                <option value="tpl-4"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '4' ); ?></option>
                <option value="tpl-5"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '5' ); ?>*</option>
                <option value="tpl-6"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '6' ); ?>*</option>
                <option value="tpl-7"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '7' ); ?>*</option>
                <option value="vergleich"><?php _e( 'Comparison box', 'amazilon' ); ?>*</option>
                <option value="vergleich2"><?php _e( 'Comparison table', 'amazilon' ); ?>*</option>
            </select><br/>
            <small style="margin-left: 300px;"><?php echo __( 'Layouts with a star (*) expand to full width.',
					'amazilon' ); ?></small>
            <br/>
            <span class="tpl-buttontpll" name="tpl-buttontpll">
<label for="tpl-buttontpl" style="display: inline-block; width: 300px;"><?php _e( 'Button Design',
		'amazilon' ); ?>:</label><select name="tpl-buttontpl" class="apn tpl-buttontpl" style="width: 18em;"><option
                            value=""><?php echo sprintf( __( 'default Layout', 'amazilon' ), '1' ); ?></option><option
                            value="0"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '1' ); ?></option><option
                            value="1"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '2' ); ?></option><option
                            value="2"><?php echo sprintf( __( 'Layout %s', 'amazilon' ), '3' ); ?></option><option
                            value="3"><?php echo sprintf( __( 'Layout %s', 'amazilon' ),
							'4' ); ?></option></select><br/></span>
            <span class="schattenl" name="schattenl"><label for="schatten" style="display: inline-block; width: 300px;">&nbsp;</label><input
                        type="checkbox" class="apn schatten" name="schatten"
                        value="1"> - <?php _e( 'Shows the layout with a shadow', 'amazilon' ); ?><br/></span>
            <span class="savingsl" name="savingsl"><label for="savings" style="display: inline-block; width: 300px;">&nbsp;</label><input
                        type="checkbox" class="apn savings" name="savings" value="false"> - <?php _e( 'Hide Savings',
					'amazilon' ); ?><br/></span>
            <span class="primel" name="primel"><label for="prime"
                                                      style="display: inline-block; width: 300px;">&nbsp;</label><input
                        type="checkbox" class="apn prime" name="prime" value="false"> - <?php _e( 'Hide Prime status',
					'amazilon' ); ?><br/></span>
            <label for="infobox" style="display: inline-block; width: 300px;">&nbsp;</label><input type="checkbox"
                                                                                                   class="apn infobox"
                                                                                                   name="infobox"
                                                                                                   value="1">
            - <?php _e( 'Display the infobox', 'amazilon' ); ?><br/>
			<?php if ( isset( $config['bRetrieveStars'] ) && (int) $config['bRetrieveStars'] == 1 ) { ?>
                <label for="stars" style="display: inline-block; width: 300px;">&nbsp;</label><input type="checkbox"
                                                                                                     class="apn stars"
                                                                                                     name="stars"
                                                                                                     value="1"> - <?php _e( 'Show Reviews',
					'amazilon' ); ?><br/>
			<?php } ?>

            <span class="hidelegendl" name="hidelegendl">
<label for="hidelegend" style="display: inline-block; width: 300px;">&nbsp;</label><input type="checkbox"
                                                                                          class="apn hidelegend"
                                                                                          name="hidelegend"
                                                                                          value="1"> - <?php _e( 'Hide legend',
					'amazilon' ); ?><br/>
</span>


            <span class="featuresl" name="featuresl">
<label for="tpl-features" style="display: inline-block; width: 300px;"><?php _e( 'Show Bulletpoints ("Features")',
		'amazilon' ); ?>:</label><select class="apn tpl-features" name="tpl-features"><option
                            value="0"><?php _e( '- none -', 'amazilon' ); ?></option><?php
					for ( $iFeature = 1; $iFeature <= 5; $iFeature ++ ) {
						echo '<option value="' . (int) $iFeature . '">' . sprintf( _n( '%d Feature', '%d Features',
								$iFeature, 'amazilon' ), $iFeature ) . '</option>';
					}
					?></select><br/>
<label for="tpl-fmax" style="display: inline-block; width: 300px;"><?php _e( 'Shorten Features text length to max',
		'amazilon' ); ?></label><input type="number" step="10" min="10" max="500" class="apn tpl-fmax" name="tpl-fmax"
                                       value="500"> <?php _e( 'characters', 'amazilon' ); ?><br/>
</span>

            <br/>
            <span class="divergentlegend" name="divergentlegend"><b><?php _e( 'Divergend legend labels:',
						'amazilon' ); ?></b><br/>
<label for="tpl-headerlegend" style="display: inline-block; width: 300px;"><?php _e( 'Product',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-headerlegend" name="tpl-headerlegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'Product', 'amazilon' ) ); ?>"><br/>
<label for="tpl-productlegend" style="display: inline-block; width: 300px;"><small>(<?php _e( 'Header row',
			'amazilon' ); ?>)</small>: </label><input type="text" class="apn tpl-productlegend" name="tpl-productlegend"
                                                      value="" placeholder="<?php echo esc_attr( __( '- empty -',
					'amazilon' ) ); ?>"><br/>
<label for="tpl-imagelegend" style="display: inline-block; width: 300px;"><small>(<?php _e( 'Image row',
			'amazilon' ); ?></small>: </label><input type="text" class="apn tpl-imagelegend" name="tpl-imagelegend"
                                                     value="" placeholder="<?php echo esc_attr( __( '- empty -',
					'amazilon' ) ); ?>"><br/>
<label for="tpl-pricelegend" style="display: inline-block; width: 300px;"><?php _e( 'Price',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-pricelegend" name="tpl-pricelegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'Price', 'amazilon' ) ); ?>"><br/>
<label for="tpl-savingslegend" style="display: inline-block; width: 300px;"><?php _e( 'You save',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-savingslegend" name="tpl-savingslegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'You save', 'amazilon' ) ); ?>"><br/>
<label for="tpl-ratingslegend" style="display: inline-block; width: 300px;"><?php _e( 'Customers Rating',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-ratingslegend" name="tpl-ratingslegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'Customers Rating',
	                                         'amazilon' ) ); ?>"><br/>
<label for="tpl-primelegend" style="display: inline-block; width: 300px;"><?php _e( 'Shipping',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-primelegend" name="tpl-primelegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'Shipping', 'amazilon' ) ); ?>"><br/>
<label for="tpl-buttonlegend" style="display: inline-block; width: 300px;"><?php _e( 'Trader',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-buttonlegend" name="tpl-buttonlegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'Trader', 'amazilon' ) ); ?>"><br/>
<label for="tpl-statelegend" style="display: inline-block; width: 300px;"><?php _e( 'State',
		'amazilon' ); ?>: </label><input type="text" class="apn tpl-statelegend" name="tpl-statelegend" value=""
                                         placeholder="<?php echo esc_attr( __( 'State', 'amazilon' ) ); ?>"><br/>
</span>
        </p>
        <div name="amazilon-vorschau" class="amazilon-vorschau" style="display: none;"><p><b><?php _e( 'Preview',
						'amazilon' ); ?>:</b><br style="clear: both;"/><span name="amazilon-vorschaubox"
                                                                             class="amazilon-vorschaubox"></span></p>
        </div>
        <br style="clear: both;"/>
    </div>
<?php
if ( isset( $_GET['fieldId'] ) && ! empty( $_GET['fieldId'] ) ) {
	?>
    <textarea name="apnAusgabe" class="apnAusgabe" cols="104" rows="10" style="display: none;"></textarea>
    <input name="apnInsert" class="apnInsert" style="display: none;" type="button"
           value="<?php _e( 'Insert the template', 'amazilon' ); ?>"
           onclick="amazilonInsertShortCode3(jQuery('#amazilon-tabcontent-generator-3 .apnAusgabe').val(),'<?php echo esc_attr( $_GET['fieldId'] ); ?>');"/>
	<?php
} else {
	?>
    <h2><?php _e( 'Copy the ShortCode and insert wherever needed.', 'amazilon' ); ?></h2>
    <p style="position: relative; max-width: 50em;">
        <label style="display: none;" class="amazilon-shortened-label"><?php _e( 'Shortened', 'amazilon' ); ?>: <input
                    type="text" class="amazilon-shortened-input" style="width: 10em;" value=""/>
            <button class="amazilon-copy-button button button-primary button-clipboard"
                    data-clipboard-target="#amazilon-tabcontent-generator-3 .amazilon-shortened-input"><span
                        class="dashicons dashicons-clipboard"
                        style="margin-top: .2em;"></span> <?php _e( 'Copy to clipboard', 'amazilon' ); ?></button>
        </label>
        <span style="position: absolute; bottom: 2em; right: 1.5em; margin-right: 5%;">
    	<button class="button button-primary button-clipboard"
                data-clipboard-target="#amazilon-tabcontent-generator-3 .apnAusgabe"><span
                    class="dashicons dashicons-clipboard"
                    style="margin-top: .2em;"></span> <?php _e( 'Copy to clipboard', 'amazilon' ); ?></button>
    </span>
        <textarea class="apnAusgabe" rows="15" style="width: 95%;" spellcheck="false"></textarea>
    </p>
	<?php
}
?>