var nocache = 0;
/* ------------------------------------------------- SELL PROPERTY -------------------------------------------- */

var sIsapproval = "";
var page = "";
var nID="";
var PostRequirementID="";
function GetQuerystring(strURL) {
    //nID = strURL.substring(strURL.indexOf('?')+4, strURL.length);
    arrSplittURL = strURL.split('&');
    nID = arrSplittURL[0].substring(arrSplittURL[0].indexOf('?') + 4, arrSplittURL[0].length);
    PostRequirementID = nID;
    if (arrSplittURL.length > 1) {
        sIsapproval = arrSplittURL[1].substring(arrSplittURL[1].indexOf('=') + 1, arrSplittURL[1].length);
        page = arrSplittURL[2].substring(arrSplittURL[2].indexOf('=') + 1, arrSplittURL[2].length);
    }
    else
        sIsapproval = "";
}


function Change(obj, evt)
{
    if(evt.type=="focus" || evt.type=="blur")
        obj.style.color="black";
}

function GetEncodedQuerystring(strURL) {
    
    if(strURL.contains('?'))
    {
        arrSplittURL = strURL.split('&');
        var asd=unescape(arrSplittURL); 
        strEncodedURL = arrSplittURL[0].substring(arrSplittURL[0].indexOf('?') + 4, arrSplittURL[0].length);
    }
    else
    strEncodedURL = "";
}

function LoadPostRequirementData() {

    GetEncodedQuerystring(parent.document.URL);//GetQuerystring(parent.document.URL);
    if (strEncodedURL != "") {
        PostRequirementApproval();
    }
    else {
        document.getElementById('login').innerHTML = "<b><a href='#' onclick='CheckLoggedOut()'>LOGOUT</a></b>";
    }
}

function PostRequirementApproval() {
    nocache = Math.random();
    http.open('get', "controller/properties.php?Type=ApproveRequirement&EncodedURL=" + strEncodedURL + '&nocache = ' + nocache);
    http.onreadystatechange = GetPostRequirementData;
    http.send(null);
}


function DisableSellControls()
{
     SellControls();
     
       cmbPropValue.disabled = true;
       txtState.disabled = true;
       txtTitle.disabled = true;
       txtModifiedTitle.disabled = true; 
       txtCity.disabled = true;
       txtSellLocation.disabled = true;
       txtPropAmt.disabled = true;
       txtPincode.disabled = true;
       txtRequirement.disabled = true;
       txtContactname.disabled = true;
       txtEmailID.disabled = true;
       txtMobileno.disabled = true;
       txtLandlineno.disabled = true;
       txtUrl.disabled = true;
}

function EnableSellControls()
{
     SellControls();
     
        cmbPropValue.disabled = false;
        txtState.disabled = false;
        txtTitle.disabled = false;
        txtModifiedTitle.disabled = false;
        txtCity.disabled = false;
        txtSellLocation.disabled = false;
        txtPropAmt.disabled = false;
        txtPincode.disabled = false;
        txtRequirement.disabled = false;
        txtContactname.disabled = false;
        txtEmailID.disabled = false;
        txtMobileno.disabled = false;
        txtLandlineno.disabled = false;
        txtUrl.disabled = false;
    }

    function DisableBuyControls() {
        BuyControls();

        cmbBuyPropValue.disabled = true;
        txtBuyTitle.disabled = true;
        txtModifiedTitle.disabled = true;
        txtBuyState.disabled = true;
        txtBuyCity.disabled = true;
        txtBuyLocation.disabeld = true;
        txtBuyFromAmt.disabled = true;
        txtBuyToAmt.disabled = true;
        txtBuyPincode.disabled = true;
        txtBuyRequirement.disabled = true;
        txtBuyContactname.disabled = true;
        txtBuyEmailID.disabled = true;
        txtBuyMobileno.disabled = true;
        txtBuyLandlineno.disabled = true;
        txtUrl.disabled = true;
    }

    function EnableBuyControls() {
        BuyControls();

        cmbBuyPropValue.disabled = false;
        txtBuyTitle.disabled = false;
        txtModifiedTitle.disabled = false;
        txtBuyState.disabled = false;
        txtBuyCity.disabled = false;
        txtBuyLocation.disabeld = false;
        txtBuyFromAmt.disabled = false;
        txtBuyToAmt.disabled = false;
        txtBuyPincode.disabled = false;
        txtBuyRequirement.disabled = false;
        txtBuyContactname.disabled = false;
        txtBuyEmailID.disabled = false;
        txtBuyMobileno.disabled = false;
        txtBuyLandlineno.disabled = false;
        txtUrl.disabled = false;
        
    }

    function DisbaleRentInControls() {
        RentInControls();

        cmbRentInPropValue.disabled = true;
        txtRentInTitle.disabled = true;
        txtModifiedTitle.disabled = true;
        txtRentInState.disabled = true;
        txtRentInCity.disabled = true;
        txtRentInLocation.disabled = true;
        txtRentInFromAmt.disabled = true;
        txtRentInToAmt.disabled = true;
        txtRentInPincode.disabled = true;
        txtRentInRequirement.disabled = true;
        txtRentInContactname.disabled = true;
        txtRentInEmailID.disabled = true;
        txtRentInMobileno.disabled = true;
        txtRentInLandlineno.disabled = true;
        txtUrl.disabled = true;
    }
    function EnableRentInControls() {

        RentInControls();
        
        cmbRentInPropValue.disabled = false;
        txtRentInTitle.disabled = false;
        txtModifiedTitle.disabled = false;
        txtRentInState.disabled = false;
        txtRentInCity.disabled = false;
        txtRentInLocation.disabled = false;
        txtRentInFromAmt.disabled = false;
        txtRentInToAmt.disabled = false;
        txtRentInPincode.disabled = false;
        txtRentInRequirement.disabled = false;
        txtRentInContactname.disabled = false;
        txtRentInEmailID.disabled = false;
        txtRentInMobileno.disabled = false;
        txtRentInLandlineno.disabled = false;
        txtUrl.disabled = false;
    }

    function DisableRentOutControls() {
        RentOutControls(); 
        cmbRentOutPropValue.disabled = true;
        txtRentOutTitle.disabled = true;
        txtModifiedTitle.disabled = true;
        txtRentOutState.disabled = true;
        txtRentOutCity.disabled = true;
        txtRentOutLocation.disabled = true;
        txtRentAmt.disabled = true;
        txtRentOutPincode.disabled = true;
        txtRentOutRequirement.disabled = true;
        txtRentOutContactname.disabled = true;
        txtRentOutEmailID.disabled = true;
        txtRentOutMobileno.disabled = true;
        txtRentOutLandlineno.disabled = true;
        txtUrl.disabled = true;
    }

    function EnableRentOutControls() {
        RentOutControls();

        cmbRentOutPropValue.disabled = false;
        txtRentOutTitle.disabled = false;
        txtModifiedTitle.disabled = false;
        txtRentOutState.disabled = false;
        txtRentOutCity.disabled = false;
        txtRentOutLocation.disabled = false;
        txtRentAmt.disabled = false;
        txtRentOutPincode.disabled = false;
        txtRentOutRequirement.disabled = false;
        txtRentOutContactname.disabled = false;
        txtRentOutEmailID.disabled = false;
        txtRentOutMobileno.disabled = false;
        txtRentOutLandlineno.disabled = false;
        txtUrl.disabled = false;
    }
    function DiableLeasInControls() {

        LeaseInControls();

        cmbLeaseInPropValue.disabled = true;
        txtLeaseInTitle.disabled = true;
        txtModifiedTitle.disabled = true;
        txtLeaseInState.disabled = true;
        txtLeaseInCity.disabled = true;
        txtLeaseInLocation.disabled = true;
        txtLeaseInFromAmt.disabled = true;
        txtLeaseInToAmt.disabled = true;
        txtLeaseInPincode.disabled = true;
        txtLeaseInRequirement.disabled = true;
        txtLeaseInContactname.disabled = true;
        txtLeaseInEmailID.disabled = true;
        txtLeaseInMobileno.disabled = true;
        txtLeaseInLandlineno.disabled = true;
        txtUrl.disabled = true;
    }
    function EnableLeasInControls() {
        LeaseInControls();

        cmbLeaseInPropValue.disabled = false;
        txtLeaseInTitle.disabled = false;
        txtModifiedTitle.disabled = false;
        txtLeaseInState.disabled = false;
        txtLeaseInCity.disabled = false;
        txtLeaseInLocation.disabled = false;
        txtLeaseInFromAmt.disabled = false;
        txtLeaseInToAmt.disabled = false;
        txtLeaseInPincode.disabled = false;
        txtLeaseInRequirement.disabled = false;
        txtLeaseInContactname.disabled = false;
        txtLeaseInEmailID.disabled = false;
        txtLeaseInMobileno.disabled = false;
        txtLeaseInLandlineno.disabled = false;
        txtUrl.disabled = false;
    }

    function DisableLeaseOutControls() {
        LeaseOutControls();

        cmbLeaseOutPropValue.disabled = true;
        txtLeaseOutTitle.disabled = true;
        txtModifiedTitle.disabled = true;
        txtLeaseOutState.disabled = true;
        txtLeaseOutCity.disabled = true;
        txtLeaseOutLocation.disabled = true;
        txtRentAmt.disabled = true;
        txtLeaseOutPincode.disabled = true;
        txtLeaseOutRequirement.disabled = true;
        txtLeaseOutContactname.disabled = true;
        txtLeaseOutEmailID.disabled = true;
        txtLeaseOutMobileno.disabled = true;
        txtLeaseOutLandlineno.disabled = true;
        txtUrl.disabled = true;
    }

    function EnableLeaseOutControls() {
        LeaseOutControls();

        cmbLeaseOutPropValue.disabled = false;
        txtLeaseOutTitle.disabled = false;
        txtModifiedTitle.disabled = false;
        txtLeaseOutState.disabled = false;
        txtLeaseOutCity.disabled = false;
        txtLeaseOutLocation.disabled = false;
        txtRentAmt.disabled = false;
        txtLeaseOutPincode.disabled = false;
        txtLeaseOutRequirement.disabled = false;
        txtLeaseOutContactname.disabled = false;
        txtLeaseOutEmailID.disabled = false;
        txtLeaseOutMobileno.disabled = false;
        txtLeaseOutLandlineno.disabled = false;
        txtUrl.disabled = false;
    }
    
function GetPostRequirementData() {

    if (http.readyState == 4) {
        var response = http.responseText;
        var RequirenmentData = response.split("~");
        sIsapproval=RequirenmentData[23];
        document.getElementById('login').innerHTML = "<b><a href='#' onclick='CheckLoggedOut()'>LOGOUT</a></b>";
        
        if (RequirenmentData[24] == "sell.html") {
       
            SellControls();
            cmbPropValue.value = RequirenmentData[4];
            txtState.value = RequirenmentData[6];
            txtTitle.value = RequirenmentData[2];
            txtModifiedTitle.value = RequirenmentData[21];
            txtCity.value = RequirenmentData[5];
            txtSellLocation.value = RequirenmentData[7];
            txtPropAmt.value = RequirenmentData[9];
            txtPincode.value = RequirenmentData[8];
            txtRequirement.value = RequirenmentData[12];
            txtModifiedRequirement.value = RequirenmentData[13];
            txtContactname.value = RequirenmentData[11];
            txtEmailID.value = RequirenmentData[14];
            txtMobileno.value = RequirenmentData[15];
            txtLandlineno.value = RequirenmentData[16];
            txtUrl.value = RequirenmentData[22]; 
            arrURL = RequirenmentData[17].split('|');
            document.getElementById('hdImagePath').value = "";
            document.getElementById('hdImagePath').value = RequirenmentData[17];
           
            if (arrURL[0] != "")
            document.getElementById('result').innerHTML = "<img src='" + arrURL[0] + "' />";

        if (RequirenmentData[23] == "true" || RequirenmentData[23] == "false") {
            document.getElementById('login').innerHTML = "<b><a href='login.html'>LOGIN</a></b>";
            if(RequirenmentData[20]!="Admin")
                DisableSellControls();
                if (arrURL.length > 0) {
                    FormTable(arrURL);
                }
                if (RequirenmentData[23] == "true") {
                    btnCalculate.value = "Approve";
                }
                else {
                    btnCalculate.value = "Reject";
                }
            }
            else {
                txtMobileno.value = "+" + txtMobileno.value.split(' ').join('');
                if (RequirenmentData[23] == "none") {
                    EnableSellControls();
                    txtTitle.disabled = true;
                    txtModifiedTitle.disabled = false;
                    txtRequirement.disabled = true;
                    txtModifiedRequirement.disabled = false;
                    if (RequirenmentData[1] == RequirenmentData[19] || RequirenmentData[20] == "Admin") {
                        btnCalculate.value = "Update";
                        document.getElementById('hdPropID').value = RequirenmentData[0];//nID;
                        document.getElementById('chkSellClosed').style.display = "inline";
                        if (arrURL.length > 0) {
                            FormTable(arrURL);
                        }
                    }
                    else {
                        DisableSellControls(); 
                        btnCalculate.disabled = true;
                        btnClear.disabled = true;
                        document.getElementById('fileToUpload').disabled = true;
                        document.getElementById('buttonForm').disabled = true;
                        
                        if (arrURL.length > 0) {
                            FromViewTable(arrURL);
                        }
                    }
                }
            }
            

        }
        else if (RequirenmentData[24] == "buy.html") {
            BuyControls();
            cmbBuyPropValue.value = RequirenmentData[4];
            txtBuyTitle.value = RequirenmentData[2];
            txtModifiedTitle.value = RequirenmentData[21];
            txtBuyState.value = RequirenmentData[6];
            txtBuyCity.value = RequirenmentData[5];
            txtBuyLocation.value = RequirenmentData[7];
            txtBuyFromAmt.value = RequirenmentData[9];
            txtBuyToAmt.value = RequirenmentData[10];
            txtBuyPincode.value = RequirenmentData[8];
            txtBuyRequirement.value = RequirenmentData[12];
            txtModifiedRequirement.value = RequirenmentData[13];
            txtBuyContactname.value = RequirenmentData[11];
            txtBuyEmailID.value = RequirenmentData[14];
            txtBuyMobileno.value = RequirenmentData[15];
            txtBuyLandlineno.value = RequirenmentData[16];
            txtUrl.value = RequirenmentData[22]; 


            if (RequirenmentData[23] == "true" || RequirenmentData[23] == "false") {
                document.getElementById('login').innerHTML = "<b><a href='login.html'>LOGIN</a></b>";
                if (RequirenmentData[20] != "Admin")
                DisableBuyControls();
                if (RequirenmentData[23] == "true") {
                    btnBuyCalculate.value = "Approve";
                }
                else {
                    btnBuyCalculate.value = "Reject";
                }
            }
            else {
                if (RequirenmentData[1] == RequirenmentData[19] || RequirenmentData[20] == "Admin") {
                    EnableBuyControls();

                    txtBuyTitle.disabled = true;
                    txtModifiedTitle.disabled = false;
                    txtBuyRequirement.disabled = true;
                    txtModifiedRequirement.disabled = false;

                    txtBuyMobileno.value = "+" + txtBuyMobileno.value.split(' ').join('');
                    if (RequirenmentData[23] == "none") {
                        btnBuyCalculate.value = "Update";
                        document.getElementById('hdPropID').value = RequirenmentData[0];
                        document.getElementById('chkBuyClosed').style.display = "inline";
                    }
                }
                else {
                    DisableBuyControls();
                    document.getElementById('MovePropList').style.display = "inline";
                    btnBuyCalculate.disabled = true;
                    btnBuyClear.disabled = true;
                }
                

            }
        }
        else if (RequirenmentData[24] == "rent-in.html") {
            RentInControls();
            cmbRentInPropValue.value = RequirenmentData[4];
            txtRentInTitle.value = RequirenmentData[2];
            txtModifiedTitle.value = RequirenmentData[21];
            txtRentInState.value = RequirenmentData[6];
            txtRentInCity.value = RequirenmentData[5];
            txtRentInLocation.value = RequirenmentData[7];
            txtRentInFromAmt.value = RequirenmentData[9];
            txtRentInToAmt.value = RequirenmentData[10];
            txtRentInPincode.value = RequirenmentData[8];
            txtRentInRequirement.value = RequirenmentData[12];
            txtModifiedRequirement.value = RequirenmentData[13];
            txtRentInContactname.value = RequirenmentData[11];
            txtRentInEmailID.value = RequirenmentData[14];
            txtRentInMobileno.value = RequirenmentData[15];
            txtRentInLandlineno.value = RequirenmentData[16];
            txtUrl.value = RequirenmentData[22]; 
           
            
            if (RequirenmentData[23] == "true" || RequirenmentData[23] == "false") {
                document.getElementById('login').innerHTML = "<b><a href='login.html'>LOGIN</a></b>";
                if (RequirenmentData[20] != "Admin")
                DisbaleRentInControls();
                if (RequirenmentData[23] == "true") {
                    btnRentInCalculate.value = "Approve";
                }
                else {
                    btnRentInCalculate.value = "Reject";
                }
            }
            else {
                if (RequirenmentData[1] == RequirenmentData[19] || RequirenmentData[20] == "Admin") {
                    EnableRentInControls();
                    txtRentInTitle.disabled = true;
                    txtModifiedTitle.disabled = false;
                    txtRentInRequirement.disabled = true;
                    txtModifiedRequirement.disabled = false;
                    txtRentInMobileno.value = "+" + txtRentInMobileno.value.split(' ').join('');
                    if (RequirenmentData[23] == "none") {
                        btnRentInCalculate.value = "Update";
                        document.getElementById('hdPropID').value = RequirenmentData[0];
                        document.getElementById('chkRentInClosed').style.display = "inline";
                    }
                }
                else {
                    DisbaleRentInControls();
                    document.getElementById('MovePropList').style.display = "inline";
                    btnRentInCalculate.disabled = true;
                    btnRentInClear.disabled = true;
                }

            }
        }
        else if (RequirenmentData[24] == "rent-out.html") {
            RentOutControls();
            cmbRentOutPropValue.value = RequirenmentData[4];
            txtRentOutTitle.value = RequirenmentData[2];
            txtModifiedTitle.value = RequirenmentData[21];
            txtRentOutState.value = RequirenmentData[6];
            txtRentOutCity.value = RequirenmentData[5];
            txtRentOutLocation.value = RequirenmentData[7];
            txtRentAmt.value = RequirenmentData[9];
            txtRentOutPincode.value = RequirenmentData[8];
            txtRentOutRequirement.value = RequirenmentData[12];
            txtModifiedRequirement.value = RequirenmentData[13];
            txtRentOutContactname.value = RequirenmentData[11];
            txtRentOutEmailID.value = RequirenmentData[14];
            txtRentOutMobileno.value = RequirenmentData[15];
            txtRentOutLandlineno.value = RequirenmentData[16];
            txtUrl.value = RequirenmentData[22]; 
            
            document.getElementById('hdImagePath').value = "";
            document.getElementById('hdImagePath').value = RequirenmentData[17];

            arrURL = RequirenmentData[17].split('|');

            if (arrURL[0] != "")   
            document.getElementById('result').innerHTML = "<img src='" + arrURL[0] + "' />";

        if (RequirenmentData[23] == "true" || RequirenmentData[23] == "false") {
            document.getElementById('login').innerHTML = "<b><a href='login.html'>LOGIN</a></b>";
                if (RequirenmentData[20] != "Admin")
                    DisableRentOutControls();
                if (arrURL.length > 0) {
                    FormTable(arrURL);
                }
                if (RequirenmentData[23] == "true") {
                    
                    btnRentoutCalculate.value = "Approve";
                }
                else {
                    btnRentoutCalculate.value = "Reject";
                }
            }
            else {
                if (RequirenmentData[1] == RequirenmentData[19] || RequirenmentData[20] == "Admin") {
                    EnableRentOutControls();
                    txtRentOutTitle.disabled = true;
                    txtModifiedTitle.disabled = false;
                    txtRentOutRequirement.disabled = true;
                    txtModifiedRequirement.disabled = false;
                    txtRentOutMobileno.value = "+" + txtRentOutMobileno.value.split(' ').join('');
                    if (RequirenmentData[23] == "none") {
                        btnRentoutCalculate.value = "Update";
                        document.getElementById('hdPropID').value = RequirenmentData[0];
                        document.getElementById('chkRentOutClosed').style.display = "inline";
                        if (arrURL.length > 0) {
                            FormTable(arrURL);
                        }
                    }

                }
                else {
                    DisableRentOutControls();
                    btnRentoutCalculate.disabled = true;
                    btnRentOutClear.disabled = true;
                    document.getElementById('fileToUpload').disabled = true;
                    document.getElementById('buttonForm').disabled = true;

                    if (arrURL.length > 0) {
                        FromViewTable(arrURL);
                    }
                }
            }
            
        }
        else if (RequirenmentData[24] == "lease-in.html") {
            LeaseInControls();
            cmbLeaseInPropValue.value = RequirenmentData[4];
            txtLeaseInTitle.value = RequirenmentData[2];
            txtModifiedTitle.value = RequirenmentData[21];
            txtLeaseInState.value = RequirenmentData[6];
            txtLeaseInCity.value = RequirenmentData[5];
            txtLeaseInLocation.value = RequirenmentData[7];
            txtLeaseInFromAmt.value = RequirenmentData[9];
            txtLeaseInToAmt.value = RequirenmentData[10];
            txtLeaseInPincode.value = RequirenmentData[8];
            txtLeaseInRequirement.value = RequirenmentData[12];
            txtModifiedRequirement.value = RequirenmentData[13];
            txtLeaseInContactname.value = RequirenmentData[11];
            txtLeaseInEmailID.value = RequirenmentData[14];
            txtLeaseInMobileno.value = RequirenmentData[15];
            txtLeaseInLandlineno.value = RequirenmentData[16];
            txtUrl.value = RequirenmentData[22]; 

            if (RequirenmentData[23] == "true" || RequirenmentData[23] == "false") {
                document.getElementById('login').innerHTML = "<b><a href='login.html'>LOGIN</a></b>";
                if (RequirenmentData[20] != "Admin")
                DiableLeasInControls();
                if (RequirenmentData[23] == "true") {
                    btnLeaseInCalculate.value = "Approve";
                }
                else {
                    btnLeaseInCalculate.value = "Reject";
                }
            }
            else {
                if (RequirenmentData[1] == RequirenmentData[19] || RequirenmentData[20] == "Admin") {
                    EnableLeasInControls();

                    txtLeaseInTitle.disabled = true;
                    txtModifiedTitle.disabled = false;
                    txtLeaseInRequirement.disabled = true;
                    txtModifiedRequirement.disabled = false;
                    
                    txtLeaseInMobileno.value = "+" + txtLeaseInMobileno.value.split(' ').join('');
                    if (RequirenmentData[23] == "none") {
                        btnLeaseInCalculate.value = "Update";
                        document.getElementById('hdPropID').value = RequirenmentData[0];
                        document.getElementById('chkLeaseInClosed').style.display = "inline";
                    }
                }
                else {
                    DiableLeasInControls();
                    document.getElementById('MovePropList').style.display = "inline";
                    btnLeaseInCalculate.disabled = true;
                    btnLeaseInClear.disabled = true;
                }
            }
        }
        else if (RequirenmentData[24] == "lease-out.html") {
            LeaseOutControls();
            cmbLeaseOutPropValue.value = RequirenmentData[4];
            txtLeaseOutTitle.value = RequirenmentData[2];
            txtModifiedTitle.value = RequirenmentData[21];
            txtLeaseOutState.value = RequirenmentData[6];
            txtLeaseOutCity.value = RequirenmentData[5];
            txtLeaseOutLocation.value = RequirenmentData[7];
            txtRentAmt.value = RequirenmentData[9];
            txtLeaseOutPincode.value = RequirenmentData[8];
            txtLeaseOutRequirement.value = RequirenmentData[12];
            txtModifiedRequirement.value = RequirenmentData[13];
            txtLeaseOutContactname.value = RequirenmentData[11];
            txtLeaseOutEmailID.value = RequirenmentData[14];
            txtLeaseOutMobileno.value = RequirenmentData[15];
            txtLeaseOutLandlineno.value = RequirenmentData[16];
            txtUrl.value = RequirenmentData[22]; 

            document.getElementById('hdImagePath').value = "";
            document.getElementById('hdImagePath').value = RequirenmentData[17];
            
            arrURL = RequirenmentData[17].split('|');

            if (arrURL[0]!="")
            document.getElementById('result').innerHTML = "<img src='" + arrURL[0] + "' />";

        if (RequirenmentData[23] == "true" || RequirenmentData[23] == "false") {
            document.getElementById('login').innerHTML = "<b><a href='login.html'>LOGIN</a></b>";
            if (RequirenmentData[20] != "Admin")
                DisableLeaseOutControls();
                if (arrURL.length > 0) {
                    FormTable(arrURL);
                }
                if (RequirenmentData[23] == "true") {
                    btnLeaseOutCalculate.value = "Approve";
                }
                else {
                    btnLeaseOutCalculate.value = "Reject";
                }
            }
            else {
                if (RequirenmentData[1] == RequirenmentData[19] || RequirenmentData[20] == "Admin") {
                    EnableLeaseOutControls();
                    txtLeaseOutTitle.disabled = true;
                    txtModifiedTitle.disabled = false;
                    txtLeaseOutRequirement.disabled = true;
                    txtModifiedRequirement.disabled = false;
                    txtLeaseOutMobileno.value = "+" + txtLeaseOutMobileno.value.split(' ').join('');
                    if (RequirenmentData[23] == "none") {
                        btnLeaseOutCalculate.value = "Update";
                        document.getElementById('hdPropID').value = RequirenmentData[0];
                        document.getElementById('chkLeaseOutClosed').style.display = "inline";
                        if (arrURL.length > 0) {
                            FormTable(arrURL);
                        }
                    }
                }
                else {
                    DisableLeaseOutControls();
                    btnLeaseOutCalculate.disabled = true;
                    btnLeaseOutClear.disabled = true;
                    document.getElementById('fileToUpload').disabled = true;
                    document.getElementById('buttonForm').disabled = true;

                    if (arrURL.length > 0) {
                        FromViewTable(arrURL);
                    }
                }
            }
        }

    }
   
}

function SellControls()
{
    txtSellTitle = document.getElementById('txtSellTitle');
    txtModifiedTitle = document.getElementById('txtModifiedTitle');
    cmbPropValue=document.getElementById('cmbPropValue');
    txtState = document.getElementById('txtState');
    txtTitle = document.getElementById('txtSellTitle');
    txtCity=document.getElementById('txtCity');
    txtSellLocation=document.getElementById('txtSellLocation');
    txtPropAmt=document.getElementById('txtPropAmt');
    txtPincode=document.getElementById('txtPincode');
    txtRequirement = document.getElementById('txtRequirement');
    txtModifiedRequirement = document.getElementById('txtModifiedRequirement');
    txtContactname=document.getElementById('txtContactname');
    txtEmailID=document.getElementById('txtEmailID');
    txtMobileno=document.getElementById('txtMobileno');
    txtLandlineno = document.getElementById('txtLandlineno');
    txtUrl = document.getElementById('txtUrl');
    btnCalculate=document.getElementById('btnCalculate');
    btnClear=document.getElementById('btnClear');
}


function ValidateTitle(strControlName)
{
    if(strControlName.value!="" && strControlName.value!=strControlName.title)
    {
         if(strControlName.value.length<50)
         {
            alert("Title should be minimum of 50 characters!")
            return false;
         }
         else
         {
            return true;
         }
    }
    else
    {
        return true;
    }
}



function SaveSell()
{
    SellControls();
    var IsTransClosed = "";
    if (btnCalculate.value == "Post") {
        if(ValidateTitle(txtSellTitle))
        {
            if (SellValidation()) 
            {
                 nocache = Math.random();
                 
                 var strUploadImgPath=document.getElementById('hdImagePath').value;
                 var strProjectType = cmbPropValue.value;
                 var strValueOf = Getvalue(txtSellTitle, txtLandlineno, txtRequirement);
                 if (txtSellTitle.value == "Enter title") {
                     txtSellTitle.value = "";
                 }
                 if (txtUrl.value == "Enter Site URL") {
                     txtUrl.value = "";
                 }
                 txtRequirement.value = encodeURIComponent(txtRequirement.value);
                 txtModifiedRequirement.value = encodeURIComponent(txtModifiedRequirement.value);
                 
                 http.open('get', 'controller/properties.php?Type=' + "Sell" + '&title=' + txtSellTitle.value + '&proptype=' + strProjectType + '&state=' + txtState.value + '&city=' + txtCity.value + '&fromamount=' + txtPropAmt.value + '&toamount=' + txtPropAmt.value + '&location=' + txtSellLocation.value + '&pincode=' + txtPincode.value + '&name=' + txtContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtEmailID.value + '&mobile=' + txtMobileno.value + '&landline=' + strValueOf.strLandline + '&title=' + txtTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value  + '&TransClosed=0' + '&nocache = ' + nocache);
                 http.onreadystatechange = GetReply;
                 http.send(null);
            }
        }
        else
        {
        }
    }
    else if (btnCalculate.value == "Update") {
    //if(ValidateTitle(txtSellTitle))
    //{
        if (SellValidation()) {
            
                nocache = Math.random();
                if (document.getElementById('chkSellTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else
                {
                IsTransClosed = 0;
                }
                var strUploadImgPath = document.getElementById('hdImagePath').value;
                var strProjectType = cmbPropValue.value;
                var strValueOf = Getvalue(txtSellTitle, txtLandlineno, txtRequirement);

                if (txtSellTitle.value == "Enter title") {
                    txtSellTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
//                var arrModReq = txtModifiedRequirement.value.split("\n");
//                var sModReq = "";
//                for (i = 0; i < arrModReq.length; i++) {
//                    if (arrModReq[i] == "\n")
//                    {arrModReq[i] = "\\n"; }
//                    sModReq = sModReq + arrModReq[i];
//                }
                txtModifiedRequirement.value = encodeURIComponent(txtModifiedRequirement.value);
                http.open('get', 'controller/properties.php?Type=' + "SellUpdate" + '&Trans_Type=Sell' + '&title=' + txtSellTitle.value + '&proptype=' + strProjectType + '&state=' + txtState.value + '&city=' + txtCity.value + '&fromamount=' + txtPropAmt.value + '&toamount=' + txtPropAmt.value + '&location=' + txtSellLocation.value + '&pincode=' + txtPincode.value + '&name=' + txtContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtEmailID.value + '&mobile=' + txtMobileno.value + '&landline=' + strValueOf.strLandline + '&title=' + txtTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetUpdateReply;
                http.send(null);
            }
        }
        else 
        {
            if (SellValidation()) {
                if (document.getElementById('chkSellTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }
                var strUploadImgPath = document.getElementById('hdImagePath').value;
                var strProjectType = cmbPropValue.value;
                var strValueOf = Getvalue(txtSellTitle, txtLandlineno, txtRequirement);

                if (txtSellTitle.value == "Enter title") {
                    txtSellTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                txtModifiedRequirement.value = encodeURIComponent(txtModifiedRequirement.value);
                http.open('get', "controller/properties.php?Type=UpdateApproval&EncodedURL=" + strEncodedURL + '&title=' + txtSellTitle.value + '&proptype=' + strProjectType + '&state=' + txtState.value + '&city=' + txtCity.value + '&fromamount=' + txtPropAmt.value + '&toamount=' + txtPropAmt.value + '&location=' + txtSellLocation.value + '&pincode=' + txtPincode.value + '&name=' + txtContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtEmailID.value + '&mobile=' + txtMobileno.value + '&landline=' + strValueOf.strLandline + '&title=' + txtTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetApprovalReply;
                http.send(null);
            }
        }
 }


    function SendMailToAllForAProperty(PropertyID) {
        nocache = Math.random();
        http.open('get', "controller/properties.php?Type=SendMailToAllUser&PropertyID=" + PropertyID + "&nocache=" + nocache);
        http.onreadystatechange = GetSendMailToAll;
        http.send(null);
    }

    function GetSendMailToAll() {
        if (http.readyState == 4) {
            var response = http.responseText;
            if (response == "1") {
                alert("Mail Send To All 1");
            }
            alert("Mail Send To All 2");
        }
    }

function GetApprovalReply() {
    if (http.readyState == 4) {
        var response = http.responseText;
        response = response.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g, '').replace(/\s+/g, ' ');
        if (response == "1") {
            if (sIsapproval == "true") {
                alert("This requirement approved successfully!");
                window.location = 'login.html';
            }
            else
                alert("This requirement rejected successfully!"); 
        }
        else {
            alert("Unable to approve requirement!");
        }
    }

}


function GetReply() 
{
    if (http.readyState == 4) 
    {
        var strURL = window.location.pathname;
        var strModuleName="";
        var strFilename = strURL.substring(strURL.lastIndexOf('/')+1);
        var response = http.responseText;
        if(response==1)
        {
            if(strFilename=="sell.html")
            {
                ClearSellControls();
                ClearUploadControls();
                strModuleName="Sell";
            }
            else if(strFilename=="buy.html")
            {
                ClearBuyControls();
                strModuleName="Buy";
            }
            else if(strFilename=="rent-in.html")
            {
                ClearRentInControls();
                strModuleName="Rent In";
            }
            else if(strFilename=="rent-out.html")
            {
                ClearRentOutControls();
                ClearUploadControls();
                strModuleName="Rent Out";
            }
            else if(strFilename=="lease-in.html")
            {
                ClearLeaseInControls();
                strModuleName="Lease In";
            }
            else if(strFilename=="lease-out.html")
            {
                ClearLeaseOutControls();
                ClearUploadControls();
                strModuleName="Lease Out";
            }
                InsertLog(strModuleName, 1);
                alert("Your property details saved successfully!");
        }
        else
            alert("Unable to save your details!");
    }
}


function GetUpdateReply() {

    if (http.readyState == 4) {
    
        var strURL = window.location.pathname;
        var strModuleName = "";
        var strFilename = strURL.substring(strURL.lastIndexOf('/') + 1);
        var response = http.responseText;
        
        if (response == 1) {
            if (strFilename == "sell.html") {
                ClearSellControls();
                ClearUploadControls();
                strModuleName = "Sell";
                
            }
            else if (strFilename == "buy.html") {
                ClearBuyControls();
                strModuleName = "Buy";
                
            }
            else if (strFilename == "rent-in.html") {
                ClearRentInControls();
                strModuleName = "Rent In";
                
            }
            else if (strFilename == "rent-out.html") {
                ClearRentOutControls();
                ClearUploadControls();
                strModuleName = "Rent Out";
                
            }
            else if (strFilename == "lease-in.html") {
                ClearLeaseInControls();
                strModuleName = "Lease In";
                
            }
            else if (strFilename == "lease-out.html") {
                ClearLeaseOutControls();
                ClearUploadControls();
                strModuleName = "Lease Out";
                
            }
            InsertLog(strModuleName, 1);
            alert("Your property details Updated successfully!");
            window.location = "propertylisting.html?0&0&0&0&0";
        }
        else
            alert("Unable to update your details!");
    }
}
//added by deepa for payment validation
function IsNumeric(strString)
{
    var strValidChars = "0123456789.";
    var strChar;
    var blnResult = true;

    if (strString.length == 0) return false;

    for (i = 0; i < strString.length && blnResult == true; i++) {
        strChar = strString.charAt(i);
        if (strValidChars.indexOf(strChar) == -1) {
            blnResult = false;
        }
    }
    return blnResult;
}



function SellValidation()
{
     
     if (cmbPropValue.value != "0") {
            if(txtState.value!=txtState.title && txtState.value!="") {   
                if(txtCity.value!=txtCity.title && txtCity.value!="") {
                    if(txtSellLocation.value!=txtSellLocation.title && txtSellLocation.value!="") {
                        if(txtPropAmt.value!=txtPropAmt.title && txtPropAmt.value!="") {
                            if (IsNumeric(txtPropAmt.value)) {//added by deepa for payment validation
                                //if (txtPincode.value != txtPincode.title && txtPincode.value != "") {
                                    if (txtContactname.value != txtContactname.title && txtContactname.value != "") {
                                        if (txtEmailID.value != txtEmailID.title) {
                                            if (Validate(txtEmailID.value)) {
                                                if (txtMobileno.value != txtMobileno.title) {
//                                                    if (Validate_Mobile(txtMobileno.value)) {
//                                                        return true;
//                                                    }
//                                                    else {
//                                                        alert("Invalid Mobile Number! \n\nEx. +919999900000");
//                                                        txtMobileno.focus();
//                                                        return false;
                                                    //                                                    }
                                                    return true;
                                                }
                                                else {
                                                    alert("Mobile number cannot be blank!");
                                                    txtMobileno.focus();
                                                    return false;
                                                }
                                            }
                                            else {
                                                alert("Invalid Email!");
                                                txtEmailID.focus();
                                                return false;
                                            }
                                        }
                                        else {
                                            alert("Email cannot be blank!");
                                            txtEmailID.focus();
                                            return false;
                                        }
                                    }
                                    else {
                                        alert("Name cannot be blank!");
                                        txtContactname.focus();
                                        return false;
                                    }
                                }
                                /*else {
                                    alert("Pincode cannot be blank!");
                                    txtPincode.focus();
                                    return false;
                                }
                            
                            }*/
                            else
                            {
                                alert("Enter Valid Amount!");
                                txtPropAmt.focus();
                                return false;
                            }
                        }
                        else
                        {
                            alert("Amount cannot be blank!");
                            txtPropAmt.focus();
                            return false;
                        }
                    }
                    else
                    {
                        alert("Location cannot be blank!");
                        txtSellLocation.focus();
                        return false;
                    }
                }
                else
                {
                    alert("City cannot be blank!");
                    txtCity.focus();
                    return false;
                }
            }
            else
            {
                alert("State cannot be blank!");
                txtState.focus();
                return false;
            }
        }
        else
        {
            cmbPropValue.focus();
            alert("Please select atleast one type!");
            return false;
        }
   
}



function ClearSellControls()
{
   
    SellControls();
    cmbPropValue.value = "0";
    txtState.value=txtState.title;
    txtState.style.color = "gray";
    txtTitle.value = txtTitle.title;
    txtModifiedTitle.style.color = "gray";
    txtModifiedTitle.value = txtModifiedTitle.title;
    txtTitle.style.color = "gray";
    txtCity.value= txtCity.title;
    txtCity.style.color = "gray";
    txtSellLocation.value=txtSellLocation.title;
    txtSellLocation.style.color = "gray";
    txtPropAmt.value=txtPropAmt.title;
    txtPropAmt.style.color = "gray";
    txtPincode.value=txtPincode.title;
    txtPincode.style.color = "gray";
    txtRequirement.value=txtRequirement.title;
    txtRequirement.style.color = "gray";
    txtModifiedRequirement.value=txtModifiedRequirement.title;
    txtModifiedRequirement.style.color = "gray";
    txtContactname.value=txtContactname.title;
    txtContactname.style.color = "gray";
    txtEmailID.value=txtEmailID.title;
    txtEmailID.style.color = "gray";
    txtMobileno.value=txtMobileno.title;
    txtMobileno.style.color = "gray";
    txtLandlineno.value=txtLandlineno.title;
    txtLandlineno.style.color = "gray";
    txtUrl.value = txtUrl.title;
    txtUrl.style.color = "gray";
    btnCalculate.value = "Post";
    EnableSellControls();
    txtModifiedTitle.disabled=true; 
}

/* ------------------------------------------------- END OF SELL PROPERTY -------------------------------------------- */

/* ------------------------------------------------- BUY PROPERTY ---------------------------------------------- */

function BuyControls()
{
    cmbBuyPropValue = document.getElementById('cmbPropValue');
    txtBuyTitle = document.getElementById('txtBuyTitle');
    txtModifiedTitle = document.getElementById('txtModifiedTitle');
    txtBuyState=document.getElementById('txtBuyState');
    txtBuyCity=document.getElementById('txtBuyCity');
    txtBuyLocation=document.getElementById('txtBuyLocation');
    txtBuyFromAmt=document.getElementById('txtBuyFromAmt');
    txtBuyToAmt=document.getElementById('txtBuyToAmt');
    txtBuyPincode=document.getElementById('txtBuyPincode');
    txtBuyRequirement = document.getElementById('txtBuyRequirement');
    txtModifiedRequirement = document.getElementById('txtModifiedRequirement');
    txtBuyContactname=document.getElementById('txtBuyContactname');
    txtBuyEmailID=document.getElementById('txtBuyEmailID');
    txtBuyMobileno=document.getElementById('txtBuyMobileno');
    txtBuyLandlineno = document.getElementById('txtBuyLandlineno');
    txtUrl = document.getElementById('txtUrl');
    btnBuyCalculate=document.getElementById('btnBuyCalculate');
    btnBuyClear=document.getElementById('btnBuyClear');

}

function ClearBuyControls()
{
    BuyControls();

    cmbBuyPropValue.value = "0";
    txtBuyTitle.value = txtBuyTitle.title;
    txtBuyTitle.style.color = "gray";
    txtModifiedTitle.style.color = "gray";
    txtModifiedTitle.value = txtModifiedTitle.title;
    txtBuyState.value=txtBuyState.title;
    txtBuyState.style.color = "gray";
    txtBuyCity.value=txtBuyCity.title;
    txtBuyCity.style.color = "gray";
    txtBuyLocation.value=txtBuyLocation.title;
    txtBuyLocation.style.color = "gray";
    txtBuyFromAmt.value=txtBuyFromAmt.title;
    txtBuyFromAmt.style.color = "gray";
    txtBuyToAmt.value=txtBuyToAmt.title;
    txtBuyToAmt.style.color = "gray";
    txtBuyPincode.value=txtBuyPincode.title;
    txtBuyPincode.style.color = "gray";
    txtBuyRequirement.value=txtBuyRequirement.title;
    txtBuyRequirement.style.color = "gray";
    txtModifiedRequirement.value=txtModifiedRequirement.title;
    txtModifiedRequirement.style.color = "gray";
    txtBuyContactname.value=txtBuyContactname.title;
    txtBuyContactname.style.color = "gray";
    txtBuyEmailID.value=txtBuyEmailID.title;
    txtBuyEmailID.style.color = "gray";
    txtBuyMobileno.value=txtBuyMobileno.title;
    txtBuyMobileno.style.color = "gray";
    txtBuyLandlineno.value=txtBuyLandlineno.title;
    txtBuyLandlineno.style.color = "gray";
    txtUrl.value = txtUrl.title;
    txtUrl.style.color = "gray";
    EnableBuyControls(); 
    btnBuyCalculate.value = "Post";
    
    txtModifiedTitle.disabled=true;
}

function SaveBuy() 
{
    
    BuyControls();
    var IsTransClosed = "";
    
    if (btnBuyCalculate.value == "Post") {
    if(ValidateTitle(txtBuyTitle)) {
    if (BuyValidation()) {
                nocache = Math.random();
                var strProjectType = cmbBuyPropValue.value;
                var strValueOf = Getvalue(txtBuyTitle, txtBuyLandlineno, txtBuyRequirement);

                if (txtBuyTitle.value == "Enter title") {
                    txtBuyTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "Buy" + '&title=' + txtBuyTitle.value + '&proptype=' + strProjectType + '&state=' + txtBuyState.value + '&city=' + txtBuyCity.value + '&fromamount=' + txtBuyFromAmt.value + '&toamount=' + txtBuyToAmt.value + '&location=' + txtBuyLocation.value + '&pincode=' + txtBuyPincode.value + '&name=' + txtBuyContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtBuyEmailID.value + '&mobile=' + txtBuyMobileno.value + '&modifiedtitle=' + txtModifiedTitle.value + '&landline=' + strValueOf.strLandline + '&image=' + '' + '&SiteURL=' + txtUrl.value + '&TransClosed=0' + '&nocache = ' + nocache);
                http.onreadystatechange = GetReply;
                http.send(null);
            }
       }
    }
    else if (btnBuyCalculate.value == "Update") {
    
//    if(ValidateTitle(txtBuyTitle)) {
            if (BuyValidation()) {
            
                nocache = Math.random();
                if (document.getElementById('chkbuyTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }
               
                var strProjectType = cmbBuyPropValue.value;
                var strValueOf = Getvalue(txtBuyTitle, txtBuyLandlineno, txtBuyRequirement);
                
                if (txtBuyTitle.value == "Enter title") {
                    txtBuyTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "BuyUpdate" + '&Trans_Type=Buy' + '&title=' + txtBuyTitle.value + '&proptype=' + strProjectType + '&state=' + txtBuyState.value + '&city=' + txtBuyCity.value + '&fromamount=' + txtBuyFromAmt.value + '&toamount=' + txtBuyToAmt.value + '&location=' + txtBuyLocation.value + '&pincode=' + txtBuyPincode.value + '&name=' + txtBuyContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtBuyEmailID.value + '&mobile=' + txtBuyMobileno.value + '&landline=' + strValueOf.strLandline + '&modifiedtitle=' + txtModifiedTitle.value + '&SiteURL=' + txtUrl.value + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + '' + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetUpdateReply;
                http.send(null);
            }
        }
        else {
            if (BuyValidation()) {
                nocache = Math.random();
                if (document.getElementById('chkbuyTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }

                var strProjectType = cmbBuyPropValue.value;
                var strValueOf = Getvalue(txtBuyTitle, txtBuyLandlineno, txtBuyRequirement);

                if (txtBuyTitle.value == "Enter title") {
                    txtBuyTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', "controller/properties.php?Type=UpdateApproval&EncodedURL=" + strEncodedURL + '&title=' + txtBuyTitle.value + '&proptype=' + strProjectType + '&state=' + txtBuyState.value + '&city=' + txtBuyCity.value + '&fromamount=' + txtBuyFromAmt.value + '&toamount=' + txtBuyToAmt.value + '&location=' + txtBuyLocation.value + '&pincode=' + txtBuyPincode.value + '&name=' + txtBuyContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtBuyEmailID.value + '&mobile=' + txtBuyMobileno.value + '&landline=' + strValueOf.strLandline + '&modifiedtitle=' + txtModifiedTitle.value + '&SiteURL=' + txtUrl.value + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + '' + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetApprovalReply;
                http.send(null);
            }
        }
//    }
}
function BuyValidation()
{
    if (cmbBuyPropValue.value != "0")
    {
        if(txtBuyState.value!=txtBuyState.title && txtBuyState.value!="")
        {   
            if(txtBuyCity.value!=txtBuyCity.title && txtBuyCity.value!="")
            {
                if(txtBuyLocation.value!=txtBuyLocation.title && txtBuyLocation.value!="")
                {
                    if(txtBuyFromAmt.value!=txtBuyFromAmt.title)
                    {
                        if(txtBuyToAmt.value!=txtBuyToAmt.title)
                        {
                            if(eval(txtBuyFromAmt.value) < eval(txtBuyToAmt.value))
                            {
                                //if(txtBuyPincode.value!=txtBuyPincode.title && txtBuyPincode.value!="")
                                  //{
                                    if(txtBuyContactname.value!=txtBuyContactname.title && txtBuyContactname.value!="")
                                    {
                                       if(txtBuyEmailID.value!=txtBuyEmailID.title)
                                       {
                                            if(Validate(txtBuyEmailID.value))
                                            {
                                                if(txtBuyMobileno.value!=txtBuyMobileno.title)
                                                {
//                                                    if(Validate_Mobile(txtBuyMobileno.value))
//                                                    {
//                                                        return true;
//                                                    }
//                                                    else
//                                                    {
//                                                        alert("Invalid Mobile Number! \n\nEx. +919999900000");
//                                                        txtBuyMobileno.focus();
//                                                        return false;
                                                    //                                                    }
                                                    return true;
                                                }
                                                else
                                                {
                                                    alert("Mobile number cannot be blank!");
                                                    txtBuyMobileno.focus();
                                                    return false;
                                                }
                                            }
                                            else
                                            {
                                                alert("Invalid Email!");
                                                txtBuyEmailID.focus();
                                                return false;
                                            }
                                       }
                                       else
                                       {
                                            alert("Email cannot be blank!");
                                            txtBuyEmailID.focus();
                                            return false;
                                       }
                                    }
                                    else
                                    {
                                        alert("Name cannot be blank!");
                                        txtBuyContactname.focus();
                                        return false;
                                    }
                                }
//                                else
//                                {
//                                    alert("Pincode cannot be blank!");
//                                    txtBuyPincode.focus();
//                                    return false;
//                                }
//                            }
                            else
                            {
                                    alert("From amount should be less than To amount!");
                                    txtBuyFromAmt.focus();
                                    return false;
                            }
                        }
                        else
                        {
                                alert("To Amount cannot be blank!");
                                txtBuyToAmt.focus();
                                return false;
                        }
                        
                    }
                    else
                    {
                        alert("From Amount cannot be blank!");
                        txtBuyFromAmt.focus();
                        return false;
                    }
                }
                else
                {
                    alert("Location cannot be blank!");
                    txtBuyLocation.focus();
                    return false;
                }
            }
            else
            {
                alert("City cannot be blank!");
                txtBuyCity.focus();
                return false;
            }
        }
        else
        {
            alert("State cannot be blank!");
            txtBuyState.focus();
            return false;
        }
    }
    else
    {
        cmbBuyPropValue.focus();
        alert("Please select atleast one type!");
        return false;
    }
}

/* ------------------------------------------------- END OF BUY PROPERTY -------------------------------------------- */

/* ------------------------------------------------- RENT-IN PROPERTY -------------------------------------------- */


function RentInControls()
{
    cmbRentInPropValue=document.getElementById('cmbPropValue');
    txtRentInState = document.getElementById('txtRentInState');
    txtRentInTitle = document.getElementById('txtRentInTitle');
    txtModifiedTitle = document.getElementById('txtModifiedTitle');
    txtRentInCity=document.getElementById('txtRentInCity');
    txtRentInLocation=document.getElementById('txtRentInLocation');
    txtRentInFromAmt=document.getElementById('txtRentInFromAmt');
    txtRentInToAmt=document.getElementById('txtRentInToAmt');
    txtRentInPincode=document.getElementById('txtRentInPincode');
    txtRentInRequirement = document.getElementById('txtRentInRequirement');
    txtModifiedRequirement = document.getElementById('txtModifiedRequirement');
    txtRentInContactname=document.getElementById('txtRentInContactname');
    txtRentInEmailID=document.getElementById('txtRentInEmailID');
    txtRentInMobileno=document.getElementById('txtRentInMobileno');
    txtRentInLandlineno = document.getElementById('txtRentInLandlineno');
    txtUrl = document.getElementById('txtUrl');
    btnRentInCalculate = document.getElementById('btnRentInCalculate');
    btnRentInClear = document.getElementById('btnRentInClear');

}

function ClearRentInControls()
{
    RentInControls();

    cmbRentInPropValue.value = "0";
    txtRentInTitle.value = txtRentInTitle.title;
    txtRentInTitle.style.color = "gray";
    txtRentInState.value=txtRentInState.title;
    txtRentInState.style.color = "gray";
    txtRentInCity.value=txtRentInCity.title;
    txtRentInCity.style.color = "gray";
    txtModifiedTitle.style.color = "gray";
    txtModifiedTitle.value = txtModifiedTitle.title;
    txtRentInLocation.value=txtRentInLocation.title;
    txtRentInLocation.style.color = "gray";
    txtRentInFromAmt.value=txtRentInFromAmt.title;
    txtRentInFromAmt.style.color = "gray";
    txtRentInToAmt.value=txtRentInToAmt.title;
    txtRentInToAmt.style.color = "gray";
    txtRentInPincode.value=txtRentInPincode.title;
    txtRentInPincode.style.color = "gray";
    txtRentInRequirement.value=txtRentInRequirement.title;
    txtRentInRequirement.style.color = "gray";
    txtModifiedRequirement.value=txtModifiedRequirement.title;
    txtModifiedRequirement.style.color = "gray";
    txtRentInContactname.value=txtRentInContactname.title;
    txtRentInContactname.style.color = "gray";
    txtRentInEmailID.value=txtRentInEmailID.title;
    txtRentInEmailID.style.color = "gray";
    txtRentInMobileno.value=txtRentInMobileno.title;
    txtRentInMobileno.style.color = "gray";
    txtRentInLandlineno.value=txtRentInLandlineno.title;
    txtRentInLandlineno.style.color = "gray";
    txtUrl.value = txtUrl.title;
    txtUrl.style.color = "gray";
    EnableRentInControls(); 
    btnRentInCalculate.value = "Post";
    txtModifiedTitle.disabled=true;
    
}

function SaveRentIn()
{
    RentInControls();
    var IsTransClosed = "";
    if (btnRentInCalculate.value == "Post") {
    if(ValidateTitle(txtRentInTitle)) {
            if (RentInValidation()) {
                nocache = Math.random();

                var strProjectType = cmbRentInPropValue.value;
                var strValueOf = Getvalue(txtRentInTitle, txtRentInLandlineno, txtRentInRequirement);

                if (txtRentInTitle.value == "Enter title") {
                    txtRentInTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "RentIn" + '&title=' + txtRentInTitle.value + '&proptype=' + strProjectType + '&state=' + txtRentInState.value + '&city=' + txtRentInCity.value + '&fromamount=' + txtRentInFromAmt.value + '&toamount=' + txtRentInToAmt.value + '&location=' + txtRentInLocation.value + '&pincode=' + txtRentInPincode.value + '&name=' + txtRentInContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtRentInEmailID.value + '&mobile=' + txtRentInMobileno.value + '&modifiedtitle=' + txtModifiedTitle.value + '&landline=' + strValueOf.strLandline + '&SiteURL=' + txtUrl.value + '&image=' + '' + '&TransClosed=0' + '&nocache = ' + nocache);
                http.onreadystatechange = GetReply;
                http.send(null);
            }
      }

    }
    else if (btnRentInCalculate.value == "Update") {
//        if(ValidateTitle(txtRentInTitle)) {
            if (RentInValidation()) {
                nocache = Math.random();

                if (document.getElementById('chkRentInTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }

                var strProjectType = cmbRentInPropValue.value;
                var strValueOf = Getvalue(txtRentInTitle, txtRentInLandlineno, txtRentInRequirement);

                if (txtRentInTitle.value == "Enter title") {
                    txtRentInTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "RentInUpdate" + '&Trans_Type=RentIn' + '&title=' + txtRentInTitle.value + '&proptype=' + strProjectType + '&state=' + txtRentInState.value + '&city=' + txtRentInCity.value + '&fromamount=' + txtRentInFromAmt.value + '&toamount=' + txtRentInToAmt.value + '&location=' + txtRentInLocation.value + '&pincode=' + txtRentInPincode.value + '&name=' + txtRentInContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&modifiedtitle=' + txtModifiedTitle.value + '&email=' + txtRentInEmailID.value + '&mobile=' + txtRentInMobileno.value + '&landline=' + strValueOf.strLandline + '&SiteURL=' + txtUrl.value + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + '' + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetUpdateReply;
                http.send(null);
            }

        }
        else {
            if (RentInValidation()) {
                nocache = Math.random();

                if (document.getElementById('chkRentInTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }

                var strProjectType = cmbRentInPropValue.value;
                var strValueOf = Getvalue(txtRentInTitle, txtRentInLandlineno, txtRentInRequirement);

                if (txtRentInTitle.value == "Enter title") {
                    txtRentInTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', "controller/properties.php?Type=UpdateApproval&EncodedURL=" + strEncodedURL + '&title=' + txtRentInTitle.value + '&proptype=' + strProjectType + '&state=' + txtRentInState.value + '&city=' + txtRentInCity.value + '&fromamount=' + txtRentInFromAmt.value + '&toamount=' + txtRentInToAmt.value + '&location=' + txtRentInLocation.value + '&pincode=' + txtRentInPincode.value + '&name=' + txtRentInContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&modifiedtitle=' + txtModifiedTitle.value + '&email=' + txtRentInEmailID.value + '&mobile=' + txtRentInMobileno.value + '&landline=' + strValueOf.strLandline + '&SiteURL=' + txtUrl.value + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + '' + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetApprovalReply;
                http.send(null);
            }
        }
//    }
}

function RentInValidation()
{
    if (cmbRentInPropValue.value != "0")
    {
        if(txtRentInState.value!=txtRentInState.title && txtRentInState.value!="")
        {   
            if(txtRentInCity.value!=txtRentInCity.title && txtRentInCity.value!="")
            {
                if(txtRentInLocation.value!=txtRentInLocation.title && txtRentInLocation.value!="")
                {
                    if(txtRentInFromAmt.value!=txtRentInFromAmt.title)
                    {
                        if(txtRentInToAmt.value!=txtRentInToAmt.title)
                        {
                            if(eval(txtRentInFromAmt.value) < eval(txtRentInToAmt.value))
                            {
                                if(txtRentInPincode.value!=txtRentInPincode.title && txtRentInPincode.value!="")
                                  {
                                    if(txtRentInContactname.value!=txtRentInContactname.title && txtRentInContactname.value!="")
                                    {
                                       if(txtRentInEmailID.value!=txtRentInEmailID.title)
                                       {
                                            if(Validate(txtRentInEmailID.value))
                                            {
                                                if(txtRentInMobileno.value!=txtRentInMobileno.title)
                                                {
//                                                    if(Validate_Mobile(txtRentInMobileno.value))
//                                                    {
//                                                        return true;
//                                                    }
//                                                    else
//                                                    {
//                                                        alert("Invalid Mobile Number! \n\nEx. 919999900000");
//                                                        txtRentInMobileno.focus();
//                                                        return false;
//                                                    }
                                                    return true;
                                                }
                                                else
                                                {
                                                    alert("Mobile number cannot be blank!");
                                                    txtRentInMobileno.focus();
                                                    return false;
                                                }
                                            }
                                            else
                                            {
                                                alert("Invalid Email!");
                                                txtRentInEmailID.focus();
                                                return false;
                                            }
                                       }
                                       else
                                       {
                                            alert("Email cannot be blank!");
                                            txtRentInEmailID.focus();
                                            return false;
                                       }
                                    }
                                    else
                                    {
                                        alert("Name cannot be blank!");
                                        txtRentInContactname.focus();
                                        return false;
                                    }
                                }
                                else
                                {
                                    alert("Pincode cannot be blank!");
                                    txtRentInPincode.focus();
                                    return false;
                                }
                            }
                            else
                            {
                                    alert("From amount should be less than To amount!");
                                    txtRentInFromAmt.focus();
                                    return false;
                            }
                        }
                        else
                        {
                                alert("To Amount cannot be blank!");
                                txtRentInToAmt.focus();
                                return false;
                        }
                        
                    }
                    else
                    {
                        alert("From Amount cannot be blank!");
                        txtRentInFromAmt.focus();
                        return false;
                    }
                }
                else
                {
                    alert("Location cannot be blank!");
                    txtRentInLocation.focus();
                    return false;
                }
            }
            else
            {
                alert("City cannot be blank!");
                txtRentInCity.focus();
                return false;
            }
        }
        else
        {
            alert("State cannot be blank!");
            txtRentInState.focus();
            return false;
        }
    }
    else
    {
        cmbRentInPropValue.focus();
        alert("Please select atleast one type!");
        return false;
    }
}

/* ------------------------------------------------- END OF RENT-IN PROPERTY -------------------------------------------- */

/* ------------------------------------------------- RENT-OUT PROPERTY -------------------------------------------- */


function RentOutControls()
{
    cmbRentOutPropValue=document.getElementById('cmbPropValue');
    txtRentOutState = document.getElementById('txtRentOutState');
    txtRentOutTitle = document.getElementById('txtRentOutTitle');
    txtModifiedTitle = document.getElementById('txtModifiedTitle');
    txtRentOutCity=document.getElementById('txtRentOutCity');
    txtRentOutLocation=document.getElementById('txtRentOutLocation');
    txtRentAmt=document.getElementById('txtRentAmt');
    txtRentOutPincode=document.getElementById('txtRentOutPincode');
    txtRentOutRequirement=document.getElementById('txtRentOutRequirement');
    txtModifiedRequirement = document.getElementById('txtModifiedRequirement');
    txtRentOutContactname=document.getElementById('txtRentOutContactname');
    txtRentOutEmailID=document.getElementById('txtRentOutEmailID');
    txtRentOutMobileno=document.getElementById('txtRentOutMobileno');
    txtRentOutLandlineno = document.getElementById('txtRentOutLandlineno');
    txtUrl = document.getElementById('txtUrl');
    btnRentoutCalculate = document.getElementById('btnRentoutCalculate');
    btnRentOutClear = document.getElementById('btnRentoutClear');
}

function ClearRentOutControls()
{
    RentOutControls();
    cmbRentOutPropValue.value = "0";
    txtRentOutTitle.value = txtRentOutTitle.title;
    txtRentOutTitle.style.color = "gray";
    txtRentOutState.value = txtRentOutState.title;
    txtModifiedTitle.style.color = "gray";
    txtModifiedTitle.value = txtModifiedTitle.title;
    txtRentOutState.style.color = "gray";
    txtRentOutCity.value=txtRentOutCity.title;
    txtRentOutCity.style.color = "gray";
    txtRentOutLocation.value=txtRentOutLocation.title;
    txtRentOutLocation.style.color = "gray";
    txtRentAmt.value=txtRentAmt.title;
    txtRentAmt.style.color = "gray";
    txtRentOutPincode.value=txtRentOutPincode.title;
    txtRentOutPincode.style.color = "gray";
    txtRentOutRequirement.value=txtRentOutRequirement.title;
    txtRentOutRequirement.style.color = "gray";
    txtModifiedRequirement.value = txtModifiedRequirement.title;
    txtModifiedRequirement.style.color = "gray";
    txtRentOutContactname.value=txtRentOutContactname.title;
    txtRentOutContactname.style.color = "gray";
    txtRentOutEmailID.value=txtRentOutEmailID.title;
    txtRentOutEmailID.style.color = "gray";
    txtRentOutMobileno.value=txtRentOutMobileno.title;
    txtRentOutMobileno.style.color = "gray";
    txtRentOutLandlineno.value=txtRentOutLandlineno.title;
    txtRentOutLandlineno.style.color = "gray";
    txtUrl.value = txtUrl.title;
    txtUrl.style.color = "gray";

    EnableRentOutControls(); 
    btnRentoutCalculate.value = "Post";
    txtModifiedTitle.disabled=true;
}

function SaveRentOut()
{
    RentOutControls();
    var IsTransClosed = "";
    if (btnRentoutCalculate.value == "Post") {
    if(ValidateTitle(txtRentOutTitle)) {
            if (RentOutValidation()) {
                nocache = Math.random();
                
                var strUploadImgPath = document.getElementById('hdImagePath').value;
                var strProjectType = cmbRentOutPropValue.value;
                var strValueOf = Getvalue(txtRentOutTitle,txtRentOutLandlineno, txtRentOutRequirement);

                if (txtRentOutTitle.value == "Enter title") {
                    txtRentOutTitle.value = "";
                }

                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "RentOut" + '&title=' + txtRentOutTitle.value + '&proptype=' + strProjectType + '&state=' + txtRentOutState.value + '&city=' + txtRentOutCity.value + '&fromamount=' + txtRentAmt.value + '&toamount=' + txtRentAmt.value + '&location=' + txtRentOutLocation.value + '&pincode=' + txtRentOutPincode.value + '&name=' + txtRentOutContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtRentOutEmailID.value + '&mobile=' + txtRentOutMobileno.value + '&landline=' + strValueOf.strLandline + '&modifiedtitle=' + txtModifiedTitle.value + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&TransClosed=0' + '&nocache = ' + nocache);
                http.onreadystatechange = GetReply;
                http.send(null);
            }
        }
    }
    else if (btnRentoutCalculate.value == "Update") {
//    if(ValidateTitle(txtRentOutTitle)) {
            if (RentOutValidation()) {
                nocache = Math.random();

                if (document.getElementById('chkRentOutTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }
                
                var strUploadImgPath = document.getElementById('hdImagePath').value;
                var strProjectType = cmbRentOutPropValue.value;
                var strValueOf = Getvalue(txtRentOutTitle, txtRentOutLandlineno, txtRentOutRequirement);

                if (txtRentOutTitle.value == "Enter title") {
                    txtRentOutTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "RentOutUpdate" + '&Trans_Type=RentOut' + '&title=' + txtRentOutTitle.value + '&proptype=' + strProjectType + '&state=' + txtRentOutState.value + '&city=' + txtRentOutCity.value + '&fromamount=' + txtRentAmt.value + '&toamount=' + txtRentAmt.value + '&location=' + txtRentOutLocation.value + '&pincode=' + txtRentOutPincode.value + '&name=' + txtRentOutContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtRentOutEmailID.value + '&mobile=' +  txtRentOutMobileno.value + '&modifiedtitle=' + txtModifiedTitle.value + '&landline=' + strValueOf.strLandline + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&PropID=' + document.getElementById('hdPropID').value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetUpdateReply;
                http.send(null);
            }
        }
        else {
            if (RentOutValidation()) {
                nocache = Math.random();

                if (document.getElementById('chkRentOutTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }

                var strUploadImgPath = document.getElementById('hdImagePath').value;
                var strProjectType = cmbRentOutPropValue.value;
                var strValueOf = Getvalue(txtRentOutTitle, txtRentOutLandlineno, txtRentOutRequirement);

                if (txtRentOutTitle.value == "Enter title") {
                    txtRentOutTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', "controller/properties.php?Type=UpdateApproval&EncodedURL=" + strEncodedURL + '&Trans_Type=RentOut' + '&title=' + txtRentOutTitle.value + '&proptype=' + strProjectType + '&state=' + txtRentOutState.value + '&city=' + txtRentOutCity.value + '&fromamount=' + txtRentAmt.value + '&toamount=' + txtRentAmt.value + '&location=' + txtRentOutLocation.value + '&pincode=' + txtRentOutPincode.value + '&name=' + txtRentOutContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtRentOutEmailID.value + '&mobile=' + txtRentOutMobileno.value + '&modifiedtitle=' + txtModifiedTitle.value + '&landline=' + strValueOf.strLandline + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&PropID=' + document.getElementById('hdPropID').value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetApprovalReply;
                http.send(null);
            }
        }
   //}
    
}

function RentOutValidation()
{
    if (cmbRentOutPropValue.value != "0")
    {
        if(txtRentOutState.value!=txtRentOutState.title && txtRentOutState.value!="")
        {   
            if(txtRentOutCity.value!=txtRentOutCity.title && txtRentOutCity.value!="")
            {
                if(txtRentOutLocation.value!=txtRentOutLocation.title && txtRentOutLocation.value!="")
                {
                    if(txtRentAmt.value!=txtRentAmt.title && txtRentAmt.value!='')
                    {
                      //if(txtRentOutPincode.value!=txtRentOutPincode.title && txtRentOutPincode.value!="")
                      //{
                            if(txtRentOutContactname.value!=txtRentOutContactname.title && txtRentOutContactname.value!="")
                            {
                               if(txtRentOutEmailID.value!=txtRentOutEmailID.title)
                               {
                                    if(Validate(txtRentOutEmailID.value))
                                    {
                                        if(txtRentOutMobileno.value!=txtRentOutMobileno.title)
                                        {
//                                            if(Validate_Mobile(txtRentOutMobileno.value))
//                                            {
//                                                return true;
//                                            }
//                                            else
//                                            {
//                                                alert("Invalid Mobile Number! \n\nEx. +919999900000");
//                                                txtRentOutMobileno.focus();
//                                                return false;
//                                            }
                                            return true;
                                        }
                                        else
                                        {
                                            alert("Mobile number cannot be blank!");
                                            txtRentOutMobileno.focus();
                                            return false;
                                        }
                                    }
                                    else
                                    {
                                        alert("Invalid Email!");
                                        txtRentOutEmailID.focus();
                                        return false;
                                    }
                               }
                               else
                               {
                                    alert("Email cannot be blank!");
                                    txtRentOutEmailID.focus();
                                    return false;
                               }
                            }
                            else
                            {
                                alert("Name cannot be blank!");
                                txtRentOutContactname.focus();
                                return false;
                            }
                        }
//                        else
//                        {
//                            alert("Pincode cannot be blank!");
//                            txtRentOutPincode.focus();
//                            return false;
//                        }
//                    }
                    else
                    {
                        alert("Amount cannot be blank!");
                        txtRentAmt.focus();
                        return false;
                    }
                }
                else
                {
                    alert("Location cannot be blank!");
                    txtRentOutLocation.focus();
                    return false;
                }
            }
            else
            {
                alert("City cannot be blank!");
                txtRentOutCity.focus();
                return false;
            }
        }
        else
        {
            alert("State cannot be blank!");
            txtRentOutState.focus();
            return false;
        }
    }
    else
    {
        cmbRentOutPropValue.focus();
        alert("Please select atleast one type!");
        return false;
    }
}
/* -------------------------------------------------END OF RENT-OUT PROPERTY -------------------------------------------- */

/* ------------------------------------------------- LEASE-IN PROPERTY -------------------------------------------- */


function LeaseInControls()
{
    cmbLeaseInPropValue=document.getElementById('cmbPropValue');
    txtLeaseInState = document.getElementById('txtLeaseInState');
    txtLeaseInTitle = document.getElementById('txtLeaseInTitle');
    txtModifiedTitle = document.getElementById('txtModifiedTitle');
    txtLeaseInCity=document.getElementById('txtLeaseInCity');
    txtLeaseInLocation=document.getElementById('txtLeaseInLocation');
    txtLeaseInFromAmt=document.getElementById('txtLeaseInFromAmt');
    txtLeaseInToAmt=document.getElementById('txtLeaseInToAmt');
    txtLeaseInPincode=document.getElementById('txtLeaseInPincode');
    txtLeaseInRequirement=document.getElementById('txtLeaseInRequirement');
    txtModifiedRequirement = document.getElementById('txtModifiedRequirement');
    txtLeaseInContactname=document.getElementById('txtLeaseInContactname');
    txtLeaseInEmailID=document.getElementById('txtLeaseInEmailID');
    txtLeaseInMobileno=document.getElementById('txtLeaseInMobileno');
    txtLeaseInLandlineno = document.getElementById('txtLeaseInLandlineno');
    txtUrl = document.getElementById('txtUrl');
    btnLeaseInCalculate=document.getElementById('btnLeaseInCalculate');
    btnLeaseInClear=document.getElementById('btnLeaseInClear');

}

function ClearLeaseInControls() {
    LeaseInControls();
    cmbLeaseInPropValue.value = "0";
    txtLeaseInTitle.value = txtLeaseInTitle.title;
    txtLeaseInTitle.style.color = "gray";
    txtLeaseInState.value = txtLeaseInState.title;
    txtModifiedTitle.style.color = "gray";
    txtModifiedTitle.value = txtModifiedTitle.title;
    txtLeaseInState.style.color = "gray";
    txtLeaseInCity.value=txtLeaseInCity.title;
    txtLeaseInCity.style.color = "gray";
    txtLeaseInLocation.value=txtLeaseInLocation.title;
    txtLeaseInLocation.style.color = "gray";
    txtLeaseInFromAmt.value=txtLeaseInFromAmt.title;
    txtLeaseInFromAmt.style.color = "gray";
    txtLeaseInToAmt.value=txtLeaseInToAmt.title;
    txtLeaseInToAmt.style.color = "gray";
    txtLeaseInPincode.value=txtLeaseInPincode.title;
    txtLeaseInPincode.style.color = "gray";
    txtLeaseInRequirement.value=txtLeaseInRequirement.title;
    txtLeaseInRequirement.style.color = "gray";
    txtModifiedRequirement.value=txtModifiedRequirement.title;
    txtModifiedRequirement.style.color = "gray";
    txtLeaseInContactname.value=txtLeaseInContactname.title;
    txtLeaseInContactname.style.color = "gray";
    txtLeaseInEmailID.value=txtLeaseInEmailID.title;
    txtLeaseInEmailID.style.color = "gray";
    txtLeaseInMobileno.value=txtLeaseInMobileno.title;
    txtLeaseInMobileno.style.color = "gray";
    txtLeaseInLandlineno.value=txtLeaseInLandlineno.title;
    txtLeaseInLandlineno.style.color = "gray";
    txtUrl.value = txtUrl.title;
    txtUrl.style.color = "gray";
    EnableLeasInControls(); 
    txtModifiedTitle.disabled=true;
    btnLeaseInCalculate.value = "Post";
}

function SaveLeaseIn()
{
    LeaseInControls();
    var IsTransClosed = "";
    if (btnLeaseInCalculate.value == "Post") {
    if(ValidateTitle(txtLeaseInTitle)) {
            if (LeaseInValidation()) {
                nocache = Math.random();

                var strProjectType = cmbLeaseInPropValue.value;
                var strValueOf = Getvalue(txtLeaseInTitle,txtLeaseInLandlineno, txtLeaseInRequirement);

                if (txtLeaseInTitle.value == "Enter title") {
                    txtLeaseInTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', 'controller/properties.php?Type=' + "LeaseIn" + '&title=' + txtLeaseInTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&proptype=' + strProjectType + '&state=' + txtLeaseInState.value + '&city=' + txtLeaseInCity.value + '&fromamount=' + txtLeaseInFromAmt.value + '&toamount=' + txtLeaseInToAmt.value + '&location=' + txtLeaseInLocation.value + '&pincode=' + txtLeaseInPincode.value + '&name=' + txtLeaseInContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtLeaseInEmailID.value + '&mobile=' + txtLeaseInMobileno.value + '&landline=' + strValueOf.strLandline + '&PropID=' + document.getElementById('hdPropID').value + '&modifiedtitle=' + txtModifiedTitle.value + '&image=' + '' + '&SiteURL=' + txtUrl.value + '&TransClosed=0' + '&nocache = ' + nocache);
                http.onreadystatechange = GetReply;
                http.send(null);
            }
        }
    }
    else if (btnLeaseInCalculate.value == "Update") {
//    if(ValidateTitle(txtLeaseInTitle)) {
            if (LeaseInValidation()) {
                nocache = Math.random();


                if (document.getElementById('chkLeaseInTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }

                var strProjectType = cmbLeaseInPropValue.value;
                var strValueOf = Getvalue(txtLeaseInTitle, txtLeaseInLandlineno, txtLeaseInRequirement);

                if (txtLeaseInTitle.value == "Enter title") {
                    txtLeaseInTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }

                http.open('get', 'controller/properties.php?Type=' + "LeaseInUpdate" + '&Trans_Type=LeaseIn' + '&title=' + txtLeaseInTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&proptype=' + strProjectType + '&state=' + txtLeaseInState.value + '&city=' + txtLeaseInCity.value + '&fromamount=' + txtLeaseInFromAmt.value + '&toamount=' + txtLeaseInToAmt.value + '&location=' + txtLeaseInLocation.value + '&pincode=' + txtLeaseInPincode.value + '&name=' + txtLeaseInContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtLeaseInEmailID.value + '&mobile=' + txtLeaseInMobileno.value + '&landline=' + strValueOf.strLandline + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + '' + '&SiteURL=' + txtUrl.value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetUpdateReply;
                http.send(null);
            }
        }
        else {
            if (LeaseInValidation()) {
                nocache = Math.random();


                if (document.getElementById('chkLeaseInTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }

                var strProjectType = cmbLeaseInPropValue.value;
                var strValueOf = Getvalue(txtLeaseInTitle, txtLeaseInLandlineno, txtLeaseInRequirement);

                if (txtLeaseInTitle.value == "Enter title") {
                    txtLeaseInTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                http.open('get', "controller/properties.php?Type=UpdateApproval&EncodedURL=" + strEncodedURL + '&title=' + txtLeaseInTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&proptype=' + strProjectType + '&state=' + txtLeaseInState.value + '&city=' + txtLeaseInCity.value + '&fromamount=' + txtLeaseInFromAmt.value + '&toamount=' + txtLeaseInToAmt.value + '&location=' + txtLeaseInLocation.value + '&pincode=' + txtLeaseInPincode.value + '&name=' + txtLeaseInContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtLeaseInEmailID.value + '&mobile=' + txtLeaseInMobileno.value + '&landline=' + strValueOf.strLandline + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + '' + '&SiteURL=' + txtUrl.value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetApprovalReply;
                http.send(null);
            }
        }
//    }
}

function LeaseInValidation()
{
    if (cmbLeaseInPropValue.value != "0")
    {
        if(txtLeaseInState.value!=txtLeaseInState.title && txtLeaseInState.value!="")
        {   
            if(txtLeaseInCity.value!=txtLeaseInCity.title && txtLeaseInCity.value!="")
            {
                if(txtLeaseInLocation.value!=txtLeaseInLocation.title && txtLeaseInLocation.value!="")
                {
                    if(txtLeaseInFromAmt.value!=txtLeaseInFromAmt.title)
                    {
                        if(txtLeaseInToAmt.value!=txtLeaseInToAmt.title)
                        {
                            if(eval(txtLeaseInFromAmt.value) < eval(txtLeaseInToAmt.value))
                            {
//                                if(txtLeaseInPincode.value!=txtLeaseInPincode.title && txtLeaseInPincode.value!="")
//                                  {
                                    if(txtLeaseInContactname.value!=txtLeaseInContactname.title && txtLeaseInContactname.value!="")
                                    {
                                       if(txtLeaseInEmailID.value!=txtLeaseInEmailID.title)
                                       {
                                            if(Validate(txtLeaseInEmailID.value))
                                            {
                                                if(txtLeaseInMobileno.value!=txtLeaseInMobileno.title)
                                                {
//                                                    if(Validate_Mobile(txtLeaseInMobileno.value))
//                                                    {
//                                                        return true;
//                                                    }
//                                                    else
//                                                    {
//                                                        alert("Invalid Mobile Number! \n\nEx. +919999900000");
//                                                        txtLeaseInMobileno.focus();
//                                                        return false;
//                                                    }
                                                    return true;
                                                }
                                                else
                                                {
                                                    alert("Mobile number cannot be blank!");
                                                    txtLeaseInMobileno.focus();
                                                    return false;
                                                }
                                            }
                                            else
                                            {
                                                alert("Invalid Email!");
                                                txtLeaseInEmailID.focus();
                                                return false;
                                            }
                                       }
                                       else
                                       {
                                            alert("Email cannot be blank!");
                                            txtLeaseInEmailID.focus();
                                            return false;
                                       }
                                    }
                                    else
                                    {
                                        alert("Name cannot be blank!");
                                        txtLeaseInContactname.focus();
                                        return false;
                                    }
                                }
//                                else
//                                {
//                                    alert("Pincode cannot be blank!");
//                                    txtLeaseInPincode.focus();
//                                    return false;
//                                }
//                            }
                            else
                            {
                                    alert("From amount should be less than To amount!");
                                    txtLeaseInFromAmt.focus();
                                    return false;
                            }
                        }
                        else
                        {
                                alert("To Amount cannot be blank!");
                                txtLeaseInToAmt.focus();
                                return false;
                        }
                        
                    }
                    else
                    {
                        alert("From Amount cannot be blank!");
                        txtLeaseInFromAmt.focus();
                        return false;
                    }
                }
                else
                {
                    alert("Location cannot be blank!");
                    txtLeaseInLocation.focus();
                    return false;
                }
            }
            else
            {
                alert("City cannot be blank!");
                txtLeaseInCity.focus();
                return false;
            }
        }
        else
        {
            alert("State cannot be blank!");
            txtLeaseInState.focus();
            return false;
        }
    }
    else
    {
        cmbLeaseInPropValue.focus();
        alert("Please select atleast one type!");
        return false;
    }
}

/* -------------------------------------------------END OF LEASE-IN PROPERTY -------------------------------------------- */

/* -------------------------------------------------LEASE-OUT PROPERTY -------------------------------------------- */

function LeaseOutControls()
{
    cmbLeaseOutPropValue = document.getElementById('cmbPropValue');
    txtLeaseOutTitle = document.getElementById('txtLeaseOutTitle');
    txtModifiedTitle = document.getElementById('txtModifiedTitle');
    txtLeaseOutState=document.getElementById('txtLeaseOutState');
    txtLeaseOutCity=document.getElementById('txtLeaseOutCity');
    txtLeaseOutLocation=document.getElementById('txtLeaseOutLocation');
    txtRentAmt=document.getElementById('txtRentAmt');
    txtLeaseOutPincode=document.getElementById('txtLeaseOutPincode');
    txtLeaseOutRequirement=document.getElementById('txtLeaseOutRequirement');
    txtModifiedRequirement = document.getElementById('txtModifiedRequirement');
    txtLeaseOutContactname=document.getElementById('txtLeaseOutContactname');
    txtLeaseOutEmailID=document.getElementById('txtLeaseOutEmailID');
    txtLeaseOutMobileno=document.getElementById('txtLeaseOutMobileno');
    txtLeaseOutLandlineno = document.getElementById('txtLeaseOutLandlineno');
    txtUrl = document.getElementById('txtUrl');
    btnLeaseOutCalculate = document.getElementById('btnLeaseOutCalculate');
    btnLeaseOutClear = document.getElementById('btnLeaseOutClear');
}

function ClearLeaseOutControls() {
    LeaseOutControls();
    cmbLeaseOutPropValue.value = "0";
    txtLeaseOutTitle.value = txtLeaseOutTitle.title;
    txtLeaseOutTitle.style.color = "gray";
    txtModifiedTitle.style.color = "gray";
    txtModifiedTitle.value = txtModifiedTitle.title;
    txtLeaseOutState.value=txtLeaseOutState.title;
    txtLeaseOutState.style.color = "gray";
    txtLeaseOutCity.value=txtLeaseOutCity.title;
    txtLeaseOutCity.style.color = "gray";
    txtLeaseOutLocation.value=txtLeaseOutLocation.title;
    txtLeaseOutLocation.style.color = "gray";
    txtRentAmt.value=txtRentAmt.title;
    txtRentAmt.style.color = "gray";
    txtLeaseOutPincode.value=txtLeaseOutPincode.title;
    txtLeaseOutPincode.style.color = "gray";
    txtLeaseOutRequirement.value=txtLeaseOutRequirement.title;
    txtLeaseOutRequirement.style.color = "gray";
    txtModifiedRequirement.value=txtModifiedRequirement.title;
    txtModifiedRequirement.style.color = "gray";
    txtLeaseOutContactname.value=txtLeaseOutContactname.title;
    txtLeaseOutContactname.style.color = "gray";
    txtLeaseOutEmailID.value=txtLeaseOutEmailID.title;
    txtLeaseOutEmailID.style.color = "gray";
    txtLeaseOutMobileno.value=txtLeaseOutMobileno.title;
    txtLeaseOutMobileno.style.color = "gray";
    txtLeaseOutLandlineno.value=txtLeaseOutLandlineno.title;
    txtLeaseOutLandlineno.style.color = "gray";
    txtUrl.value = txtUrl.title;
    txtUrl.style.color = "gray";
    btnLeaseOutCalculate.value = "Post";
    EnableLeaseOutControls(); 
    txtModifiedTitle.disabled=true;
}
function SaveLeaseOut()
{
    LeaseOutControls();
    var IsTransClosed = "";
    if (btnLeaseOutCalculate.value == "Post") {
    if(ValidateTitle(txtLeaseOutTitle)) {
            if (LeaseOutValidation()) {
                nocache = Math.random();

                var strProjectType = cmbLeaseOutPropValue.value;
                var strValueOf = Getvalue(txtLeaseOutTitle, txtLeaseOutLandlineno, txtLeaseOutRequirement);

                if (txtLeaseOutTitle.value == "Enter title") {
                    txtLeaseOutTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                var strUploadImgPath = document.getElementById('hdImagePath').value;

                http.open('get', 'controller/properties.php?Type=' + "LeaseOut" + '&title=' + txtLeaseOutTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&proptype=' + strProjectType + '&state=' + txtLeaseOutState.value + '&city=' + txtLeaseOutCity.value + '&fromamount=' + txtRentAmt.value + '&toamount=' + txtRentAmt.value + '&location=' + txtLeaseOutLocation.value + '&pincode=' + txtLeaseOutPincode.value + '&name=' + txtLeaseOutContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtLeaseOutEmailID.value + '&mobile=' + txtLeaseOutMobileno.value + '&modifiedtitle=' + txtModifiedTitle.value + '&landline=' + strValueOf.strLandline + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&TransClosed=0' + '&nocache = ' + nocache);
                http.onreadystatechange = GetReply;
                http.send(null);
            }
        }
    }
    else if (btnLeaseOutCalculate.value == "Update") {
//    if(ValidateTitle(txtLeaseOutTitle)) {
            if (LeaseOutValidation()) {
                nocache = Math.random();

                if (document.getElementById('chkLeaseOutTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }
                var strProjectType = cmbLeaseOutPropValue.value;
                var strValueOf = Getvalue(txtLeaseOutTitle, txtLeaseOutLandlineno, txtLeaseOutRequirement);

                if (txtLeaseOutTitle.value == "Enter title") {
                    txtLeaseOutTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                var strUploadImgPath = document.getElementById('hdImagePath').value;

                http.open('get', 'controller/properties.php?Type=' + "LeaseOutUpdate" + '&Trans_Type=LeaseOut' + '&title=' + txtLeaseOutTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&proptype=' + strProjectType + '&state=' + txtLeaseOutState.value + '&city=' + txtLeaseOutCity.value + '&fromamount=' + txtRentAmt.value + '&toamount=' + txtRentAmt.value + '&location=' + txtLeaseOutLocation.value + '&pincode=' + txtLeaseOutPincode.value + '&name=' + txtLeaseOutContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtLeaseOutEmailID.value + '&mobile=' + txtLeaseOutMobileno.value + '&landline=' + strValueOf.strLandline + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetUpdateReply;
                http.send(null);
            }
        }
        else {
            if (LeaseOutValidation()) {
                nocache = Math.random();

                if (document.getElementById('chkLeaseOutTransactionClosed').checked == true) {
                    IsTransClosed = 1;
                }
                else {
                    IsTransClosed = 0;
                }
                var strProjectType = cmbLeaseOutPropValue.value;
                var strValueOf = Getvalue(txtLeaseOutTitle, txtLeaseOutLandlineno, txtLeaseOutRequirement);

                if (txtLeaseOutTitle.value == "Enter title") {
                    txtLeaseOutTitle.value = "";
                }
                if (txtUrl.value == "Enter Site URL") {
                    txtUrl.value = "";
                }
                var strUploadImgPath = document.getElementById('hdImagePath').value;
                http.open('get', "controller/properties.php?Type=UpdateApproval&EncodedURL=" + strEncodedURL + '&title=' + txtLeaseOutTitle.value + '&modifiedtitle=' + txtModifiedTitle.value + '&proptype=' + strProjectType + '&state=' + txtLeaseOutState.value + '&city=' + txtLeaseOutCity.value + '&fromamount=' + txtRentAmt.value + '&toamount=' + txtRentAmt.value + '&location=' + txtLeaseOutLocation.value + '&pincode=' + txtLeaseOutPincode.value + '&name=' + txtLeaseOutContactname.value + '&req=' + strValueOf.strRequirement + '&modreq=' + txtModifiedRequirement.value + '&email=' + txtLeaseOutEmailID.value + '&mobile=' + txtLeaseOutMobileno.value + '&landline=' + strValueOf.strLandline + '&PropID=' + document.getElementById('hdPropID').value + '&image=' + strUploadImgPath + '&SiteURL=' + txtUrl.value + '&TransClosed=' + IsTransClosed + '&nocache = ' + nocache);
                http.onreadystatechange = GetApprovalReply;
                http.send(null);
            }
        }
//    }
}

function LeaseOutValidation()
{
    if (cmbLeaseOutPropValue.value != "0")
    {
        if(txtLeaseOutState.value!=txtLeaseOutState.title && txtLeaseOutState.value!="")
        {   
            if(txtLeaseOutCity.value!=txtLeaseOutCity.title && txtLeaseOutCity.value!="")
            {
                if(txtLeaseOutLocation.value!=txtLeaseOutLocation.title && txtLeaseOutLocation.value!="")
                {
                    if(txtRentAmt.value!=txtRentAmt.title && txtRentAmt.value!='')
                    {
//                      if(txtLeaseOutPincode.value!=txtLeaseOutPincode.title && txtLeaseOutPincode.value!="")
//                      {
                            if(txtLeaseOutContactname.value!=txtLeaseOutContactname.title && txtLeaseOutContactname.value!="")
                            {
                               if(txtLeaseOutEmailID.value!=txtLeaseOutEmailID.title)
                               {
                                    if(Validate(txtLeaseOutEmailID.value))
                                    {
                                        if(txtLeaseOutMobileno.value!=txtLeaseOutMobileno.title)
                                        {
//                                            if(Validate_Mobile(txtLeaseOutMobileno.value))
//                                            {
//                                                return true;
//                                            }
//                                            else
//                                            {
//                                                alert("Invalid Mobile Number! \n\nEx. +919999900000");
//                                                txtLeaseOutMobileno.focus();
//                                                return false;
                                            //                                            }
                                            return true;
                                        }
                                        else
                                        {
                                            alert("Mobile number cannot be blank!");
                                            txtLeaseOutMobileno.focus();
                                            return false;
                                        }
                                    }
                                    else
                                    {
                                        alert("Invalid Email!");
                                        txtLeaseOutEmailID.focus();
                                        return false;
                                    }
                               }
                               else
                               {
                                    alert("Email cannot be blank!");
                                    txtLeaseOutEmailID.focus();
                                    return false;
                               }
                            }
                            else
                            {
                                alert("Name cannot be blank!");
                                txtLeaseOutContactname.focus();
                                return false;
                            }
                        }
//                        else
//                        {
//                            alert("Pincode cannot be blank!");
//                            txtLeaseOutPincode.focus();
//                            return false;
//                        }
//                    }
                    else
                    {
                        alert("Amount cannot be blank!");
                        txtRentAmt.focus();
                        return false;
                    }
                }
                else
                {
                    alert("Location cannot be blank!");
                    txtLeaseOutLocation.focus();
                    return false;
                }
            }
            else
            {
                alert("City cannot be blank!");
                txtLeaseOutCity.focus();
                return false;
            }
        }
        else
        {
            alert("State cannot be blank!");
            txtLeaseOutState.focus();
            return false;
        }
    }
    else
    {
        cmbLeaseOutPropValue.focus();
        alert("Please select atleast one type!");
        return false;
    }
}
/* -------------------------------------------------END OF LEASE-OUT PROPERTY -------------------------------------------- */
function Getvalue(txtTitle,txtLandline,txtReq)
{
    var strTitle="";
    var strLandline="";
    var strRequirement="";
    
    if(txtTitle.value==txtTitle.title)
        strTitle="";
    else
        strTitle=txtTitle.value;
        
    if(txtLandline.value==txtLandline.title)
        strLandline="";
    else
        strLandline=txtLandline.value;

    if(txtReq.value==txtReq.title)
        strRequirement="";
    else
        strRequirement=txtReq.value

    return {strTitle:strTitle,strLandline:strLandline,strRequirement:strRequirement};
}


function SaveModifiedTitle() {
    var ModifiedTitle = document.getElementById(arguments[0]);
    var NormalTitle = document.getElementById(arguments[1]);
    ModifiedTitle.value = NormalTitle.value  
}


function SaveModifiedRequirement() {
    var ModifiedTitle = document.getElementById(arguments[0]);
    var NormalTitle = document.getElementById(arguments[1]);
    ModifiedTitle.value = NormalTitle.value
}

function EnableSaveButton(strControlName)
{
    document.getElementById(strControlName).disabled=false;
}
