﻿$(document).ready(function() {
    //$("table#OuterTable tr td").css("vertical-align" , "top" );
    $("#OT1").addClass("first-row-cell");
    $("#OT2").addClass("first-col-cell");


    //Start login form validations
    $("#btnFPSignin").click(function() {

        var strMsg = 'Enter ';
        var flag = 0;
        var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;


        var Email;
        Email = $("#form_name").val();
        if (Email == '') {
            strMsg = strMsg + "E-mailID (required) ";
            jAlert(strMsg, 'Message from webpage')
            flag = 1;

        }
        else if (isEmptyAfterTrim(Email) == true) {
        strMsg = strMsg + "E-mailID (required)";
        jAlert(strMsg, 'Message from webpage');
            flag = 1;
        }
        else if (!emailReg.test(Email)) {
        strMsg = strMsg + "Valid E-mailID (required) ";
        jAlert(strMsg, 'Message from webpage');
            flag = 1;
        }

        var Passcode;
        Passcode = $("#form_password").val();
        if (Passcode == '') {
            strMsg = strMsg + "Passcode (required) ";
            jAlert(strMsg, 'Message from webpage')
            flag = 1;
        }
        else if (isEmptyAfterTrim(Passcode) == true) {
        strMsg = strMsg + "Passcode (required) ";
            $("#form_password").val('');
            jAlert(strMsg, 'Message from webpage');
            flag = 1;
        }


        if (flag == 1)
            return false;
        else
            return true;
        //FPSignin();


    });

    //End of login form validations


    // Handle placeholder labels

    $('label.js-placeholder')
	.addClass('placeholder')
	.each(function() {

	    // Get the id of the input this label is associated with
	    var label = $(this),
			idInput = label.attr('for'),
			initialText = $('#' + idInput).val();

	    // Hide the label if the input has a value
	    if (initialText.length > 0) {
	        label.addClass('hidden');
	    }

	    // Handle classes
	    $('#' + idInput)
		.focus(function() {
		    label.addClass('faded');
		})
		.blur(function() {
		    var text = $(this).val();
		    if (text.length == 0) {
		        label.removeClass('faded hidden');
		    }
		})
		.keyup(function() {
		    var text = $(this).val();
		    if (text.length > 0) {
		        label
				.removeClass('faded')
				.addClass('hidden');
		    }
		    else {
		        label
				.removeClass('hidden')
				.addClass('faded');
		    }
		});
	}); 

});
//End of document ready
