function PopControls() {
    txtEmailId = document.getElementById('txtEmailIdAds');
    txtPhno = document.getElementById('txtPhno');
}
var ContactNo = "";
function ValidAll() {
    PopControls();
    if (txtEmailId.value != "") {
        if (!ValidateEmailID(txtEmailId.value)) {
            alert("Enter valid email address!");
            txtEmailId.focus();
            return false;
        }
    }
    else {
        alert("Email address cannot be blank!");
        txtEmailId.focus();
        return false;
    }
    if (txtPhno.value == "") {
        ContactNo = "";
    }
    else {
        ContactNo = txtPhno.value;
    }
    return true;
}

var nocache = 0;
nocache = Math.random();
function SaveVistors() {
        // Set te random number to add to URL request
        nocache = Math.random();
        if (ValidAll()) {
            // Pass the login variables like URL variable
            http.open('get', 'karaikudi-properties-signup.php?EmailID=' + txtEmailId.value + '&PhNo=' + ContactNo + '&nocache = ' + nocache);
            http.onreadystatechange = GetSaveReply;
            http.send(null);
        }
    }

    function GetSaveReply() {
        if (http.readyState == 4) {
            var response = http.responseText;
            if (white_space(response) == "1") {
                InsertLog("Sign up", 0);
                alert("Thanks for contacting us, our executives will contact you as soon as possible!");
                hidePopUp();
            }
            else if (white_space(response) == "-1") {
                alert("Unable To Contact!");
            }
             else if (white_space(response) == "2") {
                alert("User already exists!");
            }
            else
                alert("Unable to save!");

        }
    }

    function white_space(field) {
       return  field = (field).replace(/^\s*|\s*$/g, '');
    }

    function ClearControls() {
        PopControls();
        txtEmailId.value = "";
        txtPhno.value = "";
    }

    var popWindowWidth = '350'; // pop up window width (in pixels) .

    var popWindowHeight = '180'; // pop up window height (in pixels).

    var centerPopUpWindow = 'yes'; // do you want the pop up window to be automatically centered in browser window? yes or no. NOTE: Height is somewhat higher than center due to toolbars and browser top height.
    var popWindowBackgroundColor = '#FCEBD1'; // pop up window background color (named or rgb).

    var popWindowPadding = '8'; // padding or margin between contents of pop up window and edges of pop up window in pixels.

    var popWindowPositionTop = '20'; // where top edge of popup window will be displayed (ignored if centerPopUpWindow = true - see above).

    var popWindowPositionLeft = '100'; // where left edge of popup window will be displayed (ignored if centerPopUpWindow = true - see above).

    var popWindowBorderStyle = 'solid'; // type of border for popup (solid,double,grooved,ridged,inset,outset).

    var popWindowBorderWidth = '1'; // border thickness of popup window (must be at least 3 for double style).

    var popWindowBorderColor = 'black'; // color of border (named or rgb).

    var popWinFontFamily = 'arial,verdana,sans-serif'; //font-family of text within pop up window. NOTE: Leave empty ('') if defined elsewhere.

    var popWinFontSize = '11px'; // size of font for text in pop up window. Again, leave empty ('') if defined elsewhere.

    var popWindowDelay = '500'; // microseconds before pop up is displayed (1000 = 1 second).

    var popWindowShadowColor = '#666666'; //drop shadow color, named or rgb - shows in IE5+ only. 'none'=no shadow.

    var ie = document.all
    var ns6 = document.getElementById && !document.all
    function showPopUp() {
        document.getElementById('pWinConfg').style.visibility = 'visible';
    }
    function hidePopUp() {
        document.getElementById('pWinConfg').style.visibility = 'hidden';
    }
    function startPopUp() {
        timerID = setTimeout('showPopUp()', popWindowDelay);
    }
    var pWinConfg = "<style>.pWinConfg{\n";
    if (popWinFontFamily !== '') {
        pWinConfg += "font-family:" + popWinFontFamily + ";\n";
    }
    if (popWinFontSize !== '') {
        pWinConfg += "font-size:" + popWinFontSize + ";\n";
    }
    pWinConfg += "position:absolute;\n";
    pWinConfg += "width:" + popWindowWidth + ";\n";
    pWinConfg += "height:" + popWindowHeight + ";\n";
    pWinConfg += "background-color:" + popWindowBackgroundColor + ";\n";
    if (centerPopUpWindow.toLowerCase() == 'yes') {
        var popTop = (screen.height / 2.667) - (popWindowHeight / 2);
        var popLeft = (screen.width / 2) - (popWindowWidth / 2);
        pWinConfg += "top:" + popTop + ";\n";
        pWinConfg += "left:" + popLeft + ";\n";
    } else {
        pWinConfg += "top:" + popWindowPositionTop + ";\n";
        pWinConfg += "left:" + popWindowPositionLeft + ";\n";
    }
    pWinConfg += "border-style:" + popWindowBorderStyle + ";\n";
    pWinConfg += "border-width:" + popWindowBorderWidth + ";\n";
    pWinConfg += "border-color:" + popWindowBorderColor + ";\n";
    pWinConfg += "padding:" + popWindowPadding + ";\n";
    pWinConfg += "visibility:hidden;\n";
    if (popWindowShadowColor != 'none') {
        pWinConfg += "@filter: progid:DXImageTransform.Microsoft.Shadow(color=" + popWindowShadowColor + ",direction=135);\n";
    }
    pWinConfg += "}<\/style>\n";
    document.write(pWinConfg);

    function LocationOnFocus() {
        document.getElementById('txtLocation').value = "";
    }


   
