﻿//JQuery

$(document).ready(function() {

    $("#wait").css({ visibility: "hidden" });
    var tbxs = "#Tbxes :input";


    $(tbxs).focus(function() {
        if (this.defaultValue == this.value) {
            this.value = '';
            $(this).css({ color: "black" });

        }
    });

    $(tbxs).blur(function() {
        if ((this.value).replace(/ /g, "") == '') {
            this.value = this.defaultValue;
            $(this).css({ color: "#808080" });
        }

        else {
            this.value = stringFormat(this.value);
        }
    });

    $("#ctl00_MainContent_SearchBtn").click(function() {
    $("#wait").css({ visibility: "visible" });

    });

    $("#txts :input").blur(function() {
        if ((this.value).length != 10) {
            this.value = 'Mobile phone must have 10 digits.';
        }
    });

    $("#txts :input").focus(function() {
        if (this.value == 'Mobile phone must have 10 digits.') {
            this.value = '';
        }
    });

    $("#ctl00_MainContent_SearchBtn").click(function() {
        $("#ctl00_MainContent_ValidatorLbl").css({ display: "none" });
        $("#ctl00_MainContent_ValidatorLbl2").css({ display: "none" });
        $("#ctl00_MainContent_TryAgainLbl").css({ display: "none" });
        $("#ctl00_MainContent_WrongCaptchalbl").css({ display: "none" });
    });
   


    function stringFormat(mystr) {
        var finalString;
        var temp = mystr.split(" ");
        for (var i = 0; i < temp.length; i++) {
            finalString += temp[i].substr(0, 1).toUpperCase() + temp[i].substr(1).toLowerCase() + " ";
            finalString = finalString.replace(/undefined/g, "");
        }
        return finalString;
    }

});


    //Normal JS

    function showImage(imgId, typ) {
        var objImg = document.getElementById(imgId);
        if (objImg) {
            if (typ == "1")
                objImg.src = "Assets/Images/searchDown.png";
            else if (typ == "2")
                objImg.src = "Assets/Images/searchUp.png";
        }
    }

    function isNumberKey(evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

        return true;
    }

    //ViewAd.aspx


    

