﻿// JScript File
function ActiveTab(id)
{
    document.getElementById("divMP"+id+"L").className="InnerTabOnL";
    document.getElementById("divMP"+id+"M").className="InnerTabOnM";
    document.getElementById("divMP"+id+"R").className="InnerTabOnR";
}
function DeactiveTab(id)
{
    document.getElementById("divMP"+id+"L").className="InnerTabL";
    document.getElementById("divMP"+id+"M").className="InnerTabM";
    document.getElementById("divMP"+id+"R").className="InnerTabR";
}
function PPShowSelected()
{
    var HiddenWant=document.getElementById("ctl00_ContentPlaceHolder1_HiddenWant");
    var HiddenSrNo=document.getElementById("ctl00_ContentPlaceHolder1_HiddenSrNo");
    
    var rdoSell = document.getElementById("ctl00_ContentPlaceHolder1_rdoSell");
    var rdoRent = document.getElementById("ctl00_ContentPlaceHolder1_rdoRent");
    var rdoCopLease = document.getElementById("ctl00_ContentPlaceHolder1_rdoCopLease");
    var rdoPG = document.getElementById("ctl00_ContentPlaceHolder1_rdoPG");
    
    
    if(HiddenSrNo.value!="0")
    {
        if(HiddenWant.value=="Sell")
        {
            PPGetBudgetRange(rdoSell);
        }
        else if(HiddenWant.value=="Rent")
        {
            PPGetBudgetRange(rdoRent);
        }
        else if(HiddenWant.value=="CopLease")
        {
            PPGetBudgetRange(rdoCopLease);
        }
        else if(HiddenWant.value=="PG")
        {
            PPGetBudgetRange(rdoPG);
        }
        
    }
    
}
function PPGetPropertyType(Ele)
{
    PPLoadPropertyType(Ele.value);
    var trRes1 = document.getElementById("ctl00_ContentPlaceHolder1_trRes1");
    var trRes2 = document.getElementById("ctl00_ContentPlaceHolder1_trRes2");
    if(trRes1 && trRes2 && Ele.value=="1")
    {
        trRes1.style.display="";
        trRes2.style.display="";
    }
    else if(trRes1 && trRes2 && Ele.value=="2")
    {
        trRes1.style.display="none";
        trRes2.style.display="none";
    }
}
function PPShowPropertyType(Ele)
{
    var chkResiType = document.getElementById("ctl00_ContentPlaceHolder1_chkResiType");
    var chkCommType = document.getElementById("ctl00_ContentPlaceHolder1_chkCommType");
    
    if(Ele.value=="1")
    {
        chkResiType.style.display="";
        chkCommType.style.display="none";
    }
    else if(Ele.value=="2")
    {
        chkResiType.style.display="none";
        chkCommType.style.display="";
    }
    else
    {
        chkResiType.style.display="none";
        chkCommType.style.display="none";
    }
    
}
function PPGetCityMaster(Ele)
{
    if(Ele.value!="")
        PPLoadCityMaster(Ele.value);
    else
    {
        var EleCity;
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlCity"))
            EleCity=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
        else if(document.getElementById("ddlCity"))
            EleCity=document.getElementById("ddlCity");
        EleCity.length=0;
        ListUtil.add(EleCity, "", "Select City");       
    }        
}
function PPGetLocationMaster(Ele)
{
    var EleState;
    var EleLocation;
    var txtCity=document.getElementById("ctl00_ContentPlaceHolder1_txtCity");
    var txtLocation=document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");
    if(document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation"))
        EleLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation");
    else if(document.getElementById("ddlLocation"))
        EleLocation=document.getElementById("ddlLocation");
        
    EleLocation.style.display="";
    txtCity.style.display="none";
    txtLocation.style.display="none";    
        
    if(Ele.value!="" && Ele.value!="-1")
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlState"))
            EleState=document.getElementById("ctl00_ContentPlaceHolder1_ddlState");
        else if(document.getElementById("ddlState"))
            EleState=document.getElementById("ddlState");
        PPLoadLocationMaster(EleState.value, Ele.value);
    }
    else if(Ele.value=="")
    {
        EleLocation.length=0;
        ListUtil.add(EleLocation, "", "Select Location");
    }
    else if(Ele.value=="-1")
    {
        EleLocation.style.display="none";
        txtCity.style.display="";
        txtLocation.style.display="";
    }
}
function PPCheckLocation(Ele)
{
    var txtLocation=document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");
    if(Ele.value!="-1")
        txtLocation.style.display="none";
    else if(Ele.value=="-1")
        txtLocation.style.display="";        
}
function PPGetBudgetRange(Ele)
{
    var id = Ele.id;
    var txtPrice;
    var val="";
    if(id.indexOf("Sell")!=-1)
    {
        txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtPrice");
        if(txtPrice.value.indexOf("Enter")==-1)
            val=CheckRange("1",txtPrice.value);
        else
            val="";            
        ShowPG("none");
        ShowSellRent("Sell","Rent");
        PPLoadBudgetRange(document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice"),"1",val);
        
    }   
    else if(id.indexOf("Rent")!=-1)
    {
        txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtRent");
        if(txtPrice.value.indexOf("Enter")==-1)
            val=CheckRange("2",txtPrice.value);
        else
            val="";            
        ShowPG("none");
        ShowSellRent("Rent","Sell");
        PPLoadBudgetRange(document.getElementById("ctl00_ContentPlaceHolder1_ddlRent"),"2",val); 
                
    } 
    else if(id.indexOf("CopLease")!=-1)
    {
        txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtRent"); 
        if(txtPrice.value.indexOf("Enter")==-1)
            val=CheckRange("3",txtPrice.value);
        else
            val="";            
        ShowPG("none");
        ShowSellRent("Rent","Sell");
        PPLoadBudgetRange(document.getElementById("ctl00_ContentPlaceHolder1_ddlRent"),"3",val);
        
    } 
    else if(id.indexOf("PG")!=-1)
    {
        txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_txtRent");
        if(txtPrice.value.indexOf("Enter")==-1)
            val=CheckRange("2",txtPrice.value);
        else
            val="";             
        ShowPG("");
        ShowSellRent("Rent","Sell");
        PPLoadBudgetRange(document.getElementById("ctl00_ContentPlaceHolder1_ddlRent"),"2",val); 
        
    }   
    
    
}



function SetPriceRange(Ele)
{
    var UserType;  
    var ddlBudget;
    if(Ele.value!="")
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_rdoSell").checked)
        {
            UserType="1";
            ddlBudget=document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice")
        }
        else if(document.getElementById("ctl00_ContentPlaceHolder1_rdoRent").checked || document.getElementById("ctl00_ContentPlaceHolder1_rdoPG").checked) 
        {
            UserType="2";
            ddlBudget=document.getElementById("ctl00_ContentPlaceHolder1_ddlRent")
        }
        else if(document.getElementById("ctl00_ContentPlaceHolder1_rdoCopLease").checked)
        {
            UserType="3";
            ddlBudget=document.getElementById("ctl00_ContentPlaceHolder1_ddlRent")
        }
        ddlBudget.value=CheckRange(UserType, Ele.value);
    }
    else
    {
        if(Ele.id.indexOf("Rent")!=-1)
        {   
            ddlBudget=document.getElementById("ctl00_ContentPlaceHolder1_ddlRent");
            Ele.value="Enter Monthly Rent";
        }
        else if(Ele.id.indexOf("Price")!=-1)
        {
            ddlBudget=document.getElementById("ctl00_ContentPlaceHolder1_ddlPrice");
            Ele.value="Enter Property Price";
        }            
        Ele.className="TextCss";
        ddlBudget.selectedIndex=0;
    }
                        
}
function CheckRange(type, price)
{
    if(type=="1")
    {
        if(eval(price)<eval(500000))
            return "1";
        else if(eval(price)>=eval(500000) && eval(price)<=eval(1000000))
            return "2";
        else if(eval(price)>=eval(1000000) && eval(price)<=eval(1500000))
            return "3";
        else if(eval(price)>=eval(1500000) && eval(price)<=eval(2500000))
            return "4";
        else if(eval(price)>=eval(2500000) && eval(price)<=eval(5000000))
            return "5";
        else if(eval(price)>=eval(5000000) && eval(price)<=eval(7500000))
            return "6";
        else if(eval(price)>=eval(7500000) && eval(price)<=eval(10000000))
            return "7";
        else if(eval(price)>=eval(10000000) && eval(price)<=eval(12500000))
            return "8";
        else if(eval(price)>=eval(12500000) && eval(price)<=eval(15000000))
            return "9";
        else if(eval(price)>=eval(15000000) && eval(price)<=eval(20000000))
            return "10";
        else if(eval(price)>=eval(20000000) && eval(price)<=eval(40000000))
            return "11";  
        else if(eval(price)>=eval(40000000) && eval(price)<=eval(70000000))
            return "12"; 
        else if(eval(price)>=eval(70000000) && eval(price)<=eval(100000000))
            return "13"; 
        else if(eval(price)>=eval(100000000) && eval(price)<=eval(150000000))
            return "14"; 
        else if(eval(price)>=eval(150000000) && eval(price)<=eval(200000000))
            return "15"; 
        else if(eval(price)>=eval(200000000) && eval(price)<=eval(250000000))
            return "16"; 
        else if(eval(price)>=eval(250000000) && eval(price)<=eval(300000000))
            return "17";                                                             
        else if(eval(price)>=eval(300000000) && eval(price)<=eval(350000000))
            return "18"; 
        else if(eval(price)>=eval(350000000) && eval(price)<=eval(500000000))
            return "19"; 
        else if(eval(price)>=eval(500000000) && eval(price)<=eval(1000000000))
            return "20";  
        else if(eval(price)>eval(1000000000))
            return "21";                       
                                                                                                                                              
    }
    else if(type=="2")
    {
        if(eval(price)<eval(5000))
            return "22";
        else if(eval(price)>=eval(5001) && eval(price)<=eval(7500))
            return "23";
        else if(eval(price)>=eval(7501) && eval(price)<=eval(10000))
            return "24";
        else if(eval(price)>=eval(10001) && eval(price)<=eval(15000))
            return "25";
        else if(eval(price)>=eval(15001) && eval(price)<=eval(20000))
            return "26";  
        else if(eval(price)>=eval(20001) && eval(price)<=eval(30000))
            return "27"; 
        else if(eval(price)>=eval(30001) && eval(price)<=eval(50000))
            return "28"; 
        else if(eval(price)>=eval(50001) && eval(price)<=eval(75000))
            return "29"; 
        else if(eval(price)>=eval(75001) && eval(price)<=eval(100000))
            return "30"; 
        else if(eval(price)>=eval(100000) && eval(price)<=eval(150000))
            return "31"; 
        else if(eval(price)>=eval(150000) && eval(price)<=eval(200000))
            return "32";                                                             
        else if(eval(price)>=eval(200000) && eval(price)<=eval(300000))
            return "33"; 
        else if(eval(price)>=eval(300000) && eval(price)<=eval(500000))
            return "34"; 
        else if(eval(price)>=eval(500000) && eval(price)<=eval(1000000))
            return "35";  
        else if(eval(price)>eval(1000000))
            return "36";                       
    }
    else if(type=="3")
    {
        if(eval(price)<eval(50000))
            return "37"; 
        else if(eval(price)>=eval(50001) && eval(price)<=eval(75000))
            return "38"; 
        else if(eval(price)>=eval(75001) && eval(price)<=eval(100000))
            return "39"; 
        else if(eval(price)>=eval(100000) && eval(price)<=eval(150000))
            return "40"; 
        else if(eval(price)>=eval(150000) && eval(price)<=eval(200000))
            return "41";                                                             
        else if(eval(price)>=eval(200000) && eval(price)<=eval(300000))
            return "42"; 
        else if(eval(price)>=eval(300000) && eval(price)<=eval(500000))
            return "43"; 
        else if(eval(price)>=eval(500000) && eval(price)<=eval(1000000))
            return "44";  
        else if(eval(price)>eval(1000000))
            return "45";                       
    }
}

function PPAGetElementId(id)
{
    var eleID;
    switch(id)
    {
        case "tblExtFeat":
            eleID = new Array("lblExtFeat","txtExtFeat");
            break;
        case "tblExtFac":
            eleID = new Array("txtExtFac");
            break;
        case "tblIntFeat":
            eleID = new Array("lblIntFeat", "txtIntFeat");
            break;
        case "tblIntFac":
            eleID = new Array("txtIntFac");
            break;
          
    }
    return eleID;
}
function PPAGetElementText(id)
{
    var eleID;
    switch(id)
    {
        case "tblExtFeat":
            eleID = new Array("Enter Label","Enter Description");
            break;
        case "tblExtFac":
            eleID = new Array("Enter External Facility");
            break;
        case "tblIntFeat":
            eleID = new Array("Enter Label","Enter Description");
            break;
        case "tblIntFac":
            eleID = new Array("Enter Internal Facility");
            break;          
    }
    return eleID;
}
function PPAAddRows(id)
{
    var tbl = document.getElementById(id);
    var lastRow = tbl.rows.length;
    // if there's no header row in the table, then iteration = lastRow + 1
    var iteration = lastRow;
    var row = tbl.insertRow(lastRow);
  

    var eleID = PPAGetElementId(id);
    var eleText = PPAGetElementText(id);
    
    for(i=0;i<eleID.length;i++)
    {
    
        var cell = row.insertCell(i);
        var el = document.createElement("input");
        
        el.name = eleID[i] + iteration;
        el.id = eleID[i] + iteration;
        

        if(i==0)
        {
            if(el.id.indexOf("Feat")!=-1)
                cell.style.width="250px";
            cell.style.paddingLeft="20px";
        }
        el.onblur=new Function("javascript:ShowText(this,'"+eleText[i]+"')");
        el.onfocus=new Function("javascript:HideText(this,'"+eleText[i]+"')");
        el.value=eleText[i];
        el.type='text';
        el.className='TextCss';
        el.maxLength=50;
        cell.style.backgroundColor='#ffffff';
        cell.style.textAlign="left";

        cell.appendChild(el);
    
    
    }
}
function PPARemoveRows(id)
{
  var tbl = document.getElementById(id);
  var lastRow = tbl.rows.length;
  if (lastRow > 0) tbl.deleteRow(lastRow - 1);
}

function PPAttGetFileType(type)
{
    var eleOption;
    switch(type)
    {
        case "Picture":
            eleOption = new Array("Front View","Side View","Balcony","Bathroom","Kitchen","Dinning Room","Bed Room","Master Bed Room","Study Room","Library","Drawing Room","Garden","Sunset view","Trainning Room","Meeting Room","Main Entrace","Terrace");
            break;
        case "FloorPlan":
            eleOption = new Array("Floor Plan","3D Layout","Elevation","Aerial View","Location Map");
            break;
        case "Video":
            eleOption = new Array("Walkthrough","Inside Video","Outside Video");
            break;
        case "Document":
            eleOption = new Array("Brochure","Price List","Specifications");
            break;          
    }
    return eleOption;
}
function PPAttGetElementId(id)
{
    var eleID;
    switch(id)
    {
        case "tblPicture":
            eleID = new Array("ddlPicture","spanPicture");
            break;
        case "tblFloorPlan":
            eleID = new Array("ddlFloorPlan","spanFloorPlan");
            break;
        case "tblVideo":
            eleID = new Array("ddlVideo", "txtVideo");
            break;
        case "tblDocument":
            eleID = new Array("ddlDocument","spanDocument");
            break;
          
    }
    return eleID;
}
function PPAttGetElementType(id)
{
    var eleType;
    switch(id)
    {
        case "tblPicture":
            eleType = new Array("select","span"); 
            break;
        case "tblFloorPlan":
            eleType = new Array("select","span"); 
            break;
        case "tblVideo":
            eleType = new Array("select","input"); 
            break;
        case "tblDocument":
            eleType = new Array("select","span"); 
            break;
    }
    return eleType;
}
function PPAttGetElementText(id)
{
    var eleID;
    switch(id)
    {
        case "tblPicture":
            eleID = new Array("","Upload File");
            break;
        case "tblFloorPlan":
            eleID = new Array("","Upload File");
            break;
        case "tblVideo":
            eleID = new Array("","Upload File");
            break;
        case "tblDocument":
            eleID = new Array("","Upload File");
            break;           
    }
    return eleID;
}
function PPAttCheckValue(tbl)
{
    var lastRow = tbl.rows.length;
    //alert(lastRow)
    var retVal=true;
    switch(tbl.id)
    {
        case "tblPicture":
            if(document.getElementById("spanPicture"+lastRow).innerHTML=="Upload File")
                retVal = false;
            break;
        case "tblFloorPlan":
            if(document.getElementById("spanFloorPlan"+lastRow).innerHTML=="Upload File")
                retVal = false;
            break;
        case "tblVideo":
            if(document.getElementById("txtVideo"+lastRow).value.toLowerCase()=="http://")
                retVal = false;
            break;
        case "tblDocument":
            if(document.getElementById("spanDocument"+lastRow).innerHTML=="Upload File")
                retVal = false;
            break;           
    }
    return retVal;
}
function PPAttAddRows(id)
{
    var tbl = document.getElementById(id);
    if(PPAttCheckValue(tbl))
    {
        var lastRow = tbl.rows.length;
        //alert(lastRow)
        if(lastRow==10)
        {
            alert("You can add 10 files only");
            return false;
        }
        // if there's no header row in the table, then iteration = lastRow + 1
        var iteration = lastRow+1;
        var row = tbl.insertRow(lastRow);
        
        var rdoPic=document.getElementById("ctl00_ContentPlaceHolder1_rdoPic");
        var rdoFloor=document.getElementById("ctl00_ContentPlaceHolder1_rdoFloor");
        var rdoVideo=document.getElementById("ctl00_ContentPlaceHolder1_rdoVideo");
        var rdoDoc=document.getElementById("ctl00_ContentPlaceHolder1_rdoDoc")
        var eleFileType;
        if(rdoPic.checked)
            eleFileType="Picture";
        else if(rdoFloor.checked)
            eleFileType="FloorPlan";
        else if(rdoVideo.checked)
            eleFileType="Video";
        else if(rdoDoc.checked)
            eleFileType="Document";                  
      
      
        var eleType = PPAttGetElementType(id);
        var eleID = PPAttGetElementId(id);
        var eleText = PPAttGetElementText(id);
        
        var eleOption = PPAttGetFileType(eleFileType);
        
        for(i=0;i<eleID.length;i++)
        {
        
            var cell = row.insertCell(i);
            var el = document.createElement(eleType[i]);
            
            el.name = eleID[i] + iteration;
            el.id = eleID[i] + iteration;
            

            if(eleType[i]=="span")
            {
                el.innerHTML=eleText[i];
                el.className='Link';
                el.style.cursor="pointer";
                el.onclick = new Function("javascript:ShowFileUpload('"+eleID[i] + iteration+"','"+eleText[i]+"','-250','-200')");
                
                  
                cell.style.backgroundColor='#ffffff';
                cell.style.textAlign="left";
                
            }
            else if(eleType[i]=="input")
            {   
                el.type='text';
                el.className='Text';
                el.value='http://';
                el.onblur=new Function("javascript:PPAttCheckURL(this)");
                cell.style.backgroundColor='#ffffff';
                cell.style.textAlign="left";
            }
            else if(eleType[i]=="select")
            {   el.length=0;
                for(p=0;p<eleOption.length;p++)
                {
                    ListUtil.add(el, ""+eval(p+1)+"", eleOption[p]);
                }
                ListUtil.add(el, "-1", "Other");
                el.className="DropDownCss";
                cell.style.width="250px";
                cell.style.paddingLeft="20px";
            }
            cell.appendChild(el);
        }
    }
    else
    {
        alert("Please add value");
    }
}
function PPAttRemoveRows(id)
{
  var tbl = document.getElementById(id);
  var lastRow = tbl.rows.length;
  if (lastRow > 1) tbl.deleteRow(lastRow - 1);
}
function PPAttShowAttchment(id)
{
    document.getElementById("ctl00_ContentPlaceHolder1_trPicture").style.display="none";
    document.getElementById("ctl00_ContentPlaceHolder1_trFloorPlan").style.display="none";
    document.getElementById("ctl00_ContentPlaceHolder1_trVideo").style.display="none";
    document.getElementById("ctl00_ContentPlaceHolder1_trDocument").style.display="none";
    
    document.getElementById("ctl00_ContentPlaceHolder1_tr"+id).style.display="";
    
    var ddlCaption=document.getElementById("ctl00_ContentPlaceHolder1_ddlCaption");
    
    ddlCaption.length=0;
    var eleOption = PPAttGetFileType(id);
    
    for(p=0;p<eleOption.length;p++)
    {
        ListUtil.add(ddlCaption, ""+eval(p+1)+"", eleOption[p]);
    }
    ListUtil.add(ddlCaption, "-1", "Other");
    
    if(id.indexOf("Picture")!=-1)
    {
        document.getElementById("tdFile").innerHTML="File (800 X 480)";
        for(i=1;i<5;i++)
        {
            if(document.getElementById("trImage"+i))
                document.getElementById("trImage"+i).style.display="";
        }    
    }
    else
    {
        document.getElementById("tdFile").innerHTML="File";
        for(i=1;i<5;i++)
        {
            if(document.getElementById("trImage"+i))
                document.getElementById("trImage"+i).style.display="none";
        }    
    }
    
//    if(id.indexOf("Video")!=-1)
//    {
//        document.getElementById("trFile").style.display="none";
//        document.getElementById("trURL").style.display="";
//    }
//    else
//    {
//        document.getElementById("trFile").style.display="";
//        document.getElementById("trURL").style.display="none";
//    }
    
}
function PPAttCheckURL(Ele)
{
    if(Ele.value.toLowerCase().indexOf("http://")==-1)
    {
        alert("URL path should be start with http://");
        Ele.value="http://";
        Ele.focus();
    }
}
function PPAttSaveCap()
{
    var rdoPic = document.getElementById("ctl00_ContentPlaceHolder1_rdoPic")
    var rdoFloor = document.getElementById("ctl00_ContentPlaceHolder1_rdoFloor")
    var rdoVideo = document.getElementById("ctl00_ContentPlaceHolder1_rdoVideo")
    var rdoDoc = document.getElementById("ctl00_ContentPlaceHolder1_rdoDoc")
    var FileUpload = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload");
    var FileUpload1 = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload1");
    var FileUpload2 = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload2");
    var FileUpload3 = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload3");
    var FileUpload4 = document.getElementById("ctl00_ContentPlaceHolder1_FileUpload4");
    var txtURL = document.getElementById("ctl00_ContentPlaceHolder1_txtURL");
    var ddlCaption=document.getElementById("ctl00_ContentPlaceHolder1_ddlCaption");
    var HiddenCaption=document.getElementById("ctl00_ContentPlaceHolder1_HiddenCaption");   
    
    var FileName=FileUpload.value;
    var FileName1=FileUpload1.value;
    var FileName2=FileUpload2.value;
    var FileName3=FileUpload3.value;
    var FileName4=FileUpload4.value;
    var URLPath = txtURL.value;

    if(FileUpload && FileName=="")
        return AlertMsg(FileUpload, "attach file");
    else if(rdoPic && FileUpload && rdoPic.checked && (FileName.toLowerCase().indexOf(".bmp")==-1 && FileName.toLowerCase().indexOf(".gif")==-1 && FileName.toLowerCase().indexOf(".png")==-1 && FileName.toLowerCase().indexOf(".jpeg")==-1 && FileName.toLowerCase().indexOf(".jpg")==-1))        
        return AlertMsg(FileUpload, "upload file, has extension .bmp | .gif | .png | .jpeg | .jpg only");
    
    else if(rdoPic.checked && FileUpload1 && FileName1=="")
        return AlertMsg(FileUpload1, "attach file");
    else if(rdoPic && FileUpload1 && rdoPic.checked && (FileName1.toLowerCase().indexOf(".bmp")==-1 && FileName1.toLowerCase().indexOf(".gif")==-1 && FileName1.toLowerCase().indexOf(".png")==-1 && FileName1.toLowerCase().indexOf(".jpeg")==-1 && FileName1.toLowerCase().indexOf(".jpg")==-1))        
        return AlertMsg(FileUpload1, "upload file, has extension .bmp | .gif | .png | .jpeg | .jpg only");
    
    else if(rdoPic.checked &&FileUpload2 && FileName2=="")
        return AlertMsg(FileUpload2, "attach file");
    else if(rdoPic && FileUpload2 && rdoPic.checked && (FileName2.toLowerCase().indexOf(".bmp")==-1 && FileName2.toLowerCase().indexOf(".gif")==-1 && FileName2.toLowerCase().indexOf(".png")==-1 && FileName2.toLowerCase().indexOf(".jpeg")==-1 && FileName2.toLowerCase().indexOf(".jpg")==-1))        
        return AlertMsg(FileUpload2, "upload file, has extension .bmp | .gif | .png | .jpeg | .jpg only");
    
    else if(rdoPic.checked &&FileUpload3 && FileName3=="")
        return AlertMsg(FileUpload3, "attach file");
    else if(rdoPic && FileUpload3 && rdoPic.checked && (FileName3.toLowerCase().indexOf(".bmp")==-1 && FileName3.toLowerCase().indexOf(".gif")==-1 && FileName3.toLowerCase().indexOf(".png")==-1 && FileName3.toLowerCase().indexOf(".jpeg")==-1 && FileName3.toLowerCase().indexOf(".jpg")==-1))        
        return AlertMsg(FileUpload3, "upload file, has extension .bmp | .gif | .png | .jpeg | .jpg only");
    
    else if(rdoPic.checked &&FileUpload4 && FileName4=="")
        return AlertMsg(FileUpload4, "attach file");
    else if(rdoPic && FileUpload4 && rdoPic.checked && (FileName4.toLowerCase().indexOf(".bmp")==-1 && FileName4.toLowerCase().indexOf(".gif")==-1 && FileName4.toLowerCase().indexOf(".png")==-1 && FileName4.toLowerCase().indexOf(".jpeg")==-1 && FileName4.toLowerCase().indexOf(".jpg")==-1))        
        return AlertMsg(FileUpload4, "upload file, has extension .bmp | .gif | .png | .jpeg | .jpg only");                                
    
    else if(rdoDoc && FileUpload && rdoDoc.checked && FileName.indexOf(".pdf")==-1)
        return AlertMsg(FileUpload, "upload file, has extension .pdf only");    
    
    
    HiddenCaption.value=ddlCaption.value; 
}
function PPAttStoreAttchments()
{
    var PictureCap=document.getElementById("ctl00_ContentPlaceHolder1_PictureCap");
    var Picture=document.getElementById("ctl00_ContentPlaceHolder1_Picture");
    var FloorPlanCap=document.getElementById("ctl00_ContentPlaceHolder1_FloorPlanCap");
    var FloorPlan=document.getElementById("ctl00_ContentPlaceHolder1_FloorPlan");
    var VideoCap=document.getElementById("ctl00_ContentPlaceHolder1_VideoCap");
    var Video=document.getElementById("ctl00_ContentPlaceHolder1_Video");
    var DocumentCap=document.getElementById("ctl00_ContentPlaceHolder1_DocumentCap");
    var Document=document.getElementById("ctl00_ContentPlaceHolder1_Document");
    var ddlPictureCap, spanPicture;
    var ddlFloorPlanCap, spanFloorPlan;
    var ddlVideoCap, txtVideo;
    var ddlDocumentCap, spanDocument;
    
    PictureCap.value="";
    Picture.value="";
    FloorPlanCap.value="";
    FloorPlan.value="";
    VideoCap.value="";
    Video.value="";
    DocumentCap.value="";
    Document.value="";
    
    for(i=1;i<=10;i++)
    {
        if(document.getElementById("ddlPicture"+i))
        {
            PictureCap.value+="|"+document.getElementById("ddlPicture"+i).value;
            Picture.value+="|"+document.getElementById("spanPicture"+i).value;
        }
        if(document.getElementById("ddlFloorPlan"+i))
        {
            FloorPlanCap.value+="|"+document.getElementById("ddlFloorPlan"+i).value;
            FloorPlan.value+="|"+document.getElementById("spanFloorPlan"+i).value;
        }
        if(document.getElementById("ddlVideo"+i))
        {
            VideoCap.value+="|"+document.getElementById("ddlVideo"+i).value;
            Video.value+="|"+document.getElementById("txtVideo"+i).value;
        }
        if(document.getElementById("ddlDocument"+i))
        {
            DocumentCap.value+="|"+document.getElementById("ddlDocument"+i).value;
            Document.value+="|"+document.getElementById("spanDocument"+i).value;
        }
    }

}
//  Home Loan
//-----------Start----------

function ShowHomeLoanData(id)
{
    for(i=0;i<5;i++)
    {
        if(document.getElementById("divHL"+i+"L"))
        {
            document.getElementById("divHL"+i+"L").className="InnerTabL";
            document.getElementById("divHL"+i+"M").className="InnerTabM";
            document.getElementById("divHL"+i+"R").className="InnerTabR";
            document.getElementById("div"+i).style.display="none";
        }            
    }
    document.getElementById("divHL"+id+"L").className="InnerTabOnL";
    document.getElementById("divHL"+id+"M").className="InnerTabOnM";
    document.getElementById("divHL"+id+"R").className="InnerTabOnR";
    document.getElementById("div"+id).style.display="";

}


var num=0;
var amt=0;
var per=0;
var months=0;
var nls="";
var rr="\r";
var b="                               ";
var d="-----------------------------"
+"----------------------------------";
var s="Rs. ";
function iA()
{
this.length=iA.arguments.length;
for (var i=0;i<this.length;i++)
{
this[i]=iA.arguments[i];
}
}
var pwr=new iA(10);
var dec=new iA(16);
pwr[0]=1;
for (var i=0;i<9;i++){
pwr[i+1]=pwr[i]*10;
}
dec[0]=.1;
dec[1]=.01;
dec[2]=.001;
dec[3]=.0001;
dec[4]=.00001;
dec[5]=.000001;
dec[6]=.0000001;
dec[7]=.00000001;
dec[8]=.000000001;
dec[9]=.0000000001;
dec[10]=.00000000001;
dec[11]=.000000000001;
dec[12]=.0000000000001;
dec[13]=.00000000000001;
dec[14]=.000000000000001;
dec[15]=.0000000000000001;
var ns="01234567890";
var cr="";
var str="";
function stn()
{
num=0;
pos=str.indexOf(".");
sfx="";
if (pos>-1)
{
sfx=str.substring(pos+1,str.length);
str=str.substring(0,pos);
}
strl=str.length;
for (var i=strl-1;i>-1;i--)
{
cr=str.substring(i,i+1);
pos=ns.indexOf(cr);
num+=pos*pwr[strl-i-1];
}
if (sfx!=""&&sfx.length>dp)
{
pos=ns.indexOf(sfx.charAt(dp+1));
if (pos>4)
{
pos=ns.indexOf(sfx.charAt(dp));
sfx=sfx.substring(0,dp-1)+(pos+1);
}
}
if (sfx!="")
{
for (var i=0;i<dp;i++)
{
cr=sfx.substring(i,i+1);
pos=ns.indexOf(cr);
num+=pos*dec[i];
}
}
}
function GetAmortization()
{
str=document.getElementById("txtAmt").value;
fmtIt();
bl=str.length+3;
dp=2;
stn();
amt=num;
str=document.getElementById("txtAnnualInt").value;
dp=4;
stn();
per=num;
str=document.getElementById("txtMonths").value;
dp=0;
stn();
months=num;
if (months<1||months>999||per<.0001||per>99||amt<1||amt>pwr[9])
{
alrt();
}
else
{
ls="";
isnnum=1;
i=per/12/100;
fpv=0;
for (var j=0;j<months;j++)
isnnum=isnnum*(1+i);
tmp=(amt*isnnum*i)/(isnnum-1);
fpv+=tmp;
fcalc=((months*fpv)-amt);
prtSched();
}
}
function prtSched()
{
var result_div=document.getElementById("divResult");
fpv+=.01;
str=""
str+=fpv;
fmtIt();
dp=2;
stn();
fpv=num;
pct=per/12/100;
if (bl<14)
{
bl=14;
}
result_htm="<table width=\"100%\" border='0' cellpadding='0' cellspacing='0'>"+
"<tr>"+
"<td>"+
"<table width=\"80%\" border=0 align=\"center\">"+
"<tr>"+
"<td colspan=2>Amortization Schedule:</td>"+
"<td colspan=3><b> "+document.getElementById("txtMonths").value+"</b> months to Repay <b>"+s+document.getElementById("txtAmt").value+"</b> At: <b>"+document.getElementById("txtAnnualInt").value+"%</b></td>"+
"</tr>"+
"</table>"+
"</td>"+
"</tr>"+
"<tr>"+
"<td>"+
"<table width=\"100%\" border=0 align=\"center\" style='background-color:#000000;' cellspacing='1' cellpadding='2' >"+
"<tr >"+
"<td style='background-color:#ddd7f0;width:12%;'><b><center>Payment Number</center></b></td>"+
"<td style='background-color:#ddd7f0;width:22%'><b><center>Payment Amount <br/>(Rs.)</center></b></td>"+
"<td style='background-color:#ddd7f0;width:22%'><b><center>Interest Amount <br/>(Rs.)</center></b></td>"+
"<td style='background-color:#ddd7f0;width:22%'><b><center>Principal Reduction <br/>(Rs.)</center></b></td>"+
"<td style='background-color:#ddd7f0;width:22%'><b><center>Balance Due <br/>(Rs.)</center></b></td>"+
"</tr>";
for (var j=0;j<months;j++)
{
ntr=(amt*pct);
str="";
str+=ntr;
fmtIt();
ntr1=s+str;
prp=fpv-ntr;
if (prp>amt)
{
prp=amt;
}
str="";
str+=prp;
fmtIt();
prp1=s+str;
amt-=prp;
str="";
str+=amt;
fmtIt();
amt1=str;
if (fpv>(ntr+prp))
{
fpv=ntr+prp;
}
str="";
str+=fpv;
fmtIt();
fpv1=str;
str="";
str+=(j+1)+".";
result_htm+="<tr>"+
"<td style='background-color:#ffffff; width:12%; text-align:center;' >"+str+"</td>"+
"<td style='background-color:#ffffff; width:22%; text-align:right; padding-right:5px;' >"+fpv1+"</td>"+
"<td style='background-color:#ffffff; width:22%; text-align:right; padding-right:5px;' >"+ntr1+"</td>"+
"<td style='background-color:#ffffff; width:22%; text-align:right; padding-right:5px;' >"+prp1+"</td>"+
"<td style='background-color:#ffffff; width:22%; text-align:right; padding-right:5px;' >"+amt1+"</td>"+
"</tr>";
}
result_htm+="</table></td></tr></table><br><br><span class=\"smalltext\" * Interest calculated at 1/12th of annual interest rate on the remaining principal amount. (Rounding errors possible)</span>";
result_htm+="<div style='float:right; width:100%; text-align:right;'><a href=\"#\" class='Link'><b>Top</b></a></div>";
result_div.innerHTML=result_htm;
result_div.className="";
}
function fmtIt()
{
pos=str.indexOf(".");
if (pos==0)
{
str="0"+str;
pos++;
}
if (pos<0)
{
str+=".00";
pos=str.indexOf(".");
}
str+="0000";
str=str.substring(0,pos+4);
cr=str.charAt(str.length-1);
pos=ns.indexOf(cr);
str=str.substring(0,str.length-1);
if (pos>5)
{
for (var k=str.length-1;k>-1;k--)
{
cr=str.charAt(k);
posn=ns.indexOf(cr);
if (posn<0)
{
k--;
}
else
{
str=str.substring(0,k)+ns.substring(posn+1,posn+2)
+str.substring(k+1,str.length);
if (posn!=9)
{
k=-1;
}
}
}
}
}
function alrt()
{
alert("You couldn't know. Months must be from"+" 1 to 999, Loan amount from 1 to "+pwr[9]+" and Interest from .001 to 99%");
}
function ResetAmortization()
{
document.getElementById("txtMonths").value="";
document.getElementById("txtAmt").value="";
document.getElementById("txtAnnualInt").value="";
document.getElementById("divResult").innerHTML="";
}

function CalculateEMI()
{
    var redBal;
    if(document.getElementById("rdoMonth").checked)
        redBal="Month";
    else if(document.getElementById("rdoAnnual").checked)
        redBal="Annual";

    var LoanAmout = document.getElementById("txtLoanAmt").value;

    for(i=0;i<LoanAmout.split(',').length;i++)
        LoanAmout=LoanAmout.replace(",","");
    for(i=0;i<LoanAmout.split(',').length;i++)
        LoanAmout=LoanAmout.replace(",",""); 


    if (document.getElementById("txtLoanAmt").value == "" && document.getElementById("txtLoanPeriod").value =="")
    {
        alert("Please enter a number against 'Loan Amount and Period'");
        return false;
    }
    else if ((isNaN(LoanAmout) == true) ||(LoanAmout == ""))
    {
        alert("Please enter a number against 'Loan Amount' ");
        return false;
    }
    else if  ((isNaN(document.getElementById("txtLoanPeriod").value) == true)||(document.getElementById("txtLoanPeriod").value == "") || (document.getElementById("txtLoanPeriod").value < 1))
    {
        alert("Please enter a valid number against 'Loan Period' ");
        return false;
    }
    else if  ((isNaN(document.getElementById("txtInt").value) == true)||(document.getElementById("txtInt").value == ""))
    {
        alert("Please enter a number against 'Interest Rate' ");
        return false;
    }
    else
    {
        var loanAMT=LoanAmout;
        var loanPeriod=document.getElementById("txtLoanPeriod").value;
        var intRate=(document.getElementById("txtInt").value)/100;
        if (redBal =="Annual")
        {
            var CalRa=Math.pow((1+intRate),(parseInt(loanPeriod)))
            var varEMI=(parseFloat(loanAMT)/((1-(1/(CalRa)))/(intRate/12)))
            document.getElementById("txtEMI").value =Math.round(varEMI,2);
            InsertComm(document.getElementById("txtEMI"))
        }
        else
        {
            var CalRa=Math.pow((1+(intRate/12)),(12*parseInt(loanPeriod)))
            var varEMI=(parseFloat(loanAMT)/((1-(1/(CalRa)))/(intRate/12)))
            document.getElementById("txtEMI").value =Math.round(varEMI,2);
            InsertComm(document.getElementById("txtEMI"))
        }

        return true;
    }
}

function ResetEMI()
{
document.getElementById("rdoMonth").checked=true;
document.getElementById("txtLoanAmt").value="";
document.getElementById("txtLoanPeriod").value="";
document.getElementById("txtInt").value="";
document.getElementById("txtEMI").value="";
}

//-----------End--------------
//  Home Loan    

//  NRI Section
//  ------------Start---------

function ShowNRISecData(id)
{
    for(i=0;i<5;i++)
    {
        if(document.getElementById("divNS"+i+"L"))
        {
            document.getElementById("divNS"+i+"L").className="InnerTabL";
            document.getElementById("divNS"+i+"M").className="InnerTabM";
            document.getElementById("divNS"+i+"R").className="InnerTabR";
            document.getElementById("div"+i).style.display="none";
        }            
    }
    document.getElementById("divNS"+id+"L").className="InnerTabOnL";
    document.getElementById("divNS"+id+"M").className="InnerTabOnM";
    document.getElementById("divNS"+id+"R").className="InnerTabOnR";
    document.getElementById("div"+id).style.display="";

}


//  ------------End-----------
//  NRI Section

//  New Index Start

//  New Index Main Menu
//  ------------Start-----------
function ActivateMM(Ele)
{
    Ele.style.backgroundImage="url(ImagesNew/mouse_hover.gif)";
    Ele.style.cursor="pointer";
}
function DeactivateMM(Ele)
{
    Ele.style.backgroundImage="none";
    Ele.style.cursor="default";
}
function ActivateIMM(Ele)
{
    if(Ele.id.indexOf("divMM0")==-1)
    {
        Ele.style.backgroundImage="url(../ImagesNew/mouse_hover.gif)";
        Ele.style.cursor="pointer";
    }
    else
    {
        document.getElementById("imgDivMM0").src="../ImagesNew/home_topmenu.gif";
        Ele.style.cursor="pointer";
    }        
}
function DeactivateIMM(Ele)
{
    if(Ele.id.indexOf("divMM0")==-1)
    {
        Ele.style.backgroundImage="none";
        Ele.style.cursor="default";
    }
    else
    {
        document.getElementById("imgDivMM0").src="../ImagesNew/home.gif";
        Ele.style.cursor="default";
    } 
}
//  ------------End-------------
//  New Index Main Menu

function NISetResCom(id)
{
    var divRes=document.getElementById("divRes");
    var divCom=document.getElementById("divCom");
    var ddlBedrooms=document.getElementById("ddlBedrooms");
    var rdoBuy=document.getElementById("rdoBuy");
    var rdoPG=document.getElementById("rdoPG");
    var HiddenCategory = document.getElementById("HiddenCategory");
    if(id=="1")
    {
        divRes.style.cursor="default";
        divRes.style.backgroundColor="#ececec";
        divRes.onclick="";
        divCom.style.cursor="pointer";
        divCom.style.backgroundColor="#528f06";
        divCom.onclick= new Function("javascript:NISetResCom('2')");
        ddlBedrooms.disabled=false;
        rdoPG.disabled=false;
    }
    else if(id=="2")
    {
        divRes.style.cursor="pointer";
        divRes.style.backgroundColor="#528f06";
        divRes.onclick= new Function("javascript:NISetResCom('1')");
        divCom.style.cursor="default";
        divCom.style.backgroundColor="#ececec";
        divCom.onclick="";
        ddlBedrooms.disabled=true;
        rdoPG.disabled=true;
    }
    ddlBedrooms.selectedIndex=0;
    rdoBuy.checked=true;
    HiddenCategory.value=id;
    NIFillPropertyTypeDDL(id);
}
function NIFillStateDDL()
{
    document.getElementById("HiddenSetDropDown").value="ddlState";
    document.getElementById("HiddenMessage").value="Select State / UT";
    GetDropDownData("GetState=GetState");
}
function NIFillPropertyTypeDDL(id)
{
    document.getElementById("HiddenSetDropDown").value="ddlType";
    document.getElementById("HiddenMessage").value="Select Property Type";
    GetDropDownData("WithCatId="+id);
}
function NIFillBudgetDDL(id)
{
    document.getElementById("HiddenSetDropDown").value="ddlBudget";
    document.getElementById("HiddenMessage").value="Select Range";
    GetDropDownData("UserType="+id);
}
function NIFillCityDDL(Ele)
{
    document.getElementById("HiddenSetDropDown").value="ddlCity";
    document.getElementById("HiddenMessage").value="Select City";
    GetDropDownData("StateId="+Ele.value);
}
function RFFillCityDDL(Ele)
{
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenSetDropDown").value="ddlCity";
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenMessage").value="Select City";
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenDropDownEnd").value="Other";
    GetMasterPageDropDownData("StateId="+Ele.value);
}
function RFShowOtherCity(Ele)
{
    if(Ele.value=="-1")
        document.getElementById("txtCity").style.display="";
    else
        document.getElementById("txtCity").style.display="none";        
}
function ShowHideDivData(id)
{
    var imgId = document.getElementById("img"+id);
    var imgSrc = imgId.src;
    var imgNewSrc = "";
    var divId = document.getElementById("div"+id);
    var divHeight="30px";
    if(id.toLowerCase()=="news")
        divHeight="194px";
    if(imgSrc.toLowerCase().indexOf("arrow_down")!=-1)
    {
        imgNewSrc=imgSrc.replace("arrow_down","arrow_side");
        imgId.src=imgNewSrc;
        divId.style.display="none";
        if(document.getElementById("div"+id+"Main"))
            document.getElementById("div"+id+"Main").style.height="30px";
    }
    else if(imgSrc.toLowerCase().indexOf("arrow_side")!=-1)
    {
        imgNewSrc=imgSrc.replace("arrow_side","arrow_down");
        imgId.src=imgNewSrc;
        divId.style.display="";
        if(document.getElementById("div"+id+"Main"))
            document.getElementById("div"+id+"Main").style.height=divHeight;
    }
    
    
}
function NIValidateSearch()
{
    var HiddenCategory = document.getElementById("HiddenCategory");
    var rdoBuy = document.getElementById("rdoBuy");
    var rdoRent = document.getElementById("rdoRent");
    var rdoPG = document.getElementById("rdoPG");
    var ddlType = document.getElementById("ddlType");
    var ddlBedrooms = document.getElementById("ddlBedrooms");
    var ddlState = document.getElementById("ddlState");
    var ddlCity = document.getElementById("ddlCity");
    var ddlBudget = document.getElementById("ddlBudget");
    var rdoAny = document.getElementById("rdoAny");
    var rdoBuilder = document.getElementById("rdoBuilder");
    var rdoBroker = document.getElementById("rdoBroker");
    var rdoOwner = document.getElementById("rdoOwner");
    var HiddenValue = document.getElementById("HiddenValue");

    if(ddlType && ddlType.value=="")
        return AlertMsg(ddlType, "select Property Type");
    else 
    {
        HiddenValue.value=HiddenCategory.value;
        if(rdoBuy.checked)
            HiddenValue.value+=":sell";
        else if(rdoRent.checked)
            HiddenValue.value+=":rent";
        else if(rdoPG.checked)
            HiddenValue.value+=":pg";
        HiddenValue.value+=":"+ddlType.value;                         
        HiddenValue.value+=":"+ddlBedrooms.value;  
        HiddenValue.value+=":"+ddlState.value; 
        HiddenValue.value+=":"+ddlCity.value; 
        HiddenValue.value+=":"+ddlBudget.value; 
        if(rdoAny.checked)
            HiddenValue.value+=":";
        else if(rdoBuilder.checked)
            HiddenValue.value+=":builder";
        else if(rdoBroker.checked)
            HiddenValue.value+=":agent";
        else if(rdoOwner.checked)
            HiddenValue.value+=":individual";
                   
        __doPostBack('btnExecute','');
    }                       
}
function NIValidateProp()
{
    var txtPropID = document.getElementById("txtPropID");
    var HiddenPropID = document.getElementById("HiddenPropID");

    if(txtPropID && txtPropID.value=="")
        return AlertMsg(txtPropID, "enter Property ID");
    else 
    {
        HiddenPropID.value=txtPropID.value;
        __doPostBack('btnExecute','');
    }
}
function __doPostBack(eventTarget, eventArgument) 
{  
    var theform = document.form1;  
     theform.__EVENTTARGET.value = eventTarget;  
    theform.__EVENTARGUMENT.value = eventArgument;  
    theform.submit();  
} 
function AddToWatchList(val)
{
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenWatchId").value=val;
    __doPostBack1('ctl00$ContentPlaceHolder1$btnSearch','');
}
function RemoveFromWatchList(val)
{
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenRemoveWatchId").value=val;
    __doPostBack1('ctl00$ContentPlaceHolder1$btnSearch','');
}
function SetAsDefaultImage(val)
{
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenSetImageId").value=val;
    __doPostBack1('ctl00$ContentPlaceHolder1$btnUpload','');
}
function RemoveImage(val)
{
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenRemoveImageId").value=val;
    __doPostBack1('ctl00$ContentPlaceHolder1$btnUpload','');
}
function __doPostBack1(eventTarget, eventArgument) 
{  
    var theform = document.aspnetForm;  
    theform.__EVENTTARGET.value = eventTarget;  
    theform.__EVENTARGUMENT.value = eventArgument;  
    theform.submit();  
}
function NIChangeStyle(Ele)
{
    Ele.style.opacity="1.0";
    Ele.style.filter="alpha(opacity=100)"
}
function NIBackStyle(Ele)
{
    Ele.style.opacity="0.3";
    Ele.style.filter="alpha(opacity=30)"
}

//  New Index End
//  Show Message    //
//------Start------
function ShowDivDisMessage(Ele)
{
    //alert(Ele.id)
    var pleft, ptop;
    
    var message = Ele.getAttribute("message");
    if(message!=null && message!="")
    {
    var eleWidth=Ele.offsetWidth;
    if( typeof( Ele.offsetParent ) != 'undefined' ) {
    for( var posX = 0, posY = 0; Ele; Ele = Ele.offsetParent ) {
      posX += Ele.offsetLeft;
      posY += Ele.offsetTop;
    }
    //alert( posX+":"+ posY )
    pleft=posX;
    ptop=posY
  } else {
    //alert( Ele.x+":"+ Ele.y );
    pleft=Ele.x;
    ptop=Ele.y
  }

    var divDisMessage = document.getElementById("divDisMessage");
    divDisMessage.style.display="";
    if((parseInt(pleft)+parseInt(10)+parseInt(eleWidth))<800)
        divDisMessage.style.left=parseInt(pleft)+parseInt(10)+parseInt(eleWidth)+"px";
    else
        divDisMessage.style.left=parseInt(pleft)-(parseInt(10)+parseInt(divDisMessage.offsetWidth))+"px";
    divDisMessage.style.top=parseInt(ptop)+"px";
    if(message!=null)
    divDisMessage.innerHTML=message;
    else
    {
    divDisMessage.innerHTML="&nbsp;"
    }
    }
}
function HideDivDisMessage()
{
    if(document.getElementById("divDisMessage"))
    {
        var divDisMessage = document.getElementById("divDisMessage");
        divDisMessage.innerHTML=""; 
        divDisMessage.style.display="none";
    }
}
function GetPageElements()
{
    var eleID = new Array(
"ctl00_txtLNUserName",
"ctl00_txtLNPassword",
"ctl00_txtFUserName",
"ctl00_ContentPlaceHolder1_txtLogin",
"ctl00_ContentPlaceHolder1_txtPassword",
"ctl00_ContentPlaceHolder1_txtConfPassword",
"ctl00_ContentPlaceHolder1_ddlTitle",
"ctl00_ContentPlaceHolder1_txtFName",
"ctl00_ContentPlaceHolder1_txtMName",
"ctl00_ContentPlaceHolder1_txtLName",
"ctl00_ContentPlaceHolder1_txtMobile",
"ctl00_ContentPlaceHolder1_Captcha1_txtCaptcha",
"ctl00_ContentPlaceHolder1_txtLandline",
"ctl00_ContentPlaceHolder1_txtAddress",
"ctl00_ContentPlaceHolder1_txtDOB",
"ctl00_ContentPlaceHolder1_txtPincode",
"ctl00_ContentPlaceHolder1_ddlCategory",
"ctl00_ContentPlaceHolder1_ddlType",
"ctl00_ContentPlaceHolder1_ddlCountry",
"ctl00_ContentPlaceHolder1_ddlState",
"ctl00_ContentPlaceHolder1_ddlCity",
"ctl00_ContentPlaceHolder1_ddlLocation",
"ctl00_ContentPlaceHolder1_txtPropertyTitle",
"ctl00_ContentPlaceHolder1_ddlPropAge",
"ctl00_ContentPlaceHolder1_ddlBedrooms",
"ctl00_ContentPlaceHolder1_ddlBathroom",
"ctl00_ContentPlaceHolder1_txtArea",
"ctl00_ContentPlaceHolder1_txtPrice",
"ctl00_ContentPlaceHolder1_ddlPrice",
"ctl00_ContentPlaceHolder1_ddlOwnership",
"ctl00_ContentPlaceHolder1_txtRent",
"ctl00_ContentPlaceHolder1_ddlRent",
"ctl00_ContentPlaceHolder1_txtLocation",
"ctl00_ContentPlaceHolder1_txtTotFloors",
"ctl00_ContentPlaceHolder1_ddlPropFloor",
"ctl00_ContentPlaceHolder1_txtCarPark",
"ctl00_ContentPlaceHolder1_ddlElectricity",
"ctl00_ContentPlaceHolder1_ddlWaterSupply",
"ctl00_ContentPlaceHolder1_ddlFencing",
"linkAddBooking",
"A1",
"A3",
"A5",
"ctl00_ContentPlaceHolder1_txtLankmark",
"ctl00_ContentPlaceHolder1_txtSchool",
"ctl00_ContentPlaceHolder1_txtHospital",
"ctl00_ContentPlaceHolder1_txtAirport",
"ctl00_ContentPlaceHolder1_txtRailwayStation",
"ctl00_txtEnquiryName",
"ctl00_txtEnquiryEmail",
"ctl00_txtEnquiryMobile",
"ctl00_txtQuery",
//"ctl00_ContentPlaceHolder1_txtComment")
"wysiwygctl00_ContentPlaceHolder1_txtComment")
    return eleID;
}
function GetPageElementMessage()
{
    var eleID = new Array(
"Enter the Email ID given at the time of regestration.",
"Enter the password given at the time of regestration.",
"Please enter your email address here, we will send your password through email",
"Enter your email address (e.g myname@gmail.com).Your  email will be your User ID.",
"Please enter a password of min. 6 characters",
"Re-type the password",
"Please select your title",
"Please enter your first name. e.g Vijay",
"Please enter your middle name. e.g Kumar",
"Please enter your last name. e.g Singh",
"Please enter your mobile number for free SMS alerts & faster response from interested parties.",
"Enter the characters in the image here.If the code is not proper click the image to get a new code.",
"Enter your phone number with area code (e.g 0120-4038111)",
"Enter address here.",
"Enter your date of birth",
"Enter pin code",
"Select the category of your property",
"Select the property type",
"Select Country",
"Select State",
"Select the city where your property is located.If you do not find your city in the list then scroll down & select 'Other' option & enter city name in the textbox that appears in the right",
"Select the locality where your property is located.If you do not find your locality in the list then scroll down & select 'Other' option & enter locality name in the textbox that appears in the right",
"Describe your property in one line e.g Luxurious villa near to metro station or Prime commercial place in Pune ",
"Select the age of the property",
"Select the number of bedrooms in your property.",
"Select the number of bathrooms in your property",
"Enter the total area of your property in sq. fts.",
"Enter the property price (for sale). If you do not wish to specify an exact amount you can select a range from the dropdown box on the right.",
"Enter the approxmate price range of your property",
"Select the type of ownership of your property",
"Enter the property price (for rent). If you do not wish to specify an exact amount you can select a range from the dropdown box on the right",
"Enter the approxmate price range of your property",
"Enter location here",
"Enter the total number of floors in the Building",
"Select the floor on which your property is located",
"Enter no. of car parking available",
"Select type of electricity available",
"Select type of water supply available",
"Select type of fencing",
"To add more features Click Here",
"To add more external facilities click here",
"To add more internal features click here",
"To add more internal facilities click here",
"Enter Prominent landmark nearyby your property",
"Enter school name nearby your property",
"Enter hospital nearby your property",
"Enter Distance of Airport in Kms from your property",
"Enter Distance of prominent railway station in Kms. from your property",
"Enter your Name",
"Enter your Email-ID",
"Enter Your Mobile Number",
"Enter your query here",
"Describe your property in detail. You can use the formatting buttons in the toolbar to format your description.");
    return eleID;
}
function mouseEventHandler(mEvent)
{
  // Internet Explorer
  if (mEvent.srcElement)
  {
    showPopup(mEvent, mEvent.srcElement);
  }
  // Netscape and Firefox
  else if (mEvent.target)
  {
    showPopup(mEvent, mEvent.target);
  }
}
function showPopup(myEvent, myElement)
{
	if (myElement.id)
	    ShowDivDisMessage(myElement)

}


function AssignDisMessage()
{

    var EleId=GetPageElements();
    var EleMess=GetPageElementMessage();
    var Ele;
    var stronblur, stronfocus;
    for(i=0; i<EleId.length; i++)
    {
        if(document.getElementById(EleId[i]))
        {
            
            
            Ele=document.getElementById(EleId[i]);
            Ele.setAttribute("message",EleMess[i]);
//            Ele.setAttribute("onmouseover","ShowDivDisMessage(this)");
//            Ele.setAttribute("onmouseout","HideDivDisMessage()");
            stronblur=Ele.getAttribute("onblur");
            stronfocus=Ele.getAttribute("onfocus");
            if(stronblur==null)
                Ele.setAttribute("onblur","HideDivDisMessage()");                
            if(stronfocus==null)
                Ele.setAttribute("onfocus","ShowDivDisMessage(this)");                            
            
            if (Ele.addEventListener)
            {
                //Ele.addEventListener('mouseover', ShowDivDisMessage, false); 
                Ele.addEventListener('mouseout', HideDivDisMessage, false); 
            } 
            else if (Ele.attachEvent)
            {
                //Ele.attachEvent('onmouseover', ShowDivDisMessage);
                Ele.attachEvent('onmouseout', HideDivDisMessage); 
            }

            
            
        }
    }
}
//-------End-------

function SearchSortBy(val)
{
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenFieldSort").value=val;
}
function GetSearchData()
{
    var ddlCategory = document.getElementById("ctl00_ContentPlaceHolder1_ddlCategory")
    var ddlType = document.getElementById("ctl00_ContentPlaceHolder1_ddlType")
    var ddlBudget = document.getElementById("ctl00_ContentPlaceHolder1_ddlBudget")
    var ddlBedrooms = document.getElementById("ctl00_ContentPlaceHolder1_ddlBedrooms")
    var ddlState = document.getElementById("ctl00_ContentPlaceHolder1_ddlState")
    var ddlCity = document.getElementById("ctl00_ContentPlaceHolder1_ddlCity")
    var lstLocation = document.getElementById("ctl00_ContentPlaceHolder1_lstLocation")
    
    
    
    SetHiddenValue(ddlCategory,'HiddenCategory')
    SetHiddenValue(ddlType,'HiddenPropertyType')
    SetHiddenValue(ddlBudget,'HiddenBudget');
    SetHiddenValue(ddlBedrooms,'HiddenBedrooms');
    SetHiddenValue(ddlState,'HiddenStateId')
    SetHiddenValue(ddlCity, 'HiddenCityId');
    GetSelectedLocations(lstLocation);
    
    
}


function SearchOnmouserOver(Ele)
{
    Ele.src=Ele.src.replace(".gif","D.gif");
}
function SearchOnmouserOut(Ele)
{
    Ele.src=Ele.src.replace("D.gif",".gif");
}

function ShowFullView()
{
    document.getElementById("trFullView").style.display="";
    document.getElementById("trSlideShow").style.display="none";
}
function ShowSlideShow()
{
    document.getElementById("trSlideShow").style.display="";
    document.getElementById("trFullView").style.display="none";
    document.getElementById("trSlideOptions").style.display="";
}
function SlideBack()
{
    Selected=eval(Selected)-eval(1);
    MoveSlideShow();
}
function SlideNext()
{
    Selected=eval(Selected)+eval(1);
    MoveSlideShow();
}
function MoveSlideShow()
{
    document.getElementById("divSlideBackCaption").style.display="";
    document.getElementById("imgSlidePrev").style.display="";
    document.getElementById("divSlideBack").style.display="";
    document.getElementById("divSlideNextCaption").style.display="";
    document.getElementById("imgSlideNext").style.display="";
    document.getElementById("divSlideNext").style.display="";
    
    if(eval(Selected)>0)
    {
        document.getElementById("imgSlidePrev").src=imagesPreloaded[eval(Selected)-eval(1)].src;
        document.getElementById("divSlideBackCaption").innerHTML=imagesCaption[eval(Selected)-eval(1)];
    }
    else
    {
        document.getElementById("divSlideBackCaption").style.display="none";
        document.getElementById("imgSlidePrev").style.display="none";
        document.getElementById("divSlideBack").style.display="none";
    }          
    document.getElementById("imgSlideFull").src=imagesPreloaded[eval(Selected)].src;
    document.getElementById("linkSlideFull").href=imagesPreloaded[eval(Selected)].src;
    document.getElementById("divSlideFullCaption").innerHTML=imagesCaption[eval(Selected)];
    if(eval(Selected)+eval(1)<eval(imagesPreloaded.length))
    {
        document.getElementById("imgSlideNext").src=imagesPreloaded[eval(Selected)+eval(1)].src;
        document.getElementById("divSlideNextCaption").innerHTML=imagesCaption[eval(Selected)+eval(1)];
    }        
    else
    {
        document.getElementById("divSlideNextCaption").style.display="none";
        document.getElementById("imgSlideNext").style.display="none";
        document.getElementById("divSlideNext").style.display="none";
    }
}
var MyImages;
var imagesPreloaded;
var imagesCaption;
var Selected;
//function GetSlideShowElements(EleType, EleIndex)
//{
//    MyImages=new Array();
//    MyImages[0]='40680108data.jpg';
//    MyImages[1]='406801081.jpeg';
//    MyImages[2]='40680108ByeBye_2009.gif';
//    MyImages[3]='40680108Happy New year.JPG';
//    
//    Selected=EleIndex;
//    
//    imagesPreloaded = new Array(MyImages.length)
//    for (var i = 0; i < MyImages.length ; i++) 
//    {
//	    imagesPreloaded[i] = new Image(120,120)
//        imagesPreloaded[i].src="../Seller/PropertyImages/"+MyImages[i]
//    }
//    
//    MoveSlideShow();   
//        
//    document.getElementById("trFullView").style.display="";
//    document.getElementById("trSlideShow").style.display="none";
//}


//------------  Add Project  --------------------

//---------------  Start  -----------------------

function ShowHideBuilder(ind, bld)
{
    if(document.getElementById("trIndividual"))
        document.getElementById("trIndividual").style.display=ind;
    if(document.getElementById("trBuilder"))
        document.getElementById("trBuilder").style.display=bld;
       
}
function GetElementType(id)
{
    var eleType;
    switch(id)
    {
        case "tblFloorPlans":
            eleType = new Array("input","input","input","a");
            break;
        case "tblFloorLayouts":
            eleType = new Array("input","a");
            break;
        case "tblSpecifications":
            eleType = new Array("input","input");
            break;
        case "tblAmenities":
            eleType = new Array("input");
            break;
        case "tblBooking":
            eleType = new Array("input");
            break;
        case "tblPhoto":
            eleType = new Array("a");
            break;
        case "tblVideo":
            eleType = new Array("a");
            break;            
        case "tblReferFriend":
            eleType = new Array("input","input");            
    }
    return eleType;
}
function GetElementText(id)
{
    var eleID;
    switch(id)
    {
        case "tblFloorPlans":
            eleID = new Array("","","","Add Layout");
            break;
        case "tblFloorLayouts":
            eleID = new Array("","Add Layout");
            break;
        case "tblSpecifications":
            eleID = new Array("","");
            break;
        case "tblAmenities":
            eleID = new Array("");
            break;
        case "tblBooking":
            eleID = new Array("");
            break;
        case "tblPhoto":
            eleID = new Array("Add Photo");
            break;
        case "tblVideo":
            eleID = new Array("Add Video");
            break;  
        case "tblReferFriend":
            eleID= new Array("Recipient Name", "Recipient Email");
            break;                      
    }
    return eleID;
}
function GetElementId(id)
{
    var eleID;
    switch(id)
    {
        case "tblFloorPlans":
            eleID = new Array("txtType","txtSize","txtPrice","linkLayout");
            break;
        case "tblFloorLayouts":
            eleID = new Array("txtLabel","linkLayout");
            break;
        case "tblSpecifications":
            eleID = new Array("txtSpecification","txtDescription");
            break;
        case "tblAmenities":
            eleID = new Array("txtSent");
            break;
        case "tblBooking":
            eleID = new Array("txtBooking");
            break;
        case "tblPhoto":
            eleID = new Array("linkPhoto");
            break;
        case "tblVideo":
            eleID = new Array("linkVideo");
            break;          
        case "tblReferFriend":
            eleID = new Array("txtRecName", "txtRecEmail");
            break;              
    }
    return eleID;
}
function GetElementAlign(id)
{
    var eleID;
    switch(id)
    {
        case "tblFloorPlans":
            eleID = new Array("center","center","center","center");
            break;
        case "tblFloorLayouts":
            eleID = new Array("center","center");
            break;
        case "tblSpecifications":
            eleID = new Array("center","center");
            break;
        case "tblAmenities":
            eleID = new Array("left");
            break;
        case "tblBooking":
            eleID = new Array("left");
            break;
        case "tblPhoto":
            eleID = new Array("left");
            break;
        case "tblVideo":
            eleID = new Array("left");
            break;
        case "tblReferFriend":
            eleID = new Array("left","left");
            break;                        
    }
    return eleID;
}
function AddRows(id)
{
    var tbl = document.getElementById(id);
    var lastRow = tbl.rows.length;
    // if there's no header row in the table, then iteration = lastRow + 1
    var iteration = lastRow;
    var row = tbl.insertRow(lastRow);
  
    var eleType = GetElementType(id);
    var eleID = GetElementId(id);
    var eleAlign=GetElementAlign(id);
    var eleText = GetElementText(id);
    
    for(i=0;i<eleType.length;i++)
    {
    
        var cell = row.insertCell(i);
        var el = document.createElement(eleType[i]);
        
        el.name = eleID[i] + iteration;
        el.id = eleID[i] + iteration;
        
        
        if(eleType[i]=="a")
        {
            el.innerHTML=eleText[i];
            el.className='LinkCss';
            if(eleID[i].indexOf("linkLayout")!=-1)
                el.href="javascript:StoreUploadId('"+eleID[i] + iteration+"');";
            else if(eleID[i].indexOf("linkPhoto")!=-1)
                el.href="javascript:ShowUpload('"+eleID[i] + iteration+"','"+eleText[i]+"','0','-170');";
            else if(eleID[i].indexOf("linkVideo")!=-1)
                el.href="javascript:ShowUpload('"+eleID[i] + iteration+"','"+eleText[i]+"','-450','-170');";                
            cell.style.backgroundColor='#ffffff';
            cell.style.textAlign=eleAlign[i];
            
        }
        else
        {   
            el.style.width='95%';
            el.type='text';
            el.className='Text';
            cell.style.backgroundColor='#ffffff';
            cell.style.textAlign=eleAlign[i];
        }
        cell.appendChild(el);
        
        if(eleID[i].indexOf("linkLayout")!=-1)
        {
            var img =document.createElement("img");
            img.name = "img" + iteration;
            img.id = "img" + iteration;
            img.src="../imagesnew/deleteSmall.gif";
            img.onclick="dropdowncontent.removeattach('linkLayout"+iteration+"','Add Layout')";
            img.onclick=function(){dropdowncontent.removeattach("linkLayout"+iteration,"Add Layout");};
            cell.appendChild(img);
        }
    
    
    }
    // cell
//    var cell = row.insertCell(0);
//    var el = document.createElement('input');
//    el.type = 'text';
//    el.name = val + iteration;
//    el.id = val + iteration;
//    el.style.width='95%';
//    el.className='Text';
//    
//    cell.appendChild(el);

}
function RemoveRows(id)
{
  var tbl = document.getElementById(id);
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}

function ReferAddRows(id)
{
    var tbl = document.getElementById(id);
    var lastRow = tbl.rows.length;
    // if there's no header row in the table, then iteration = lastRow + 1
    var iteration = lastRow+1;
    var row = tbl.insertRow(lastRow);
  
    var eleType = new Array("input","input"); 
    var eleID = new Array("txtRecName", "txtRecEmail");
    var eleAlign= new Array("left","left");
    var eleText = new Array("Recipient Name", "Recipient Email");
    
    for(i=0;i<eleType.length;i++)
    {
    
        var cell = row.insertCell(i);
        var el = document.createElement(eleType[i]);
        
        el.name = eleID[i] + iteration;
        el.id = eleID[i] + iteration;
        
        el.style.width='234px';
        el.value=eleText[i];
        el.type='text';
        el.className='TextCss';
        
        cell.style.backgroundColor='#ffffff';
        cell.style.textAlign=eleAlign[i];
        cell.style.paddingTop='8px';
        if(i==0)
        {
            el.onblur=function()
            {
                ShowText(this,'Recipient Name')
            }
            el.onfocus=function()
            {
                HideText(this,'Recipient Name')
            }
            cell.style.width='50%';
        }                
        if(i==1)
        {
            el.onblur=function()
            {
                ShowText(this,'Recipient Email')
            }
            el.onfocus=function()
            {
                HideText(this,'Recipient Email')
            }
            cell.style.paddingLeft='4px';                
        }                
        cell.appendChild(el);
        
    }
}
function ReferRemoveRows(id)
{
  var tbl = document.getElementById(id);
  var lastRow = tbl.rows.length;
  if (lastRow > 1) tbl.deleteRow(lastRow - 1);
}


function GetValues()
{

    var CheckText = document.getElementsByTagName("input");
    var CheckLink = document.getElementsByTagName("a");
    var CheckId;

    var txtType = document.getElementById("ctl00_ContentPlaceHolder1_Hidden1");
    var txtSize = document.getElementById("ctl00_ContentPlaceHolder1_Hidden2");
    var txtPrice = document.getElementById("ctl00_ContentPlaceHolder1_Hidden3");
    var txtFlats = document.getElementById("ctl00_ContentPlaceHolder1_Hidden4");
    var linkLayout = document.getElementById("ctl00_ContentPlaceHolder1_Hidden5");
    var txtSpecification = document.getElementById("ctl00_ContentPlaceHolder1_Hidden6");
    var txtDescription = document.getElementById("ctl00_ContentPlaceHolder1_Hidden7");
    var txtSent = document.getElementById("ctl00_ContentPlaceHolder1_Hidden8");
    var txtBooking = document.getElementById("ctl00_ContentPlaceHolder1_Hidden9");
    var linkPhoto = document.getElementById("ctl00_ContentPlaceHolder1_Hidden10");
    var linkVideo = document.getElementById("ctl00_ContentPlaceHolder1_Hidden11");
    
    txtType.value="";
    txtSize.value="";
    txtPrice.value="";
    txtFlats.value="";
    linkLayout.value="";
    txtSpecification.value="";
    txtDescription.value="";
    txtSent.value="";
    txtBooking.value="";
    linkPhoto.value="";
    linkVideo.value="";
    
    for(i=0;i<CheckLink.length;i++)
    {
        CheckId = CheckLink[i].id;
        
        if(CheckId.indexOf("linkLayout")!=-1 && document.getElementById(CheckId))
            linkLayout.value+="|"+document.getElementById(CheckId).innerHTML;
            
        if(CheckId.indexOf("linkPhoto")!=-1 && document.getElementById(CheckId))
            linkPhoto.value+="|"+document.getElementById(CheckId).innerHTML;
            
        if(CheckId.indexOf("linkVideo")!=-1 && document.getElementById(CheckId))
            linkVideo.value+="|"+document.getElementById(CheckId).innerHTML;
    }
    for(i=0;i<CheckText.length;i++)
    {
        CheckId = CheckText[i].id;
        
        if(CheckId.indexOf("txtType")!=-1 && document.getElementById(CheckId))
            txtType.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtSize")!=-1 && document.getElementById(CheckId))
            txtSize.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtPrice")!=-1 && document.getElementById(CheckId))
            txtPrice.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtFlats")!=-1 && document.getElementById(CheckId))
            txtFlats.value+="|"+document.getElementById(CheckId).value; 
                                               
        if(CheckId.indexOf("txtSpecification")!=-1 && document.getElementById(CheckId))
            txtSpecification.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtDescription")!=-1 && document.getElementById(CheckId))
            txtDescription.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtSent")!=-1 && document.getElementById(CheckId))
            txtSent.value+="|"+document.getElementById(CheckId).value;
            
        if(CheckId.indexOf("txtBooking")!=-1 && document.getElementById(CheckId))
            txtBooking.value+="|"+document.getElementById(CheckId).value;
    } 

}
function SetValue(id,Ele)
{
    //alert(Ele.value);
    document.getElementById("ctl00_ContentPlaceHolder1_"+id).value=Ele.value;
    //alert(document.getElementById("ctl00_ContentPlaceHolder1_"+id).value)
}
function StoreUploadId(id)
{
    document.getElementById("HiddenUploadID").value=id;
    if(document.getElementById(id).innerHTML.toLowerCase()!="add layout")
    {
        document.getElementById("linkUpload").innerHTML=document.getElementById(id).innerHTML;
        document.getElementById("linkUpload").href=document.getElementById(id).innerHTML;
    }
    ShowLogin('divLoginTable');
}
function RestoreFile()
{
    if(document.getElementById("linkUpload").innerHTML!="")
    {
        document.getElementById(document.getElementById("HiddenUploadID").value).innerHTML=document.getElementById("linkUpload").innerHTML;
        document.getElementById("linkUpload").innerHTML="";
        document.getElementById("linkUpload").href="";
        HideLogin('divLoginTable');
    }
          
}
//----------------  End  ------------------------

function ShowHideLoc(id)
{
    var CityRow = document.getElementById("td"+id);
    var CityInner=CityRow.innerHTML;

    if(CityInner.substr(0,2).indexOf("+")!=-1)
    {
        CityRow.innerHTML=CityInner.replace(CityInner.substr(0,2)," - ");
        for(i=0;i<100;i++)
        {
            if(document.getElementById("tr"+id+"_"+i))
                document.getElementById("tr"+id+"_"+i).style.display="";
            else
                break;                
        }
    }
    else if(CityInner.substr(0,2).indexOf("-")!=-1)
    {
        CityRow.innerHTML=CityInner.replace(CityInner.substr(0,2)," + ");
        for(i=0;i<100;i++)
        {
            if(document.getElementById("tr"+id+"_"+i))
                document.getElementById("tr"+id+"_"+i).style.display="none";
            else
                break;                
        }
    }
}

function HighlightProjectBorder(Ele, index)
{
    Ele.style.border="solid 1px #7050f6";
    if(document.getElementById("linkClickView"+index))
        document.getElementById("linkClickView"+index).style.color="#00a637";
}
function OriginalProjectBorder(Ele, index)
{
    Ele.style.border="solid 1px #dcdcdc";
    if(document.getElementById("linkClickView"+index))
        document.getElementById("linkClickView"+index).style.color="#ffffff";
}
function ChangesMainTabOver()
{
    document.getElementById("linkTab").className="tabMDivO";
    document.getElementById("tabDivL").className="TabLDivO";
    document.getElementById("tabDivM").className="TabMDivO";
    document.getElementById("tabDivR").className="TabRDivO";
}
function ChangesMainTabOut()
{
    document.getElementById("linkTab").className="tabMDivN";
    document.getElementById("tabDivL").className="TabLDivN";
    document.getElementById("tabDivM").className="TabMDivN";
    document.getElementById("tabDivR").className="TabRDivN";
}
function ChangesPartnerTabOver(id)
{
    document.getElementById("linkTab"+id).className="tabPartMDivO";
    document.getElementById("tabDiv"+id+"L").className="TabPartLDivO";
    document.getElementById("tabDiv"+id+"M").className="TabPartMDivO";
    document.getElementById("tabDiv"+id+"R").className="TabPartRDivO";
}
function ChangesPartnerTabOut(id)
{
    document.getElementById("linkTab"+id).className="tabPartMDivN";
    document.getElementById("tabDiv"+id+"L").className="TabPartLDivN";
    document.getElementById("tabDiv"+id+"M").className="TabPartMDivN";
    document.getElementById("tabDiv"+id+"R").className="TabPartRDivN";
}


document.onkeydown=HandleEscKey;
function HandleEscKey(e) 
{
    var keycode;
    if (window.event) 
    {
        keycode=window.event.keyCode;
    }
    else if (e) 
    {
        keycode=e.which;
    }
//    alert(keycode)
    if(keycode==27)
    {
        if(document.getElementById("divEnquiry"))
            HideLogin('divEnquiry');
        if(document.getElementById("divEnlargeImage"))            
            HideLogin('divEnlargeImage');
    }
}


//  Search More Localities
function HideSearchMore()
{
    document.getElementById("divSearchMore").style.display="none";
}
function ShowSearchMore()
{
    document.getElementById("divSearchMore").style.display="";
}
//  Search More Localities End



//  Home Page Flash
//  ****************** Start **********************
var timerBanner

function findPos(obj)
{

	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];

}


function LoadFlash()
{
    
    var PrjFls= document.getElementById("divProjectFlash");
    if(PrjFls)
    {
        if(PrjFls.style.left=='')
        {
            //b.style.left=eval(arr[0]-6)+'px';
            PrjFls.style.top="340px";//eval(arr[1]+30)+'px';
            PrjFls.style.display="";
        }
    }
    return false;
}



function getFlashMovieObject(movieName)
{

    if (navigator.appName.indexOf("Microsoft Internet")==-1)
    {
        if (document.embeds && document.embeds[movieName])
            return document.embeds[movieName];
    }
    else if (window.document[movieName])
    {
        return window.document[movieName];
    }
    else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
    {
        return document.getElementById(movieName);
    }

}


function ShowProjectReplay()
{
    clearTimeout(timerBanner)
    timerBanner=setTimeout("ShowHiddenFlash()",10000);
    LoadFlash();
    var flashMovie=getFlashMovieObject("prjswf");
    if(document.getElementById('divProjectFlash'))
        document.getElementById('divProjectFlash').style.display = "";
    if(flashMovie)
    {        
        flashMovie.Rewind();
        flashMovie.Play();
    }
    
}


function ShowHiddenFlash() 
{ 
    if(document.getElementById('divProjectFlash'))
        document.getElementById('divProjectFlash').style.display="none";
}



//  ******************* End ***********************


//  Home Page Flash


function RedirectOtherCity()
{
    if(document.getElementById("ddlOtherCity") && document.getElementById("ddlOtherCity").value!="")
    {
        window.location=document.getElementById("ddlOtherCity").value;
    }        
}

function ChangeToEnqSel()
{
//    if(document.getElementById("divEnqUnSel"))
//        document.getElementById("divEnqUnSel").className="EnqSel";
    if(document.getElementById("linkEnqUnSel"))        
        document.getElementById("linkEnqUnSel").style.color="#1c9a49";
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTop"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTop").className="EnqTop1";
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTell"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTell").className="EnqTell1";     
}
function ChangeToEnqUnSel()
{
//    if(document.getElementById("divEnqUnSel"))
//        document.getElementById("divEnqUnSel").className="EnqUnSel";
    if(document.getElementById("linkEnqUnSel"))        
        document.getElementById("linkEnqUnSel").style.color="#000000"; 
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTop"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTop").className="EnqTop2";
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTell"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdEnqTell").className="EnqTell2";                
}
function RefineCitySearch()
{
    var LocId="";
    var Bedrooms="";
    var Bedrooms1="";
    var MinBdgt="";
    var MaxBdgt="";   
    var Cond1="";
    var PropertyCategory="";
    var CityId="";
    var SearchShowLocations="";
    var SearchShowBedrooms="";
    var strShowBdgt="";
    
    for(i=1;i<10;i++)
    {
        if(document.getElementById("chkSearchLoc"+i))
            if(document.getElementById("chkSearchLoc"+i).checked)
                if(LocId=="")
                {
                    LocId+= document.getElementById("chkSearchLoc"+i).value;
                    SearchShowLocations+=document.getElementById("chkSearchLoc"+i).name
                }
                else
                {
                    LocId+= ","+document.getElementById("chkSearchLoc"+i).value;                           
                    SearchShowLocations+=", "+document.getElementById("chkSearchLoc"+i).name    
                }                    
    }
    if(LocId!="")
        LocId=" and LocId in ("+LocId+") ";
        
    for(i=1;i<10;i++)
    {
        if(document.getElementById("chkSearchBed"+i))
            if(document.getElementById("chkSearchBed"+i).checked)
                if(Bedrooms=="")
                {
                    Bedrooms+= document.getElementById("chkSearchBed"+i).value;
                    SearchShowBedrooms+=document.getElementById("chkSearchBed"+i).name
                }                    
                else
                {
                    Bedrooms+= ","+document.getElementById("chkSearchBed"+i).value;         
                    SearchShowBedrooms+=", "+document.getElementById("chkSearchBed"+i).name                
                }                    
    }
    if(Bedrooms!="")
    {
        Cond1=" bedrooms in ("+Bedrooms+") ";
        Bedrooms=" and bedrooms in ("+Bedrooms+") ";                     
    }
//    alert(LocId+":"+Bedrooms);        
    

    if(SearchShowLocations=="")
        SearchShowLocations=" All";
    if(SearchShowBedrooms=="")
        SearchShowBedrooms=" All";        
    
    var ShowMinBdgt="";
    var ShowMaxBdgt="";

    if(document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin") && document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin").selectedIndex!=0)
    {
        MinBdgt=document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin").value
        ShowMinBdgt=document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin").options[document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin").selectedIndex].text;
    }        
    if(document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax") && document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax").selectedIndex!=0)
    {
        MaxBdgt=document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax").value   
        ShowMaxBdgt=document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax").options[document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax").selectedIndex].text;
    }
        
    if(eval(MinBdgt)>=eval(MaxBdgt))
    {
        alert("Please select proper range");
        return;
    }
    
    if (MinBdgt != "" && MaxBdgt == "")
        strShowBdgt = "More than " + ShowMinBdgt;
    else if (MinBdgt == "" && MaxBdgt != "")
        strShowBdgt = "Less than " + ShowMaxBdgt;
    else if (MinBdgt != "" && MaxBdgt != "")
        strShowBdgt = ShowMinBdgt + " - " + ShowMaxBdgt;
    else
        strShowBdgt = "All";
            
    if(MinBdgt!="")
    {
        if(Cond1!="")
            Cond1+=" and price>="+MinBdgt;
        else
            Cond1+=" price>="+MinBdgt;
        MinBdgt=" and minprice>="+MinBdgt;
    }    
        
    if(MaxBdgt!="")
    {
        if(Cond1!="")
            Cond1+=" and price<="+MaxBdgt;
        else
            Cond1+=" price<="+MaxBdgt;
        MaxBdgt=" and maxprice<="+MaxBdgt;
    }                     
    
    if(Cond1!="")
        Cond1=": where "+Cond1;
            
    if(document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyCategory") && document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyCategory").value!="")            
        PropertyCategory=document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyCategory").value;
    if(document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId") && document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId").value!="")            
        CityId=document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId").value;
    
    if(PropertyCategory!="")
        PropertyCategory=" PropertyCategory="+PropertyCategory;
    else        
        PropertyCategory=" PropertyCategory=1";            

    if(CityId!="")
        CityId=" and cm.CityId="+CityId;                  
            
    dropdowncontent.ajaxconnect("MasterPages/UniProAjax.aspx?Condition= where "+PropertyCategory+" and pm.Status=1 and bm.Status=1 "+CityId+" "+LocId+" "+Bedrooms+" "+MinBdgt+" "+MaxBdgt+" "+Cond1+" &PageNo=1&PageSize=6","ctl00_ContentPlaceHolder1_tdDisPaging1|ctl00_ContentPlaceHolder1_tdDisPaging2|ctl00_ContentPlaceHolder1_tdProjects");
    
    if(document.getElementById("spanShowLoc"))
        document.getElementById("spanShowLoc").innerHTML=SearchShowLocations;
    if(document.getElementById("spanShowBdgt").innerHTML)
        document.getElementById("spanShowBdgt").innerHTML=strShowBdgt;
    if(document.getElementById("spanShowBed").innerHTML)
        document.getElementById("spanShowBed").innerHTML=SearchShowBedrooms;
    
}
function ResetRefineCitySearch()
{
    var PropertyCategory="";
    var CityId="";
    for(i=1;i<10;i++)
        if(document.getElementById("chkSearchLoc"+i))
            document.getElementById("chkSearchLoc"+i).checked=false;
    for(i=1;i<10;i++)
        if(document.getElementById("chkSearchBed"+i))
            document.getElementById("chkSearchBed"+i).checked=false;  
    if(document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin"))
        document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMin").selectedIndex=0
    if(document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax"))
        document.getElementById("ctl00_ContentPlaceHolder1_ddlBdgtMax").selectedIndex=0  
        
        
    if(document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyCategory") && document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyCategory").value!="")            
        PropertyCategory=document.getElementById("ctl00_ContentPlaceHolder1_HiddenPropertyCategory").value;
    if(document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId") && document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId").value!="")            
        CityId=document.getElementById("ctl00_ContentPlaceHolder1_HiddenCityId").value;
    
    if(PropertyCategory!="")
        PropertyCategory=" PropertyCategory="+PropertyCategory;
    else        
        PropertyCategory=" PropertyCategory=1";            

    if(CityId!="")
        CityId=" and cm.CityId="+CityId;                  
            
    dropdowncontent.ajaxconnect("MasterPages/UniProAjax.aspx?Condition= where "+PropertyCategory+" and pm.Status=1 and bm.Status=1 "+CityId+" &PageNo=1&PageSize=6","ctl00_ContentPlaceHolder1_tdDisPaging1|ctl00_ContentPlaceHolder1_tdDisPaging2|ctl00_ContentPlaceHolder1_tdProjects");
    
    if(document.getElementById("spanShowLoc"))
        document.getElementById("spanShowLoc").innerHTML="All";
    if(document.getElementById("spanShowBdgt"))
        document.getElementById("spanShowBdgt").innerHTML="All";
    if(document.getElementById("spanShowBed"))
        document.getElementById("spanShowBed").innerHTML="All";        
                  
}
function ShowHideRefineKeyword(showid, hideid)
{   
    if(document.getElementById("tr"+hideid))
        document.getElementById("tr"+hideid).style.display="none";  
    if(document.getElementById("tr"+showid))
        document.getElementById("tr"+showid).style.display="";                       
    if(document.getElementById("td"+showid))
    {
        document.getElementById("td"+showid).style.backgroundColor="#ffffff"
        document.getElementById("td"+showid).style.color="#00a539"
    }     
    if(document.getElementById("td"+hideid))
    {
        document.getElementById("td"+hideid).style.backgroundColor="#00a539"
        document.getElementById("td"+hideid).style.color="#ffffff"
    }    
    if(document.getElementById("tr"+showid+"Search"))
        document.getElementById("tr"+showid+"Search").style.display="";
    if(document.getElementById("tr"+hideid+"Search"))
        document.getElementById("tr"+hideid+"Search").style.display="none";                  
}
function ShowKeyWordSearch()
{
    var Condition="";
    if(document.getElementById("HiddenKeySearch"))
        Condition=document.getElementById("HiddenKeySearch").value;
        
    dropdowncontent.ajaxconnect("MasterPages/UniProAjax.aspx?Condition= "+Condition+" &PageNo=1&PageSize=6","ctl00_ContentPlaceHolder1_tdDisPaging1|ctl00_ContentPlaceHolder1_tdDisPaging2|ctl00_ContentPlaceHolder1_tdProjects");
    
    var SearchVal="";
    if(document.getElementById("ctl00_ContentPlaceHolder1_txtCompany").value.toLowerCase()=="name of builder or project")
        SearchVal="All";
    else
        SearchVal=document.getElementById("ctl00_ContentPlaceHolder1_txtCompany").value;               
    
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdKeywordSearchResults"))       
        document.getElementById("ctl00_ContentPlaceHolder1_tdKeywordSearchResults").innerHTML="Showing results for: <span class='SearchLabel' style='padding-left: 15px;'>"+SearchVal+"</span>";
}
function ShowHideProspect(Ele, id)
{
    if(Ele.innerHTML.indexOf("+")!=-1)
    {
        Ele.innerHTML="[- Details]";
        if(document.getElementById("trProspect"+id))
            document.getElementById("trProspect"+id).style.display="";
    }
    else
    {
        Ele.innerHTML="[+ Details]";
        if(document.getElementById("trProspect"+id))
            document.getElementById("trProspect"+id).style.display="none";
    }
}