﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle & Ivan Guardado Castro
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

$(document).ready(function () {
    //global vars
    var searchBoxes = $(".inputText");
    var searchBox1 = $(".tb_plaats");
    var searchBox1Default = searchBox1.attr("defaultvalue");
    var searchBox2 = $(".tb_componist");
    var searchBox2Default = searchBox2.attr("defaultvalue");
    var searchBox3 = $(".tb_werk");
    var searchBox3Default = searchBox3.attr("defaultvalue");
    var searchBox4 = $(".tb_uitvoerende");
    var searchBox4Default = searchBox4.attr("defaultvalue");
    var searchBox5 = $(".tb_locatie");
    var searchBox5Default = searchBox5.attr("defaultvalue");
    var searchBox6 = $(".tb_trefwoord");
    var searchBox6Default = searchBox6.attr("defaultvalue");

    var advancedsearchTekst = $(".advancedsearch");
    var advancedform = $(".advancedform");

    advancedsearchTekst.click(function (e) {
        $(this).addClass("hideit");
        advancedform.removeClass("hideit");
    });

    advancedsearchTekst.click(function (e) {
        $(this).addClass("hideit");
    });
 


    //Effects for both searchbox
    searchBoxes.focus(function (e) {
        $(this).addClass("active");
    });
    searchBoxes.blur(function (e) {
        $(this).removeClass("active");
    });


    //Searchbox1 show/hide default text if needed
    searchBox1.focus(function () {
        if ($(this).attr("value") == searchBox1Default) $(this).attr("value", "");
    });
    searchBox1.blur(function () {
        if ($(this).attr("value") == "") {
            $(this).attr("value", searchBox1Default);
            $(this).removeClass("hasvalue");
        } else {
            $(this).addClass("hasvalue");
        }
    });
    //Searchbox2 show/hide default text if needed
    searchBox2.focus(function () {
        if ($(this).attr("value") == searchBox2Default) $(this).attr("value", "");
    });
    searchBox2.blur(function () {
        if ($(this).attr("value") == "") {
            $(this).attr("value", searchBox2Default);
            $(this).removeClass("hasvalue");
        } else {
            $(this).addClass("hasvalue");
        }
    });

    //Searchbox1 show/hide default text if needed
    searchBox3.focus(function () {
        if ($(this).attr("value") == searchBox3Default) $(this).attr("value", "");
    });
    searchBox3.blur(function () {
        if ($(this).attr("value") == "") {
            $(this).attr("value", searchBox3Default);
            $(this).removeClass("hasvalue");
        } else {
            $(this).addClass("hasvalue");
        }
    });

    //Searchbox4 show/hide default text if needed
    searchBox4.focus(function () {
        if ($(this).attr("value") == searchBox4Default) $(this).attr("value", "");
    });
    searchBox4.blur(function () {
        if ($(this).attr("value") == "") {
            $(this).attr("value", searchBox4Default);
            $(this).removeClass("hasvalue");
        } else {
            $(this).addClass("hasvalue");
        }
    });

    //Searchbox5 show/hide default text if needed
    searchBox5.focus(function () {
        if ($(this).attr("value") == searchBox5Default) $(this).attr("value", "");
    });
    searchBox5.blur(function () {
        if ($(this).attr("value") == "") {
            $(this).attr("value", searchBox5Default);
            $(this).removeClass("hasvalue");
        } else {
            $(this).addClass("hasvalue");
        }
    });

    //Searchbox6 show/hide default text if needed
    searchBox6.focus(function () {
        if ($(this).attr("value") == searchBox6Default) $(this).attr("value", "");
    });
    searchBox6.blur(function () {
        if ($(this).attr("value") == "") {
            $(this).attr("value", searchBox6Default);
            $(this).removeClass("hasvalue");
        } else {
            $(this).addClass("hasvalue");
        }
    });

});
