﻿// JScript File
// JScript File
/**** Ajax javascript *****/
/**** Start *****/
var xmlHttp
var AJEle
var AJValue
var AJCatId
var subCat

function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
    }
    return xmlHttp;
}
/**** End *****/
/**** Ajax javascript *****/
var ListUtil = new Object();
function PPLoadPropertyType(val)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?CatId="+val;
    xmlHttp.onreadystatechange=PPSetPropertyType;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function PPSetPropertyType() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        var ElePropertyType;
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlType"))
            ElePropertyType=document.getElementById("ctl00_ContentPlaceHolder1_ddlType");
        else if(document.getElementById("ddlType"))
            ElePropertyType=document.getElementById("ddlType");
                        
        ElePropertyType.length=0;
        
        ListUtil.add(ElePropertyType, "", "Select Property Type");
        
        if(strdata!="")
        {
            var strPropertyType=strdata.split('|');
            for(i=0;i<strPropertyType.length;i++)
            {
                ListUtil.add(ElePropertyType, strPropertyType[i].split('~')[0], strPropertyType[i].split('~')[1]);
            }
        }
        ElePropertyType.value="";

    }
}
function PPLoadCityMaster(val)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?StateId="+val;
    xmlHttp.onreadystatechange=PPSetCityMaster;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function PPSetCityMaster() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        var EleCity;
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlCity"))
            EleCity=document.getElementById("ctl00_ContentPlaceHolder1_ddlCity");
        else if(document.getElementById("ddlCity"))
            EleCity=document.getElementById("ddlCity");
        
        var EleLocation;
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation"))
            EleLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation");
        else if(document.getElementById("ddlLocation"))
            EleLocation=document.getElementById("ddlLocation");
        var txtLocation=document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");   
        EleLocation.length=0;
        ListUtil.add(EleLocation, "", "Select Location");
        txtLocation.style.display="none";
        EleLocation.style.display="";
                
        var EleSubLocation;                        
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlSubLocation"))
            EleSubLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlSubLocation");
        else if(document.getElementById("ddlSubLocation"))
            EleSubLocation=document.getElementById("ddlSubLocation");                
        EleSubLocation.length=1;                
                        
        EleCity.length=0;
        ListUtil.add(EleCity, "", "Select City");
        
        if(strdata!="")
        {
            var strCity=strdata.split('|');
            for(i=0;i<strCity.length;i++)
            {
                ListUtil.add(EleCity, strCity[i].split('~')[0], strCity[i].split('~')[1]);
            }
            ListUtil.add(EleCity, "-1", "Other");
        }
        EleCity.value="";

    }
}
function PPLoadLocationMaster(StateId, CityId)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?StateId="+StateId+"&CityId="+CityId;
    xmlHttp.onreadystatechange=PPSetLocationMaster;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function PPSetLocationMaster() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        var EleLocation;
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation"))
            EleLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlLocation");
        else if(document.getElementById("ddlLocation"))
            EleLocation=document.getElementById("ddlLocation");
            
        var txtLocation=document.getElementById("ctl00_ContentPlaceHolder1_txtLocation");   
                  
        EleLocation.length=0;
        ListUtil.add(EleLocation, "", "Select Location");
        
        var EleSubLocation;                        
        if(document.getElementById("ctl00_ContentPlaceHolder1_ddlSubLocation"))
            EleSubLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlSubLocation");
        else if(document.getElementById("ddlSubLocation"))
            EleSubLocation=document.getElementById("ddlSubLocation");                
        EleSubLocation.length=1;  
        
        if(strdata!="")
        {
            var strLocation=strdata.split('|');
            for(i=0;i<strLocation.length;i++)
            {
                ListUtil.add(EleLocation, strLocation[i].split('~')[0], strLocation[i].split('~')[1]);
            }
            ListUtil.add(EleLocation, "-1", "Other");
        }
        else
        {
            EleLocation.style.display="none";
            txtLocation.style.display="";
        }
        EleLocation.value="";

    }
}

function PPLoadSubLocationMaster(StateId, CityId, LocId)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?StateId="+StateId+"&CityId="+CityId+"&LocId="+LocId;
    xmlHttp.onreadystatechange=function()
    { 
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            var EleLocation;
            if(document.getElementById("ctl00_ContentPlaceHolder1_ddlSubLocation"))
                EleLocation=document.getElementById("ctl00_ContentPlaceHolder1_ddlSubLocation");
            else if(document.getElementById("ddlSubLocation"))
                EleLocation=document.getElementById("ddlSubLocation");
   
            EleLocation.length=0;
            ListUtil.add(EleLocation, "", "Select Sub-Location");
            
            if(strdata!="")
            {
                var strLocation=strdata.split('|');
                for(i=0;i<strLocation.length;i++)
                {
                    ListUtil.add(EleLocation, strLocation[i].split('~')[0], strLocation[i].split('~')[1]);
                }
            }
            EleLocation.value="";

        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function PPLoadBudgetRange(Ele, UserType, val)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();
    AJEle=Ele;
    AJValue=val;
    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?UserType="+UserType;
    xmlHttp.onreadystatechange=PPSetBudgetRange;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function PPSetBudgetRange() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        var Ele=AJEle;
                  
        Ele.length=0;
        ListUtil.add(Ele, "", "Select Price Range");
        
        if(strdata!="")
        {
            var strBudget=strdata.split('|');
            for(i=0;i<strBudget.length;i++)
            {
                ListUtil.add(Ele, strBudget[i].split('~')[0], strBudget[i].split('~')[1]);
            }
            ListUtil.add(Ele, "-1", "On Request");
        }

        Ele.value=AJValue;

    }
}

function DoesEmailRegistered(Ele)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();
    AJEle=Ele;
    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?Email="+Ele.value;
    xmlHttp.onreadystatechange=VerifyEmail;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function VerifyEmail() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        
        if(strdata=="True")
        {
            alert("Email address already registered with Unicon Property");
            AJEle.value="";
            AJEle.focus();
            return false;
        }
        else
            return false;
            
       

    }
}
function GetRegisteredDetails(Ele)
{  
    //alert(val)
    xmlHttp=GetXmlHttpObject();
    AJEle=Ele
    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="../MasterPages/AjaxPropertyNew.aspx?RID="+Ele.value;
    xmlHttp.onreadystatechange=DisRegisteredDetails;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function DisRegisteredDetails() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        
        if(strdata=="")
        {
            alert("Entered Registration ID does not exist");
            AJEle.value="";
            AJEle.focus();
        }
        else
        {
            var ddlTitle=document.getElementById("ctl00_ContentPlaceHolder1_ddlTitle")
            var txtFName=document.getElementById("ctl00_ContentPlaceHolder1_txtFName")
            var txtMName=document.getElementById("ctl00_ContentPlaceHolder1_txtMName")
            var txtLName=document.getElementById("ctl00_ContentPlaceHolder1_txtLName")
            var txtMobile=document.getElementById("ctl00_ContentPlaceHolder1_txtMobile")
            var txtLandline=document.getElementById("ctl00_ContentPlaceHolder1_txtLandline")
            var txtEmail=document.getElementById("ctl00_ContentPlaceHolder1_txtEmail")
            var txtIndAddress=document.getElementById("ctl00_ContentPlaceHolder1_txtIndAddress")
            
            ddlTitle.value=strdata.split("|")[0];
            txtFName.value=strdata.split("|")[1];
            txtMName.value=strdata.split("|")[2];
            txtLName.value=strdata.split("|")[3];
            txtMobile.value=strdata.split("|")[4];
            txtLandline.value=strdata.split("|")[5];
            txtEmail.value=strdata.split("|")[6];
            txtIndAddress.value=strdata.split("|")[7];

            
            ddlTitle.disabled=true;
            txtFName.disabled=true;
            txtMName.disabled=true;
            txtLName.disabled=true;
            txtMobile.disabled=true;
            txtLandline.disabled=true;
            txtEmail.disabled=true;
            txtIndAddress.disabled=true;
            
            
        }
            
       

    }
}
function SavePostRequirement()
{  
    //alert("psm")

        
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var txtPostName = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostName").value;
    var txtPostEmail = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostEmail").value;
    var txtPostPhone = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostPhone").value;
    var txtPostCity = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtCity").value;
    var txtPostQuery = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostQuery").value;
    var chkHomeLoan = document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_chkHomeLoan").checked==true?"1":"0";
    
    var questmarkindex=txtPostQuery.split('?').length-1;
    var ampmarkindex=txtPostQuery.split('&').length-1;
    for(i=0;i<questmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("&","n")
      
    var questmarkindex=txtPostCity.split('?').length-1;
    var ampmarkindex=txtPostCity.split('&').length-1;  
    for(i=0;i<questmarkindex;i++)
        txtPostCity=txtPostCity.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostCity=txtPostCity.replace("&","n")        
        

    var url="MasterPages/UniProAjax.aspx?PostReqForm=True&PostReqID="+document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPostReqID").value+"&PageType="+document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPageType").value+"&EnqName="+txtPostName+"&EnqEmail="+txtPostEmail+"&EnqPhone="+txtPostPhone+"&EnqCity="+txtPostCity+"&EnqQuery="+txtPostQuery+"&EnqHomeLoan="+chkHomeLoan;
    xmlHttp.onreadystatechange=function()
    { 
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            //document.getElementById("tdThanksMessage").innerHTML=strdata;
            if(strdata!="")
            {
                var strGoogle="";
                //Google Lead Code
                //Start
//                strGoogle="<script type=\"text/javascript\">";
//                strGoogle+="/* <![CDATA[ */";
//                strGoogle+="var google_conversion_id = 1001182262;";
//                strGoogle+="var google_conversion_language = \"en\";";
//                strGoogle+="var google_conversion_format = \"2\";";
//                strGoogle+="var google_conversion_color = \"ffffff\";";
//                strGoogle+="var google_conversion_label = \"XlU1CNqc5wEQtqiz3QM\";";
//                strGoogle+="var google_conversion_value = 0;";
//                strGoogle+="/* ]]> */";
//                strGoogle+="</script>";
//                strGoogle+="<script type=\"text/javascript\"";
//                strGoogle+="src=\"http://www.googleadservices.com/pagead/conversion.js\">";
//                strGoogle+="</script>";
//                strGoogle+="<noscript><div style=\"display:inline;\"><img height=\"1\" width=\"1\" style=\"border-style:none;\" alt=\"\" src=\"http://www.googleadservices.com/pagead/conversion/1001182262/?label=XlU1CNqc5wEQtqiz3QM&amp;guid=ON&amp;script=0\"/></div></noscript>";
                strGoogle+="<iframe src=\"EnquiryForm.html\" border='0' style='display:none;'></iframe>";
                //End
            
                //alert(strdata);
                setEnqCookie("UniconEnqPostName",document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostName").value,365);
                setEnqCookie("UniconEnqPostEmail",document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostEmail").value,365);
                setEnqCookie("UniconEnqPostPhone",document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostPhone").value,365);
                setEnqCookie("UniconEnqPostCity",document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtCity").value,365);
                document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostQuery").value="";
                document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_chkHomeLoan").checked=true;
                SetExistingPostData();
                ShowModelWindow("divEnquiry","PostReqThanksMessage",document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPostReqID").value ,strdata.split("~")[0]+strGoogle)
                pageTracker._trackPageview("/EnquiryForm.html");
                
                var sessionId=strdata.split("~")[1];
                var storedSession= getEnqCookie("UniconSokSes");
                
                if(storedSession!=sessionId)
                {
//                    alert(storedSession+":"+sessionId);
                    setEnqCookie("UniconSokSes",sessionId,1);
                    //SOKRATI LEAD PIXEL
                    //Start
                    var paramList = {}; 
                    var PageUrl=window.location.href;
                    PageUrl=PageUrl.split("/")[PageUrl.split("/").length-1];
                    
                    var sokType="";
                    var sokCity="";
                    var sokLoc="";
                    var sokBuilder="";
                    var sokProject="";
                    var sokItemId="";
                    var sokSplitVal=PageUrl.split("-");
                    
                    if(sokSplitVal.length==1)
                    {
                        sokItemId=PageUrl!=""?PageUrl:"Default.aspx";
                        
                        paramList['project_type'] = sokType; 
                        paramList['project_detail'] = sokProject; 
                        paramList['builder_detail'] = sokBuilder; 
                        paramList['city'] = sokCity; 
                        paramList['page_type'] = sokItemId; 
                    }
                    else if(sokSplitVal.length==2)
                    {
                        if(PageUrl.toLowerCase().indexOf("projects")==-1 && (PageUrl.toLowerCase().indexOf("residential")!=-1 || PageUrl.toLowerCase().indexOf("commercial")!=-1))
                        {
                            sokType=sokSplitVal[0];
                            sokCity=(sokSplitVal[1]).split(".")[0];
                            sokItemId=sokType +" "+ sokCity;
                            
                            paramList['project_type'] = sokType; 
                            paramList['project_detail'] = sokProject; 
                            paramList['builder_detail'] = sokBuilder; 
                            paramList['city'] = sokCity; 
                            paramList['page_type'] = 'City Projects'; 
                        }
                        else if(PageUrl.toLowerCase().indexOf("projects")!=-1 && (PageUrl.toLowerCase().indexOf("residential")!=-1 || PageUrl.toLowerCase().indexOf("commercial")!=-1))
                        {
                            sokType=sokSplitVal[0];
                            sokItemId=sokType;
                            
                            paramList['project_type'] = sokType; 
                            paramList['project_detail'] = sokProject; 
                            paramList['builder_detail'] = sokBuilder; 
                            paramList['city'] = sokCity; 
                            paramList['page_type'] = sokType+' Projects'; 
                        }
                        else if(PageUrl.toLowerCase().indexOf("residential")==-1 && PageUrl.toLowerCase().indexOf("commercial")==-1)
                        {
                            sokBuilder=(sokSplitVal[1]).split(".")[0];
                            sokItemId=sokBuilder;
                            
                            paramList['project_type'] = sokType; 
                            paramList['project_detail'] = sokProject; 
                            paramList['builder_detail'] = sokBuilder; 
                            paramList['city'] = sokCity; 
                            paramList['page_type'] = 'Builder Details'; 
                        }
                    }
                    else if(sokSplitVal.length==4)
                    {
                        sokType="Residential";
                        sokCity=sokSplitVal[0];
                        sokLoc=sokSplitVal[1];
                        sokBuilder=sokSplitVal[2];
                        sokProject=(sokSplitVal[3]).split(".")[0];
                        sokItemId=sokType+" "+sokBuilder+" "+sokProject+" "+sokLoc+" "+sokCity;
                        
                        paramList['project_type'] = sokType; 
                        paramList['project_detail'] = sokProject; 
                        paramList['builder_detail'] = sokBuilder; 
                        paramList['city'] = sokCity; 
                        paramList['page_type'] = 'Residential Project Details'; 

                    }
                    else if(sokSplitVal.length==5)
                    {
                        sokType="Commercial";
                        sokCity=sokSplitVal[1];
                        sokLoc=sokSplitVal[2];
                        sokBuilder=sokSplitVal[3];
                        sokProject=(sokSplitVal[4]).split(".")[0];
                        sokItemId=sokType+" "+sokBuilder+" "+sokProject+" "+sokLoc+" "+sokCity;
                        
                        paramList['project_type'] = sokType; 
                        paramList['project_detail'] = sokProject; 
                        paramList['builder_detail'] = sokBuilder; 
                        paramList['city'] = sokCity; 
                        paramList['page_type'] = 'Commercial Project Details'; 
                    }
                    if(sokItemId!="")
                    {
                        try {sokrati.trackParams('link', '1' , paramList);} 
                        catch(err) {}
                    }
                    //End
                }
                if(document.getElementById("GoogleLead"))
                    document.getElementById("GoogleLead").value="True";
                
//                if(document.getElementById("divEnquiry"))
//                    document.getElementById("divEnquiry").innerHTML=strdata;
            }     
            
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function SavePostLeads()
{  
    //alert("psm")

        
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var txtPostName = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostName").value;
    var txtPostEmail = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostEmail").value;
    var txtPostPhone = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostPhone").value;
    var txtPostCity = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtCity").value;
    var txtPostQuery = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostQuery").value;
    var chkHomeLoan = document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_chkHomeLoan").checked==true?"1":"0";
    
    var questmarkindex=txtPostQuery.split('?').length-1;
    var ampmarkindex=txtPostQuery.split('&').length-1;
    for(i=0;i<questmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("&","n")
      
    var questmarkindex=txtPostCity.split('?').length-1;
    var ampmarkindex=txtPostCity.split('&').length-1;  
    for(i=0;i<questmarkindex;i++)
        txtPostCity=txtPostCity.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostCity=txtPostCity.replace("&","n")        
        

    var url="MasterPages/UniProAjax.aspx?PostLeadsForm=True&PostReqID="+document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_HiddenPostReqID").value+"&PageType="+document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_HiddenPageType").value+"&EnqName="+txtPostName+"&EnqEmail="+txtPostEmail+"&EnqPhone="+txtPostPhone+"&EnqCity="+txtPostCity+"&EnqQuery="+txtPostQuery+"&EnqHomeLoan="+chkHomeLoan;
    xmlHttp.onreadystatechange=function()
    { 
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            //document.getElementById("tdThanksMessage").innerHTML=strdata;
            if(strdata!="")
            {
                //alert(strdata);
                document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostQuery").value="";
                document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_chkHomeLoan").checked=true;
                SetExistingPostData();
                ShowModelWindow("divEnquiry","PostReqThanksMessage",document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_HiddenPostReqID").value ,strdata)
                pageTracker._trackPageview("/EnquiryForm.html");
//                if(document.getElementById("divEnquiry"))
//                    document.getElementById("divEnquiry").innerHTML=strdata;
            }     
            
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function SaveResalePostLeads()
{  
    //alert("psm")

        
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    var txtPostName = document.getElementById("txtPostName").value;
    var txtPostEmail = document.getElementById("txtPostEmail").value;
    var txtPostPhone = document.getElementById("txtPostPhone").value;
    var txtPostCity = document.getElementById("txtCity").value;
    var txtPostQuery = document.getElementById("txtPostQuery").value;
    var chkHomeLoan = document.getElementById("chkHomeLoan").checked==true?"1":"0";
    
    var questmarkindex=txtPostQuery.split('?').length-1;
    var ampmarkindex=txtPostQuery.split('&').length-1;
    for(i=0;i<questmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("&","n")
      
    var questmarkindex=txtPostCity.split('?').length-1;
    var ampmarkindex=txtPostCity.split('&').length-1;  
    for(i=0;i<questmarkindex;i++)
        txtPostCity=txtPostCity.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostCity=txtPostCity.replace("&","n")        
        

    var url="MasterPages/UniProAjax.aspx?PostLeadsForm=True&PostReqID="+document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_HiddenPostReqID").value+"&PageType="+document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_HiddenPageType").value+"&EnqName="+txtPostName+"&EnqEmail="+txtPostEmail+"&EnqPhone="+txtPostPhone+"&EnqCity="+txtPostCity+"&EnqQuery="+txtPostQuery+"&EnqHomeLoan="+chkHomeLoan;
    xmlHttp.onreadystatechange=function()
    { 
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            //document.getElementById("tdThanksMessage").innerHTML=strdata;
            if(strdata!="")
            {
                //alert(strdata);
                document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_txtPostQuery").value="";
                document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_chkHomeLoan").checked=true;
                SetExistingPostData();
                ShowModelWindow("divEnquiry","PostReqThanksMessage",document.getElementById("ctl00_ContentPlaceHolder1_PostYourLeads1_HiddenPostReqID").value ,strdata)
                pageTracker._trackPageview("/EnquiryForm.html");
//                if(document.getElementById("divEnquiry"))
//                    document.getElementById("divEnquiry").innerHTML=strdata;
            }     
            
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function SaveEnquiryNow()
{  
    //alert("psm")

        
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    
    var txtPostName = document.getElementById("txtPostName").value
    var txtPostEmail = document.getElementById("txtPostEmail").value
    var txtPostPhone = document.getElementById("txtPostPhone").value
    var txtPostCity = document.getElementById("txtPostCity").value
    var txtPostQuery = document.getElementById("txtPostQuery").value
    var chkHomeLoan = document.getElementById("chkHomeLoan").checked==true?"1":"0";
    
    var questmarkindex=txtPostQuery.split('?').length-1;
    var ampmarkindex=txtPostQuery.split('&').length-1;
    for(i=0;i<questmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostQuery=txtPostQuery.replace("&","n")
      
    var questmarkindex=txtPostCity.split('?').length-1;
    var ampmarkindex=txtPostCity.split('&').length-1;  
    for(i=0;i<questmarkindex;i++)
        txtPostCity=txtPostCity.replace("?",".")
    for(i=0;i<ampmarkindex;i++)
        txtPostCity=txtPostCity.replace("&","n")        
        

    var url="MasterPages/UniProAjax.aspx?EnqPID="+document.getElementById("EnqPID").value+"&EnqPName="+document.getElementById("EnqPName").value+"&EnqName="+txtPostName+"&EnqEmail="+txtPostEmail+"&EnqPhone="+txtPostPhone+"&EnqCity="+txtPostCity+"&EnqQuery="+txtPostQuery+"&EnqHomeLoan="+chkHomeLoan;
    xmlHttp.onreadystatechange=SaveEnquiryNowThanks;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function SaveEnquiryNowThanks() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        //document.getElementById("tdThanksMessage").innerHTML=strdata;
        if(strdata!="")
        {
            //alert(strdata);
            if(strdata.split("~")[1]=="")
            {
                setEnqCookie("UniconEnqPostName",document.getElementById("txtPostName").value,365);
                setEnqCookie("UniconEnqPostEmail",document.getElementById("txtPostEmail").value,365);
                setEnqCookie("UniconEnqPostPhone",document.getElementById("txtPostPhone").value,365);
                setEnqCookie("UniconEnqPostCity",document.getElementById("txtPostCity").value,365);
            }
            document.getElementById("txtPostQuery").value="";
            document.getElementById("chkHomeLoan").checked=true;
                          
            pageTracker._trackPageview("/EnquiryForm.html");
            
            var strGoogle="";
            
            if(strdata.split("~")[1]=="")
            {
                SetExistingPostData();
                
                //Google Lead Code
                //Start
//                strGoogle="<script type=\"text/javascript\">";
//                strGoogle+="/* <![CDATA[ */";
//                strGoogle+="var google_conversion_id = 1001182262;";
//                strGoogle+="var google_conversion_language = \"en\";";
//                strGoogle+="var google_conversion_format = \"2\";";
//                strGoogle+="var google_conversion_color = \"ffffff\";";
//                strGoogle+="var google_conversion_label = \"XlU1CNqc5wEQtqiz3QM\";";
//                strGoogle+="var google_conversion_value = 0;";
//                strGoogle+="/* ]]> */";
//                strGoogle+="</script>";
//                strGoogle+="<script type=\"text/javascript\"";
//                strGoogle+="src=\"http://www.googleadservices.com/pagead/conversion.js\">";
//                strGoogle+="</script>";
//                strGoogle+="<noscript><div style=\"display:inline;\"><img height=\"1\" width=\"1\" style=\"border-style:none;\" alt=\"\" src=\"http://www.googleadservices.com/pagead/conversion/1001182262/?label=XlU1CNqc5wEQtqiz3QM&amp;guid=ON&amp;script=0\"/></div></noscript>";
                strGoogle+="<iframe src=\"EnquiryForm.html\" border='0' style='display:none;'></iframe>";
                //End
                
                var sessionId=strdata.split("~")[2];
                var storedSession= getEnqCookie("UniconSokSes");
                
                if(storedSession!=sessionId)
                {
//                    alert(storedSession+":"+sessionId);
                    setEnqCookie("UniconSokSes",sessionId,1);
                    //SOKRATI LEAD PIXEL
                    //Start
                    var paramList = {}; 
                    var PageUrl=window.location.href;
                    PageUrl=PageUrl.split("/")[PageUrl.split("/").length-1];
                    
                    var sokType="";
                    var sokCity="";
                    var sokLoc="";
                    var sokBuilder="";
                    var sokProject="";
                    var sokItemId="";
                    var sokSplitVal=PageUrl.split("-");
                    
                    if(sokSplitVal.length==1)
                    {
                        sokItemId=PageUrl!=""?PageUrl:"Default.aspx";
                        
                        paramList['project_type'] = sokType; 
                        paramList['project_detail'] = sokProject; 
                        paramList['builder_detail'] = sokBuilder; 
                        paramList['city'] = sokCity; 
                        paramList['page_type'] = sokItemId; 
                    }
                    else if(sokSplitVal.length==2)
                    {
                        if(PageUrl.toLowerCase().indexOf("projects")==-1 && (PageUrl.toLowerCase().indexOf("residential")!=-1 || PageUrl.toLowerCase().indexOf("commercial")!=-1))
                        {
                            sokType=sokSplitVal[0];
                            sokCity=(sokSplitVal[1]).split(".")[0];
                            sokItemId=sokType +" "+ sokCity;
                            
                            paramList['project_type'] = sokType; 
                            paramList['project_detail'] = sokProject; 
                            paramList['builder_detail'] = sokBuilder; 
                            paramList['city'] = sokCity; 
                            paramList['page_type'] = 'City Projects'; 
                        }
                        else if(PageUrl.toLowerCase().indexOf("projects")!=-1 && (PageUrl.toLowerCase().indexOf("residential")!=-1 || PageUrl.toLowerCase().indexOf("commercial")!=-1))
                        {
                            sokType=sokSplitVal[0];
                            sokItemId=sokType;
                            
                            paramList['project_type'] = sokType; 
                            paramList['project_detail'] = sokProject; 
                            paramList['builder_detail'] = sokBuilder; 
                            paramList['city'] = sokCity; 
                            paramList['page_type'] = sokType+' Projects'; 
                        }
                        else if(PageUrl.toLowerCase().indexOf("residential")==-1 && PageUrl.toLowerCase().indexOf("commercial")==-1)
                        {
                            sokBuilder=(sokSplitVal[1]).split(".")[0];
                            sokItemId=sokBuilder;
                            
                            paramList['project_type'] = sokType; 
                            paramList['project_detail'] = sokProject; 
                            paramList['builder_detail'] = sokBuilder; 
                            paramList['city'] = sokCity; 
                            paramList['page_type'] = 'Builder Details'; 
                        }
                    }
                    else if(sokSplitVal.length==4)
                    {
                        sokType="Residential";
                        sokCity=sokSplitVal[0];
                        sokLoc=sokSplitVal[1];
                        sokBuilder=sokSplitVal[2];
                        sokProject=(sokSplitVal[3]).split(".")[0];
                        sokItemId=sokType+" "+sokBuilder+" "+sokProject+" "+sokLoc+" "+sokCity;
                        
                        paramList['project_type'] = sokType; 
                        paramList['project_detail'] = sokProject; 
                        paramList['builder_detail'] = sokBuilder; 
                        paramList['city'] = sokCity; 
                        paramList['page_type'] = 'Residential Project Details'; 

                    }
                    else if(sokSplitVal.length==5)
                    {
                        sokType="Commercial";
                        sokCity=sokSplitVal[1];
                        sokLoc=sokSplitVal[2];
                        sokBuilder=sokSplitVal[3];
                        sokProject=(sokSplitVal[4]).split(".")[0];
                        sokItemId=sokType+" "+sokBuilder+" "+sokProject+" "+sokLoc+" "+sokCity;
                        
                        paramList['project_type'] = sokType; 
                        paramList['project_detail'] = sokProject; 
                        paramList['builder_detail'] = sokBuilder; 
                        paramList['city'] = sokCity; 
                        paramList['page_type'] = 'Commercial Project Details'; 
                    }
                    if(sokItemId!="")
                    {
                        try {sokrati.trackParams('link', '1' , paramList);} 
                        catch(err) {}
                    }
                    //End
                }
                if(document.getElementById("GoogleLead"))
                    document.getElementById("GoogleLead").value="True";
            }  
            
            if(document.getElementById("trEnqForm"))
                document.getElementById("trEnqForm").style.display="none";
            if(document.getElementById("tdPostData"))
                document.getElementById("tdPostData").innerHTML=strdata.split("~")[0]+strGoogle;  
        }     
//        document.getElementById("txtPostName").value="";
//        document.getElementById("txtPostEmail").value="";
//        document.getElementById("txtPostPhone").value="";
//        document.getElementById("txtPostCity").value="";
        
    }
}
function SetExistingPostData()
{
    if(document.getElementById("txtPostName"))
        document.getElementById("txtPostName").value=getEnqCookie("UniconEnqPostName");
    if(document.getElementById("txtPostEmail"))
        document.getElementById("txtPostEmail").value=getEnqCookie("UniconEnqPostEmail");
    if(document.getElementById("txtPostPhone"))
        document.getElementById("txtPostPhone").value=getEnqCookie("UniconEnqPostPhone");
    if(document.getElementById("txtPostCity"))
        document.getElementById("txtPostCity").value=getEnqCookie("UniconEnqPostCity"); 
    
    if(document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostName"))
        document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostName").value=getEnqCookie("UniconEnqPostName");
    if(document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostEmail"))
        document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostEmail").value=getEnqCookie("UniconEnqPostEmail");
    if(document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostPhone"))
        document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtPostPhone").value=getEnqCookie("UniconEnqPostPhone");
    if(document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtCity"))
        document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_txtCity").value=getEnqCookie("UniconEnqPostCity");
    
    if(document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPostThanks") && document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPostThanks").value!="")
    {
        alert(document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPostThanks").value);
        document.getElementById("ctl00_ContentPlaceHolder1_PostYourRequirement1_HiddenPostThanks").value="";
    }
    //HideLogin("divEnquiry");     
            
                                         
}
function SetSenderDetails()
{
    if(document.getElementById("txtName") && getEnqCookie("UniconEnqPostName")!="")
    {
        document.getElementById("txtName").value=getEnqCookie("UniconEnqPostName");
        document.getElementById("txtName").className="Text";
    }        
    if(document.getElementById("txtEmail") && getEnqCookie("UniconEnqPostEmail")!="")
    {
        document.getElementById("txtEmail").value=getEnqCookie("UniconEnqPostEmail");
        document.getElementById("txtEmail").className="Text";
    }
}
function setEnqCookie(c_name,value,expiredays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getEnqCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    {
    c_start=c_start + c_name.length+1;
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    }
  }
return "";
}
function deleteEnqCookie( name ) {
if ( getEnqCookie( name ) ) document.cookie = name + "=" +
";expires=Tue, 30-Mar-1982 00:00:01 GMT";
}
function ProjectSearchData()
{  
  
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    
    var SearchZoneId = document.getElementById("SearchZoneId").value
    var SearchMinBdgt = document.getElementById("SearchMinBdgt").value
    var SearchMaxBdgt = document.getElementById("SearchMaxBdgt").value
    var SearchBedrooms = document.getElementById("SearchBedrooms").value
    var SearchLocId = document.getElementById("SearchLocId").value
    var SearchPType = document.getElementById("SearchPType").value
    

    var url="MasterPages/UniProAjax.aspx?IsSearch=True&SearchZoneId="+SearchZoneId+"&SearchMinBdgt="+SearchMinBdgt+"&SearchMaxBdgt="+SearchMaxBdgt+"&SearchBedrooms="+SearchBedrooms+"&SearchLocId="+SearchLocId+"&SearchPType="+SearchPType;
    document.getElementById("ctl00_ContentPlaceHolder1_tdData").innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=ShowProjectSearchData;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function ShowProjectSearchData() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)

        if(strdata.indexOf("~")!=-1)
        {
            document.getElementById("ctl00_ContentPlaceHolder1_tdData").innerHTML=strdata.split('~')[0];
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenLat").value=strdata.split('~').length>1?strdata.split('~')[1]:"";
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenLng").value=strdata.split('~').length>2?strdata.split('~')[2]:"";
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenDesc").value=strdata.split('~').length>3?strdata.split('~')[3]:"";
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenAddress").value=strdata.split('~').length>4?strdata.split('~')[4]:"";
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenAddDesc").value=strdata.split('~').length>5?strdata.split('~')[5]:"";
            
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenSrNo").value=strdata.split('~').length>6?strdata.split('~')[6]:"";
            
            var mapSrNo=strdata.split('~').length>6?strdata.split('~')[6]:"";
            
            if(map)
            map.closeInfoWindow();
            for(a in marker)
		    {
			    if(!isNaN(a))
			    marker[a].hide();
		    }
		    if(mapSrNo!="")
		    {
		        for(i=0;i<mapSrNo.split("|").length;i++)
		        {
		            var mapsrno=mapSrNo.split("|")[i];
		            if(marker[mapsrno])
		                marker[mapsrno].show();
                    map.setCenter(point[mapsrno], zoomby);		                
		        }
		    }
        }
        else
        {
            document.getElementById("ctl00_ContentPlaceHolder1_tdData").innerHTML="No Data Found...";
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenLat").value=""
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenLng").value=""
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenDesc").value=""
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenAddress").value=""
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenAddDesc").value=""
            
//            document.getElementById("ctl00_ContentPlaceHolder1_HiddenSrNo").value=""
        }
        
        document.getElementById("spanShowType").innerHTML=document.getElementById("SearchShowType").value;
        document.getElementById("spanShowLoc").innerHTML=document.getElementById("SearchShowLocations").value;
        document.getElementById("spanShowBed").innerHTML=document.getElementById("SearchShowBedrooms").value;
        //loadEarth('map');
    }
}

function SetBannerClick(id, BannerSrNo)
{  
    //alert(val)

    xmlHttp=GetXmlHttpObject();
    AJEle=id;
    
    var LinkId=id;
    var ImgId=LinkId.replace("link","img");
    
    var BannerSrc = document.getElementById(ImgId).src
    var BannerUrl = document.getElementById(LinkId).getAttribute("rev")
    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="MasterPages/UniProAjax.aspx?BannerSrNo="+BannerSrNo+"&BannerSrc="+BannerSrc+"&BannerUrl="+BannerUrl;
    xmlHttp.onreadystatechange=ShowBannerClick;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function ShowBannerClick() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)
        
        if(strdata=="True")
        {
            var LinkId=AJEle;
            window.location=document.getElementById(LinkId).getAttribute("rev");
        }
        
    }
}

function ProjectSearchDetails(SrNo, Index)
{  

    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    AJValue=SrNo;
    var SearchSrNo=SrNo;
    var SearchMinBdgt = document.getElementById("SearchMinBdgt").value
    var SearchMaxBdgt = document.getElementById("SearchMaxBdgt").value
    var SearchBedrooms = document.getElementById("SearchBedrooms").value
    var SearchPType = document.getElementById("SearchPType").value
    

    var url="MasterPages/UniProAjax.aspx?SearchSrNo="+SearchSrNo+"&SearchIndex="+Index+"&SearchMinBdgt="+SearchMinBdgt+"&SearchMaxBdgt="+SearchMaxBdgt+"&SearchBedrooms="+SearchBedrooms+"&SearchPType="+SearchPType;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=ShowProjectSearchMapDetails;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ShowProjectSearchMapDetails() 
{ 
    if (xmlHttp.readyState==4)
    { 
        var strdata = xmlHttp.responseText;
        //alert(strdata)

        if(strdata!="")
        {
            if(strdata.split("~").length>0 && marker[AJValue])
                marker[AJValue].openInfoWindowHtml(strdata.split("~")[0]);
            if(strdata.split("~").length>1 && document.getElementById("tdSearch"+AJValue))
                document.getElementById("tdSearch"+AJValue).innerHTML=strdata.split("~")[1];
        }
    }
}
function ShowEnquiryForm(id, strMessage, pid, LoanType)
{  

    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    document.getElementById(id).innerHTML="<img src='images/loadingAnimation.gif' alt=''/>";
    
    var url="MasterPages/UniProAjax.aspx?EnquiryForm=True&LoanType="+LoanType;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)

            if(strdata!="")
            {
                if(document.getElementById(id))
                    document.getElementById(id).innerHTML=strdata.split("~")[0];
                if(document.getElementById("tdPostData"))
                {
                    if(strdata.split("~")[1]=="")
                        document.getElementById("tdPostData").innerHTML="Thank you for expressing your interest in <span class='PropHead'>" + strMessage + "</span>.<br/>Please fill in the form below and our property advisor will get in touch with you.";
                    else
                        document.getElementById("tdPostData").innerHTML=strdata.split("~")[1];                                            
                }
                if(document.getElementById("EnqPID"))
                    document.getElementById("EnqPID").value=pid;
                if(document.getElementById("EnqPName"))
                    document.getElementById("EnqPName").value=strMessage; 
                if(document.getElementById("tdThanksMessage"))                                  
                    document.getElementById("tdThanksMessage").innerHTML="";
                if(strdata.split("~")[1]=="")    
                    SetExistingPostData();                    
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ShowNextInBuilderScroller(BuilderSrNo)
{  

    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdBuilder"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdBuilder").innerHTML="<div id='container'><div id='scroller' style='padding-top:15px;'><img src='images/loadingAnimation.gif' alt=''/></div></div>";
    
    var url="MasterPages/UniProAjax.aspx?BuilderSrNo="+BuilderSrNo;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(document.getElementById("divDisMessage"))
                document.getElementById("divDisMessage").style.display="none";
            if(strdata!="")
            {
                if(document.getElementById("ctl00_ContentPlaceHolder1_tdBuilder"))
                    document.getElementById("ctl00_ContentPlaceHolder1_tdBuilder").innerHTML=strdata;                   
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ShowNextInProjectScroller(ProjectCond, ProjectSrNo, disId, DomainPath)
{  

    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById("ctl00_ContentPlaceHolder1_"+disId))
        document.getElementById("ctl00_ContentPlaceHolder1_"+disId).innerHTML="<div id='container1'><div id='scroller1' style='padding-top:90px;'><img src='"+DomainPath+"images/loadingAnimation.gif' alt=''/></div></div>";
    
    var url=DomainPath+"MasterPages/UniProAjax.aspx?ProjectCond="+ProjectCond+"&ProjectSrNo="+ProjectSrNo+"&DisId="+disId;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(document.getElementById("divDisMessage"))
                document.getElementById("divDisMessage").style.display="none";
            if(strdata!="")
            {
                if(document.getElementById("ctl00_ContentPlaceHolder1_"+disId))
                    document.getElementById("ctl00_ContentPlaceHolder1_"+disId).innerHTML=strdata;                   
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ShowNextInCommProjectScroller(ProjectCond, ProjectSrNo, disId, DomainPath)
{  

    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById("ctl00_ContentPlaceHolder1_"+disId))
        document.getElementById("ctl00_ContentPlaceHolder1_"+disId).innerHTML="<div id='container1'><div id='scroller1' style='padding-top:90px;'><img src='"+DomainPath+"images/loadingAnimation.gif' alt=''/></div></div>";
    
    var url=DomainPath+"MasterPages/UniProAjax.aspx?CommProjectCond="+ProjectCond+"&CommProjectSrNo="+ProjectSrNo+"&CommDisId="+disId;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(document.getElementById("divDisMessage"))
                document.getElementById("divDisMessage").style.display="none";
            if(strdata!="")
            {
                if(document.getElementById("ctl00_ContentPlaceHolder1_"+disId))
                    document.getElementById("ctl00_ContentPlaceHolder1_"+disId).innerHTML=strdata;                   
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function SendReferenceFriend(RecName, RecEmail, SenderName, SenderEmail, SenderComment, Url, DomainPath)
{  
    xmlHttp=GetXmlHttpObject();

    
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById("tdSendStatus"))
        document.getElementById("tdSendStatus").innerHTML="Please wait while process finished...<br/>Please do not click <b>close</b> link or press <b>Esc</b> key or click out-side window.<br/><br/><img src='"+DomainPath+"images/loadingAnimation.gif' alt=''/>";
    
    var url=DomainPath+"MasterPages/UniProAjax.aspx?RecName="+RecName+"&RecEmail="+RecEmail+"&SenderName="+SenderName+"&SenderEmail="+SenderEmail+"&SenderComment="+SenderComment+"&Url="+Url;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(strdata!="")
            {
                if(document.getElementById("tdSendStatus"))
                    document.getElementById("tdSendStatus").innerHTML=strdata;                   
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
    
    return false;

}

function GetKeySearchId(Ele, val)
{  
    if(document.getElementById("HiddenKeySearch"))
        document.getElementById("HiddenKeySearch").value="";
        
    if((Ele.value.toLowerCase()!=val.toLowerCase() && Ele.value=="")||(Ele.value.toLowerCase()==val.toLowerCase() && Ele.value!=""))
    {
        Ele.value=val;
        Ele.className="TextCss";   
         
        var PropertyCategory="";
        var CityId="";
        
        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;  
        
        document.getElementById("HiddenKeySearch").value=" where "+PropertyCategory+" and pm.Status=1 and bm.Status=1 "+CityId+" ";
                   
    }
    else
    {
        document.getElementById("btnKeySearch").disabled=true;
        var SearchVal=Ele.value;
        
        for(i=0;i<SearchVal.split("&").length;i++)
        {
            SearchVal=SearchVal.replace("&","_n_");
        }
        
        xmlHttp=GetXmlHttpObject();
        
        if (xmlHttp==null)
        {
            alert ("Your browser does not support AJAX!");
            return;
        } 

        var url="MasterPages/UniProAjax.aspx?SearchVal="+SearchVal;
        //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
        xmlHttp.onreadystatechange=function()
        {
            if (xmlHttp.readyState==4)
            { 
                var strdata = xmlHttp.responseText;
                //alert(strdata)
                if(strdata!="")
                {
                    if(document.getElementById("HiddenKeySearch"))
                        document.getElementById("HiddenKeySearch").value=strdata; 
                    document.getElementById("btnKeySearch").disabled=false; 
                    document.getElementById("btnKeySearch").focus();                                                      
                }
            }
        };
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }
}
function ShowKeyWordSearch()
{
    var KeywordSearchId="";
    var KeywordSearchValue="";
    if(document.getElementById("ctl00_ContentPlaceHolder1_KeywordSearchDropDown1_HiddenKeywordSearchId"))
        KeywordSearchId = document.getElementById("ctl00_ContentPlaceHolder1_KeywordSearchDropDown1_HiddenKeywordSearchId").value;
    if(document.getElementById("ctl00_ContentPlaceHolder1_KeywordSearchDropDown1_txtKeywordSearch"))
        KeywordSearchValue = document.getElementById("ctl00_ContentPlaceHolder1_KeywordSearchDropDown1_txtKeywordSearch").value;

                
        
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdPaging1"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdPaging1").style.display="";
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdPaging2"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdPaging2").style.display="";     
            
    if(KeywordSearchId!="")
    { 
        xmlHttp=GetXmlHttpObject();
        
        if (xmlHttp==null)
        {
            alert ("Your browser does not support AJAX!");
            return;
        } 

        var url="MasterPages/UniProAjax.aspx?KeywordSearchId="+KeywordSearchId+"&KeywordSearchValue="+KeywordSearchValue;
        //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
        xmlHttp.onreadystatechange=function()
        {
            if (xmlHttp.readyState==4)
            { 
                var strdata = xmlHttp.responseText;
                //alert(strdata)
                if(strdata!="")
                {
                    if(document.getElementById("HiddenKeySearch"))
                        document.getElementById("HiddenKeySearch").value=strdata;         
                  
//                    deleteEnqCookie("UniProRefineSearch");    
//                    deleteEnqCookie("UniProKeySearch");                                                 
                    ShowKeyWordSearchResult();                        
                }
            }
        };
        xmlHttp.open("GET",url,true);
        xmlHttp.send(null);
    }   
    else if(getEnqCookie("UniProKeySearch")!="")
    {
        ShowKeyWordSearchResult();    
    }        
    else
    {
        if(document.getElementById("ctl00_ContentPlaceHolder1_tdKeywordSearchResults"))       
            document.getElementById("ctl00_ContentPlaceHolder1_tdKeywordSearchResults").innerHTML="Showing results for: <span style='padding-left:15px; color:#00a539; font-size:12px; font-weight:bold;'>No results found. Try modifying your search query or call us at 09999 56 1111.</span>";

        if(document.getElementById("ctl00_ContentPlaceHolder1_tdProjects"))       
            document.getElementById("ctl00_ContentPlaceHolder1_tdProjects").innerHTML="";                        

        if(document.getElementById("ctl00_ContentPlaceHolder1_tdPaging1"))
            document.getElementById("ctl00_ContentPlaceHolder1_tdPaging1").style.display="none";
        if(document.getElementById("ctl00_ContentPlaceHolder1_tdPaging2"))
            document.getElementById("ctl00_ContentPlaceHolder1_tdPaging2").style.display="none";                        
    }
}
function ShowPartnerLogin(PartnerLogin)
{  
    xmlHttp=GetXmlHttpObject();

    //alert(PartnerLogin)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").innerHTML="<div style='width:100%; text-align:center; padding-top:200px;'><img src='images/loadingAnimation.gif' alt=''/></div>";
    
    var url="MasterPages/UniProAjax.aspx?PartnerLogin="+PartnerLogin;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(strdata!="")
            {
                if(document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerTab"))
                    document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerTab").innerHTML=strdata.split("~")[0];
                if(document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData"))
                {
                    document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").innerHTML=strdata.split("~")[1];                   
                    if(PartnerLogin=="1")
                        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").style.backgroundImage="url(images/PartnerLoginBk.gif)";
                    else if(PartnerLogin=="2" || PartnerLogin=="5")
                        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").style.backgroundImage="url(images/HOwItsWorlBk.jpg)";
                    else if(PartnerLogin=="3")
                        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").style.backgroundImage="url(images/RegPartBk.gif)";         
                    else if(PartnerLogin=="4")
                        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").style.backgroundImage="url(images/EmpLoginBk.gif)";         
                    else if(PartnerLogin=="6")
                        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").style.backgroundImage="url(images/RegEmpBk.gif)";                                                               
                }
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ExportValuedToExcel(PartnerLead)
{
    var SelectedIds = document.getElementById("ctl00_ContentPlaceHolder1_SelectedIds");
    var HiddenLeadStatus = document.getElementById("ctl00_ContentPlaceHolder1_HiddenLeadStatus");
    if(SelectedIds.value=="")
    {
        alert("Please select atleast one record");
        return false;
    }
    else
    {
        HiddenLeadStatus.value=PartnerLead;
        __doPostBack1('ctl00$ContentPlaceHolder1$btnExcel','');
    }
}
function GetValuedExportSrNo(Ele, SrNo)
{
    var HiddenExcelSrNo = document.getElementById("ctl00_ContentPlaceHolder1_HiddenExcelSrNo");
    if(Ele.checked && HiddenExcelSrNo.value.indexOf(":"+SrNo+":")==-1)
    {
        HiddenExcelSrNo.value+=":"+SrNo+":"; 
    }
    else if(!Ele.checked && HiddenExcelSrNo.value.indexOf(":"+SrNo+":")!=-1)
    {
        HiddenExcelSrNo.value = HiddenExcelSrNo.value.replace(":"+SrNo+":","");
    }
    
//    alert(HiddenExcelSrNo.value)
}
function ShowPartnerLeadPageSize(Ele, PartnerLead)
{
    ShowPartnerLead(PartnerLead,1,Ele.value);
}
function ShowPartnerLead(PartnerLead,PageNo,PageSize)
{  
    document.getElementById("ctl00_ContentPlaceHolder1_HiddenExcelSrNo").value="";
    
    var ddlValuedSearch = document.getElementById("ddlValuedSearch");
    var txtValuedSearch = document.getElementById("txtValuedSearch");
    var ValuedCondId="";
    var ValuedCondition="";
    
    if(ddlValuedSearch)
        ValuedCondId=ddlValuedSearch.value
    if(txtValuedSearch)
        ValuedCondition=txtValuedSearch.value        
    
    xmlHttp=GetXmlHttpObject();

//    alert(PartnerLead+":"+PageNo+":"+PageSize)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData"))
        document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").innerHTML="<div style='width:100%; text-align:center; padding-top:20px;'><img src='images/loadingAnimation.gif' alt=''/></div>";
    
    var url="MasterPages/UniProAjax.aspx?PartnerLead="+PartnerLead+"&PageNo="+PageNo+"&PageSize="+PageSize+"&ValuedCondId="+ValuedCondId+"&ValuedCondition="+ValuedCondition;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
//            alert(strdata)
            if(strdata!="")
            {
                var data=strdata.split("~")[1];
                if(data.indexOf("Session Expired")!=-1)
                {
                    alert("Session Expired")
                    window.location="Index.aspx";
                    return;
                }
                if(document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerTab"))
                    document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerTab").innerHTML=strdata.split("~")[0];
                if(document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData"))
                    document.getElementById("ctl00_ContentPlaceHolder1_tdPartnerData").innerHTML=strdata.split("~")[1];                   
                
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ShowProspectDetails(DivId, ProspectId)
{  
    xmlHttp=GetXmlHttpObject();

    //alert(DivId)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById(DivId))
        document.getElementById(DivId).innerHTML="<div style='width:100%; text-align:center; padding-top:20px;'><img src='images/loadingAnimation.gif' alt=''/></div>";
    
    var url="MasterPages/UniProAjax.aspx?ProspectId="+ProspectId;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(strdata!="")
            {
                if(document.getElementById(DivId))
                    document.getElementById(DivId).innerHTML=strdata;
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function ShowSignOut(DivId)
{  
    xmlHttp=GetXmlHttpObject();

    //alert(DivId)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 
    if(document.getElementById(DivId))
        document.getElementById(DivId).innerHTML="<div style='width:100%; text-align:center; padding-top:20px;'><img src='images/loadingAnimation.gif' alt=''/></div>";
    
    var url="MasterPages/UniProAjax.aspx?SignOut=True";
//    alert(url);
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(strdata!="")
            {
                if(document.getElementById(DivId))
                    document.getElementById(DivId).innerHTML=strdata;
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}

function PartnerRegistration(MACode, PAN, Password, Contact, Email, EntryBy)
{
    xmlHttp=GetXmlHttpObject();

    //alert(DivId)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="MasterPages/UniProAjax.aspx?MACode="+MACode+"&PAN="+PAN+"&Password="+Password+"&Contact="+Contact+"&Email="+Email+"&EntryBy="+EntryBy;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            //alert(strdata)
            if(strdata!="")
            {
                alert(strdata);
                if(strdata.toLowerCase().indexOf("success")!=-1)
                {
                    deleteEnqCookie("UniconEnqPostName");
                    deleteEnqCookie("UniconEnqPostEmail");
                    deleteEnqCookie("UniconEnqPostPhone");
                    deleteEnqCookie("UniconEnqPostCity");
                    window.location="MyLeads.aspx";
                }   
                else
                {
                    ShowPartnerLogin('3');            
                }                 
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function PartnerLogin(PartUserId, PartPassword)
{
    xmlHttp=GetXmlHttpObject();

    //alert(DivId)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="MasterPages/UniProAjax.aspx?PartUserId="+PartUserId+"&PartPassword="+PartPassword;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
//            alert(strdata)
            if(strdata!="")
            {
                alert(strdata);
            }
            else
            {
                deleteEnqCookie("UniconEnqPostName");
                deleteEnqCookie("UniconEnqPostEmail");
                deleteEnqCookie("UniconEnqPostPhone");
                deleteEnqCookie("UniconEnqPostCity");
                window.location="MyLeads.aspx";
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function EmployeeRegistration(EmpCode, EmpDOB, Password, Contact, Email, EntryBy)
{
    xmlHttp=GetXmlHttpObject();

    //alert(DivId)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="MasterPages/UniProAjax.aspx?EmpCode="+EmpCode+"&EmpDOB="+EmpDOB+"&Password="+Password+"&Contact="+Contact+"&Email="+Email+"&EntryBy="+EntryBy;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
//            alert(strdata)
            if(strdata!="")
            {
                alert(strdata);
                if(strdata.toLowerCase().indexOf("success")!=-1)
                {
                    deleteEnqCookie("UniconEnqPostName");
                    deleteEnqCookie("UniconEnqPostEmail");
                    deleteEnqCookie("UniconEnqPostPhone");
                    deleteEnqCookie("UniconEnqPostCity");
                    window.location="MyLeads.aspx";
                }  
                else
                {
                    ShowPartnerLogin('6');            
                }
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

function EmployeeLogin(EmpUserId, EmpPassword)
{
    xmlHttp=GetXmlHttpObject();

//    alert(EmpUserId)
    if (xmlHttp==null)
    {
        alert ("Your browser does not support AJAX!");
        return;
    } 

    var url="MasterPages/UniProAjax.aspx?EmpUserId="+EmpUserId+"&EmpPassword="+EmpPassword;
    //document.getElementById("tdSearch"+SrNo).innerHTML="Loading content. Please wait..."
//    alert(url)
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4)
        { 
            var strdata = xmlHttp.responseText;
            
            if(strdata!="")
            {
                alert(strdata);
            }
            else
            {
                deleteEnqCookie("UniconEnqPostName");
                deleteEnqCookie("UniconEnqPostEmail");
                deleteEnqCookie("UniconEnqPostPhone");
                deleteEnqCookie("UniconEnqPostCity");
                window.location="MyLeads.aspx";
            }
        }
    };
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}
