﻿
function ValidatePropertyInfo()
{
    var Title=document.getElementById("txtTitle");
    var Types=document.getElementById("cmbTypes");
    var PriceFrom=document.getElementById("txtPriceFrom");
    
    var PriceTo=document.getElementById("txtPriceTo");
    var Phone=document.getElementById("txtPhone");
    var Email=document.getElementById("txtEmail");
    
    if(Title.value=="")
    {
        alert("Title can not be blank");
        Title.focus();
        return false;
    }
    
    if(Types.value=="0")
    {
        alert("Select a property type");
        return false;
    }
    
    if(PriceFrom.value=="")
    {
        alert("Minimum price can not be blank");
        Price.focus();
        return false;
    }
    else
    {
        if(isNaN(PriceFrom.value))
        {
            alert("Enter numbers only");
            PriceFrom.value="";
            PriceFrom.focus();
            return false;
        }
    }
    
    if(PriceTo.value=="")
    {
        alert("Maximum price can not be blank");
        PriceTo.focus();
        return false;
    }
    else
    {
        if(isNaN(PriceTo.value))
        {
            alert("Enter numbers only");
            PriceTo.value="";
            PriceTo.focus();
            return false;
        }
    }
    
    if(PriceFrom.value != "" && PriceTo.value != "")
    {
        if(isNaN(PriceFrom.value) && isNaN(PriceTo.value))
        {}
        else
        {
            if(PriceTo.value < PriceFrom.value)
            {
                alert("Maximum amount must be greater than or equal to minimum amount");
                PriceTo.value="";
                PriceTo.focus();
                return false;
            }
        }
    }
    if(Phone.value=="")
    {
        alert("Phone can not be blank");
        Phone.focus();
        return false;
    }
    
    if(Email.value=="")
    {
        alert("Email can not be blank");
        Email.focus();
        return false;
    }
}
function showImagePropertiesForSale(comp)
{
    alert(comp.id);
}
function showImage(comp)
{

    window.open("ShowImage.aspx?1=" + comp.id,"Image","width=450,height=400,toolbar=0,location=1,status=0,menubar=0,scrollbars=1");
    Image.moveto(100,200);
    
    //window.open("ShowImage.aspx?1=" + comp.id,"Image","height=550px,width=640px,toolbar=yes, menubar=yes, scrollbars=yes");
}

function showImageGallary(comp)
{
    //alert(comp.id);
    window.open("ShowImage.aspx?2=" + comp.id,"Image","height=550,width=640, toolbar=yes, menubar=yes, scrollbars=yes");
}

function showFloorLayout(comp)
{
    //alert(comp.id);
    window.open("ShowImage.aspx?3=" + comp.id,"Image","height=550,width=640, toolbar=yes, menubar=yes, scrollbars=yes");
}
function resetWindow()
{
    
}

function ValidatePropertyInquiry()
{
        
        var Area = document.getElementById("cmbArea");
        var Type=document.getElementById("cmdType");
        var minAmt=document.getElementById("txtPriceMin");
        var maxAmt=document.getElementById("txtPriceMax");
        var des=document.getElementById("txtDescription");
        
        if(Area.value==0)
        {
            alert("Select an area");
            return false
        }
        
        if(Type.value==0)
        {
            alert("Select a property type");
            return false
        }
        
        if(minAmt.value=="")
        {
            alert("Minimum amount can not be blank");
            return false
        }
        if(maxAmt.value=="")
        {
            alert("Max amount can not be blank");
            return false
        }
        if(des.value=="")
        {
            alert("Description can not be blank");
            return false
        }
}
