﻿(function ($) {
    $.fn.vAlign = function () {
        return this.each(function (i) {
            var h = $(this).height();
            var oh = $(this).outerHeight();
            var mt = (h + (oh - h)) / 2;
            $(this).css("margin-top", "-" + mt + "px");
            $(this).css("top", "50%");
            $(this).css("position", "absolute");
        });
    };
})(jQuery);

(function ($) {
    $.fn.hAlign = function () {
        return this.each(function (i) {
            var w = $(this).width();
            var ow = $(this).outerWidth();
            var ml = (w + (ow - w)) / 2 + 10;
            $(this).css("margin-left", "-" + ml + "px");
            $(this).css("left", "50%");
            $(this).css("position", "absolute");
        });
    };
})(jQuery);


$(document).ready(function () {
    jQuery('.menu-top-global ul').superfish();
    jQuery('.menu-header-menu-container ul').superfish();

    jQuery('div.primary ul.latestpost li:last').addClass("space");

    //-- For First Name
    jQuery("form[class=wpcf7-form] input.submitbtn").val('');

    jQuery("form[class=wpcf7-form] input[name^=myName]").focus(function () {
        if ($(this).val() == "Your Name*") $(this).val('');
    });

    jQuery("form[class=wpcf7-form] input[name^=myName]").blur(function () {
        if ($(this).val() == "") $(this).val('Your Name*');
    });

    //-- For Email
    jQuery("form[class=wpcf7-form] input[name^=myEmail]").focus(function () {
        if ($(this).val() == "Email*") $(this).val('');
    });

    jQuery("form[class=wpcf7-form] input[name^=myEmail]").blur(function () {
        if ($(this).val() == "") $(this).val('Email*');
    });

    //-- Phone Number
    jQuery("form[class=wpcf7-form] input[name^=phoneno]").focus(function () {
        if ($(this).val() == "Phone No") $(this).val('');
    });

    jQuery("form[class=wpcf7-form] input[name^=phoneno]").blur(function () {
        if ($(this).val() == "") $(this).val('Phone No');
    });

    //-- For Area Of Interest
    jQuery("form[class=wpcf7-form] #messagebox").focus(function () {
        if ($(this).val() == "Message Box") $(this).val('');
    });

    jQuery("form[class=wpcf7-form] #messagebox").blur(function () {
        if ($(this).val() == "") $(this).val('Message Box');
    });


    // for vertical middle 
    /*	$(".ourpeoplehead span").vAlign();
    $(".ourpeoplehead span").hAlign();*/

    $(".consultantbannerbox .consultrgtlink li a").vAlign();
    $(".consultantbannerbox .ourpeoplehead span").vAlign();
    //	$(".consultantbannerbox .ourpeoplehead span").hAlign();


    $(".consultantbannerbox .consultrgtlink li").click(function () {
        window.location = $(this).find("a").attr("href"); return false;
    });

});
