jQuery( document ).ready( function( $ ) {
    'use strict';

    var $page_template = $('#page_template'),
        $pageheader_template = $('#pageheader_meta_box'),
        $about_metabox = $('#about_meta_box'),
        $contact_metabox = $('#contact_meta_box'),
        $classes_metabox = $('#classes_meta_box'),
        $events_metabox = $('#events_meta_box'),
        $wishlist_metabox = $('#wishlist_meta_box'),
        $bridallist_metabox = $('#bridallist_meta_box'),
        $prices_metabox = $('#prices_meta_box');

    $about_metabox.hide();
    $pageheader_template.hide();
    $contact_metabox.hide();
    $classes_metabox.hide();
    $events_metabox.hide();
    $wishlist_metabox.hide();
    $bridallist_metabox.hide();
    $prices_metabox.hide();

    $page_template.on("change", function() {

        switch ( $(this).val() ) {

            case 'templ-about.php' :
            $about_metabox.show();
            $pageheader_template.hide();
            $contact_metabox.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;

            case 'templ-page-with-header.php' :
            $pageheader_template.show();
            $contact_metabox.hide();
            $about_metabox.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;

            case 'templ-contact.php' :
            $contact_metabox.show();
            $about_metabox.hide();
            $pageheader_template.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;

            case 'templ-classes.php' :
            $contact_metabox.hide();
            $about_metabox.hide();
            $pageheader_template.hide();
            $classes_metabox.show();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;

            case 'templ-events.php' :
            $contact_metabox.hide();
            $about_metabox.hide();
            $pageheader_template.hide();
            $classes_metabox.hide();
            $events_metabox.show();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;

            case 'templ-wishlist.php' :
            $contact_metabox.hide();
            $about_metabox.hide();
            $pageheader_template.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.show();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;

            case 'templ-bridallist.php' :
            $contact_metabox.hide();
            $about_metabox.hide();
            $pageheader_template.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.show();
            $prices_metabox.hide();
            break;

            case 'templ-prices.php' :
            $contact_metabox.hide();
            $about_metabox.hide();
            $pageheader_template.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.show();
            break;

            default :
            $about_metabox.hide();
            $pageheader_template.hide();
            $contact_metabox.hide();
            $classes_metabox.hide();
            $events_metabox.hide();
            $wishlist_metabox.hide();
            $bridallist_metabox.hide();
            $prices_metabox.hide();
            break;
        }

    }).change();

    //
    if ( $('.uni-icp-auto').length > 0 ) {
        $('.uni-icp-auto').iconpicker();
    }

});