(function($) {
    $(document).ready(function() {

        // HP blocks corner
        $('.hp_block').corner("round 8px");
        $('.hp_block .region').corner("round 7px");

        $('.hp_block_compound').corner("round 8px");
        $('.hp_block_compound .region_compound').corner("round 7px");

        // all divs corner
        $('.full_corner').corner("round 8px");
		
		<!--Putting Search label in Search Box and clearing the text input on mouse focus-->
		$("input#edit-search-block-form--2").val('Search Site');
			
		$("input#edit-search-block-form--2").focus(function(){
			$(this).val('');
		});
		
        // resources for customers - HP block
        $('#block-views-home-page-blocks-block-1 .carousel_list').jCarouselLite({
            btnNext: "#block-views-home-page-blocks-block-1 .next",
            btnPrev: "#block-views-home-page-blocks-block-1 .prev",
	    visible: 1
        });

        // resources for testers - HP block
        $('#block-views-home-page-blocks-block-5 .carousel_list').jCarouselLite({
            btnNext: "#block-views-home-page-blocks-block-5 .next",
            btnPrev: "#block-views-home-page-blocks-block-5 .prev",
	    visible: 1
        });
		
		//Whitepaper HP Left Block
		  $('#block-views-bebbdaa9ef653bc38b0316144acdbd67 .carousel_list').jCarouselLite({
            btnNext: "#block-views-bebbdaa9ef653bc38b0316144acdbd67 .next",
            btnPrev: "#block-views-bebbdaa9ef653bc38b0316144acdbd67 .prev",
	    visible: 1
        });

        // media raves & reviews - HP block
        $('#block-views-home-page-blocks-block-2 .carousel_list').jCarouselLite({
            btnNext: "#block-views-home-page-blocks-block-2 .next",
            btnPrev: "#block-views-home-page-blocks-block-2 .prev",
	    visible: 1
        });

        // success stories- HP block
        $('#block-views-home-page-blocks-block-3 .carousel_list').jCarouselLite({
            btnNext: "#block-views-home-page-blocks-block-3 .next",
            btnPrev: "#block-views-home-page-blocks-block-3 .prev",
	    visible: 1
        });

        // Testing for early-stage companies - HP block
        $('#block-views-home-page-blocks-block-4 .carousel_list').jCarouselLite({
            btnNext: "#block-views-home-page-blocks-block-4 .next",
            btnPrev: "#block-views-home-page-blocks-block-4 .prev",
	    visible: 1
        });

        // Customer logo slider
        $('#customer_logos .customer_logo_list').jCarouselLite({
	    btnNext: "#customer_logos .next_logo",
	    visible: 4,
		scroll: 3,
		circular: true
        });

        // Success Stories block on RightColumn - slider
        $('#block-views-right-blocks-block-1 .right_column_success_stories_list').jCarouselLite({
            btnNext: "#block-views-right-blocks-block-1 .next",
            btnPrev: "#block-views-right-blocks-block-1 .prev",
	    visible: 1
        });


        // tabs for Resources for Customer | Testers
        $('.hp_block_compound #tabs').tabs();


        // Top main menu nav
//        $("#block-menu-block-2 .menu-mlid-345 ul").first().hide(); // better hidding by css
//        $("#block-menu-block-2 .menu-mlid-345 ul").show(); // better hidding by css // TEST comment
        $("#block-menu-block-2 ul li ul li ul").remove(); //  renmove all childs from L2 menu

        $("#block-menu-block-2 .menu-mlid-345").hover( function () { $(this).find('ul').show(); // TEST uncomment both
            },function(){ $(this).children("ul").hide(); });//hover
        $("#block-menu-block-2 .menu-mlid-344").hover( function () { $(this).find('ul').show();
            },function(){ $(this).children("ul").hide(); });//hover
        $("#block-menu-block-2 .menu-mlid-346").hover( function () { $(this).find('ul').show();
            },function(){ $(this).children("ul").hide(); });//hover
        $("#block-menu-block-2 .menu-mlid-347").hover( function () { $(this).find('ul').show();
            },function(){ $(this).children("ul").hide(); });//hover
        $("#block-menu-block-2 .menu-mlid-348").hover( function () { $(this).find('ul').show();
            },function(){ $(this).children("ul").hide(); });//hover
        $("#block-menu-block-2 .menu-mlid-349").hover( function () { $(this).find('ul').show();
            },function(){ $(this).children("ul").hide(); });//hover
        $("#block-menu-block-2 .menu-mlid-350").hover( function () { $(this).find('ul').show();
            },function(){ $(this).children("ul").hide(); });//hover


        // 1-2-3 block redirecting pages
        $("#first_123").linkselect();
        $("#second_123").linkselect();
        $("#button_123").click( function() { 
            var first_selection = $("#first_123").val();
            var second_selection = $("#second_123").val();
            if ( first_selection != 0 || second_selection != 0 ) {
                var matrix_selection = new Array();
                matrix_selection[0] = new Array( '',                     '/web',                     '/desktop',                     '/mobile');
                matrix_selection[1] = new Array( '/functional-testing',  '/web-functional-testing',  '/desktop-functional-testing',  '/mobile-functional-testing');
                matrix_selection[2] = new Array( '/security-testing',    '/web-security-testing',    '/desktop-security-testing',    '/mobile-security-testing');
                matrix_selection[3] = new Array( '/load-testing',        '/web-load-testing',        '/desktop-load-testing',        '/mobile-load-testing');
                matrix_selection[4] = new Array( '/localization-testing','/web-localization-testing','/desktop-localization-testing','/mobile-localization-testing');
                matrix_selection[5] = new Array( '/usability-testing',   '/web-usability-testing',   '/desktop-usability-testing',   '/mobile-usability-testing');

//               alert( matrix_selection[ first_selection ][ second_selection ] );
                var new_url = matrix_selection[ first_selection ][ second_selection ];
                window.location.href = new_url;
            }
        });

        // Get quote right block 
        $("#edit-submitted-quote-job-title-level").linkselect();
        $("select#edit-submitted-quote-department").linkselect();
        $("#edit-submitted-quote-country").linkselect();

        // ===> form get a quote submit <====
        // on submit copinselected to hidden inputs
        $("#webform-client-form-136").submit(function(mi_evento){
            $("#clone_quote_job_title_level").val( $("#edit-submitted-quote-job-title-level").val() );
            var department_sent = $("#edit-submitted-quote-department").val();
            $("#clone_quote_department").val( department_sent );
            $("#clone_quote_country").val( $("#edit-submitted-quote-country").val() );
        });
        // adding hidden inputs becasue fancy-select was rewrited and changes the name attribute so webform doesnt work :(
        $("#webform-client-form-136").append('<input type="hidden" name="submitted[quote_job_title_level]" value="" id="clone_quote_job_title_level">');
        $("#webform-client-form-136").append('<input type="hidden" name="submitted[quote_department]" value="" id="clone_quote_department">');
        $("#webform-client-form-136").append('<input type="hidden" name="submitted[quote_country]" value="" id="clone_quote_country">');

        // Putting text example on inputs
        $("#edit-submitted-first-name").example('First Name');
        $("#edit-submitted-last-name").example('Last Name');
        $("#edit-submitted-company").example('Company');
        $("#edit-submitted-email").example('Email');
        $("#edit-submitted-phone").example('Phone');
        $("#edit-submitted-comments").example('Comments');
        $("#edit-submitted-quote-job-title-level_link").html('Job Title');
        $("#edit-submitted-quote-department_link").html('Department');
        $("#edit-submitted-quote-country_link").html('Country');

        // ===> form: Pricing Inquiry Form  <====
        $("#block-block-14 select#a00N80000002zSNr").linkselect();
        $("#block-block-14 select#a00N80000002zRx3").linkselect();
        $("#block-block-14 select#a00N80000002Sy5M").linkselect({ // Country selector
            change: function(li, value, text) {
                if ( value == 'US' ) {
                    $("#block-block-14 div#state").show();
                    $("#block-block-14 div#cdnprovince").hide();
					$("#block-block-14 a#cdnprovince_link").html('Province');
					$("#block-block-14 input#cdnprovince").val('');
                } else if ( value == 'Canada' ) {
                    $("#block-block-14 div#state").hide();
					$("#block-block-14 a#state_link").html('State');
					$("#block-block-14 input#state").val('');
                    $("#block-block-14 div#cdnprovince").show();
                } else {
                    $("#block-block-14 div#state").hide();
                    $("#block-block-14 div#cdnprovince").hide();
					$("#block-block-14 a#state_link").html('State');
					$("#block-block-14 input#state").val('');
					$("#block-block-14 a#cdnprovince_link").html('Province');
					$("#block-block-14 input#cdnprovince").val('');
                }
            } 
        });
        $("#block-block-14 select#state").linkselect();
        $("#block-block-14 select#cdnprovince").linkselect();

        $("#block-block-14 input#first_name").example('First Name');
        $("#block-block-14 input#last_name").example('Last Name');
        $("#block-block-14 input#company").example('Company');
        $("#block-block-14 input#phone").example('Phone');
        $("#block-block-14 input#email").example('Email');
        $("#block-block-14 textarea#description").example('Comments');

        $("#block-block-14 div#state").hide();
        $("#block-block-14 div#cdnprovince").hide();


        if($("#block-block-14 input#a00N80000002zSNr").val() == "")
        {
            $("#block-block-14 #a00N80000002zSNr_link ").html('Job Level');
        }
        if($("#block-block-14 input#a00N80000002zRx3").val() == "")
        {
            $("#block-block-14 #a00N80000002zRx3_link ").html('Department');
        }
        if($("#block-block-14 input#a00N80000002Sy5M").val() == "")
        {
            $("#block-block-14 #a00N80000002Sy5M_link ").html('Country');
        }

        if ( $("#block-block-14 input#a00N80000002Sy5M").val() == "US" ) {
            $("#block-block-14 div#state").show();
        } else if ( $("#block-block-14 input#a00N80000002Sy5M").val() == "Canada" ) {
            $("#block-block-14 div#cdnprovince").show();
        }

        if($("#block-block-14 input#state").val() == "")
        {
            $("#block-block-14 #state_link ").html('State');
        }
        if($("#block-block-14 input#cdnprovince").val() == "")
        {
            $("#block-block-14 #cdnprovince_link ").html('Province');
        }

        // ===> form: Get This Free Whitepaper Now  <====
     /*   $(".whitepaper_form select#a00N80000002zSNr").linkselect(); // Job Title Level
        $(".whitepaper_form select#a00N80000002zRx3").linkselect(); // Department
        $(".whitepaper_form select#a00N80000002Sy5M").linkselect({ // Country selector
            change: function(li, value, text) {
                if ( value == 'US' ) {
                    $(".whitepaper_form div#state").show();
                    $(".whitepaper_form div#cdnprovince").hide();
					$(".whitepaper_form a#cdnprovince_link").html('Province');
					$(".whitepaper_form input#cdnprovince").val('');
                } else if ( value == 'Canada' ) {
                    $(".whitepaper_form div#state").hide();
					$(".whitepaper_form a#state_link").html('State');
					$(".whitepaper_form input#state").val('');
                    $(".whitepaper_form div#cdnprovince").show();
                } else {
                    $(".whitepaper_form div#state").hide();
                    $(".whitepaper_form div#cdnprovince").hide();
					$(".whitepaper_form a#state_link").html('State');
					$(".whitepaper_form input#state").val('');
					$(".whitepaper_form a#cdnprovince_link").html('Province');
					$(".whitepaper_form input#cdnprovince").val('');
                }
            }
        }); // Country
        $(".whitepaper_form select#state").linkselect(); // Department
        $(".whitepaper_form select#cdnprovince").linkselect(); // Department
*/
        $(".whitepaper_form input#first_name").example('First Name');
        $(".whitepaper_form input#last_name").example('Last Name');
        $(".whitepaper_form input#company").example('Company');
        $(".whitepaper_form input#phone").example('Phone');
        $(".whitepaper_form input#email").example('Email');

        $(".whitepaper_form div#state").hide();
        $(".whitepaper_form div#cdnprovince").hide();

        if ( $(".whitepaper_form input#a00N80000002zSNr").val() == '' ) { $(".whitepaper_form a#a00N80000002zSNr_link").html('Job Title Level'); }
        if ( $(".whitepaper_form input#a00N80000002zRx3").val() == '' ) { $(".whitepaper_form a#a00N80000002zRx3_link").html('Department'); }
        if ( $(".whitepaper_form input#a00N80000002Sy5M").val() == '' ) { $(".whitepaper_form a#a00N80000002Sy5M_link").html('Country'); }
        if ( $(".whitepaper_form input#state").val() == '' ) { $(".whitepaper_form a#state_link").html('State'); }
        if ( $(".whitepaper_form input#cdnprovince").val() == '' ) { $(".whitepaper_form a#cdnprovince_link").html('Province'); }

        var country_selected = $(".whitepaper_form input#a00N80000002Sy5M").val();
       /* if ( country_selected == 'US' ) {
            $(".whitepaper_form div#state").show();
            $(".whitepaper_form div#cdnprovince").hide();
        } else if ( country_selected == 'Canada' ) {
            $(".whitepaper_form div#state").hide();
            $(".whitepaper_form div#cdnprovince").show();
        } else {
            $(".whitepaper_form div#state").hide();
            $(".whitepaper_form div#cdnprovince").hide();
        }

        // ===> form: Get This Free Whitepaper Now for Whitepapers with Labels  <====
        $(".whitepaper_form_wl select#a00N80000002zSNr").linkselect(); // Job Title Level
        $(".whitepaper_form_wl select#a00N80000002zRx3").linkselect(); // Department
        $(".whitepaper_form_wl select#a00N80000002Sy5M").linkselect({ // Country selector
            change: function(li, value, text) {
                if ( value == 'US' ) {
                    $(".whitepaper_form_wl div#state").show();
                    $(".whitepaper_form_wl div#cdnprovince").hide();
					$(".whitepaper_form_wl a#cdnprovince_link").html('Province');
					$(".whitepaper_form_wl input#cdnprovince").val('');
                } else if ( value == 'Canada' ) {
                    $(".whitepaper_form_wl div#state").hide();
					$(".whitepaper_form_wl a#state_link").html('State');
					$(".whitepaper_form_wl input#state").val('');
                    $(".whitepaper_form_wl div#cdnprovince").show();
                } else {
                    $(".whitepaper_form_wl div#state").hide();
                    $(".whitepaper_form_wl div#cdnprovince").hide();
					$(".whitepaper_form_wl a#state_link").html('State');
					$(".whitepaper_form_wl input#state").val('');
					$(".whitepaper_form_wl a#cdnprovince_link").html('Province');
					$(".whitepaper_form_wl input#cdnprovince").val('');
                }
            }
        }); // Country
        $(".whitepaper_form_wl select#state").linkselect(); // Department
        $(".whitepaper_form_wl select#cdnprovince").linkselect(); // Department

        $(".whitepaper_form_wl div#state").hide();
        $(".whitepaper_form_wl div#cdnprovince").hide();*/
		
       	var country_selected = $(".whitepaper_form_wl input#a00N80000002Sy5M").val();
      /*  if ( country_selected == 'US' ) {
            $(".whitepaper_form_wl div#state").show();
            $(".whitepaper_form_wl div#cdnprovince").hide();
        } else if ( country_selected == 'Canada' ) {
            $(".whitepaper_form_wl div#state").hide();
            $(".whitepaper_form_wl div#cdnprovince").show();
        } else {
            $(".whitepaper_form_wl div#state").hide();
            $(".whitepaper_form_wl div#cdnprovince").hide();
        }*/

    });
}(jQuery));

function exec_123_box(){
    var first_selection = $("#first_123").val();
alert('hi');
//alert( first_selection );
}

;

