﻿
$(document).ready(function () {

    $("textarea[id$='txtMessage']").keyup(function () {
        var len = $.trim(this.value).length;
        if (len >= 2000) {
            $(this).val($.trim(this.value).substring(0, 2000))
            $('#spanLeftcharacters').text(0);
        }
        else {
            $('#spanLeftcharacters').text(2000 - len);
        }
    });
    $("textarea[id$='txtMessage']").keypress(function () {
        var len = $.trim(this.value).length;
        if (len > 2000)
            return false;
        else
            return true;
    });
    $("textarea[id$='txtAddress']").keyup(function () {
        var len = $.trim(this.value).length;
        if (len >= 500) {
            $(this).val($.trim(this.value).substring(0, 500))
        }

    });
    $("textarea[id$='txtAddress']").keypress(function () {
        var len = $.trim(this.value).length;
        if (len > 500)
            return false;
        else
            return true;
    });

//    $(".deleteconfirm").each(function () {
//        $(this).click(function () {
//            var TextToShow = $(this).attr("alt")
//            return confirm('Are you sure you want to delete this ' + TextToShow + ' ?');
//        });
//    });

     $("textarea[id$='txtFeedQuestion']").keypress(function () {
        var len = $.trim(this.value).length;
        if (len > 5000)
            return false;
        else
            return true;
    });
    $("textarea[id$='txtFeedQuestion']").keyup(function () {
        var len = $.trim(this.value).length;
        if (len >= 4999) {
            $(this).val($.trim(this.value).substring(0, 4999))
        }

    });
  
    SetHeightAdvancedSearch()
    $("span#ECSearch").click(function () {
        if ($(this).text() == '[-]') {
            $(this).text('[+]');
            $("input:hidden[id$='hdnMaintainEC']").val('[+]')
            $("input:hidden[id$='hdbMaxSize']").val($("#searchOptionsbg").height())
            $("#searchOptionsbg").hide();
        } else {
            $(this).text('[-]');
            $("input:hidden[id$='hdnMaintainEC']").val('[-]')
            SetHeightAdvancedSearch($("input:hidden[id$='hdbMaxSize']").val())
            $("#searchOptionsbg").show();
        }
        return false;
    });

    if ($.trim($("input:hidden[id$='hdnMaintainEC']").val())) {
        var SpanText = $.trim($("input:hidden[id$='hdnMaintainEC']").val());
        $("span#ECSearch").text(SpanText);
        if (SpanText == '[-]') {
            $("#searchOptionsbg").show();
            SetHeightAdvancedSearch($("input:hidden[id$='hdbMaxSize']").val())
        }
        else if (SpanText == '[+]') {
            $("#searchOptionsbg").hide();
        }
    }

    $(".asktheowner").each(function () {
        if ($(this).find("input:hidden[id$='hid_PropStatusID']").val() == 1) {
            $(this).find("img").attr("alt", "sold");
            $(this).find("img").attr("title", "sold");
            $(this).find("a").text("Sold");
            $(this).find("a").css("cursor", "normal");
            $(this).attr("onclick", "");
            $(this).next().find("img").remove();
            $(this).next().find("a").text("");
            $(this).next().find("a").css("cursor", "normal");
            $(this).next().attr("onclick", "");
        }
    });

    $(".asktheowner").each(function () {
        if ($.trim($(this).find("span[id$='spanPropertyStatus']").text()) == 1) {
            $(this).find("img").attr("alt", "sold");
            $(this).find("img").attr("title", "sold");
            $(this).find("a").text("Sold");
            $(this).find("a").css("cursor", "normal");
            $(this).attr("onclick", "");
            $(this).next().find("img").remove();
            $(this).next().find("a").text("");
            $(this).next().find("a").css("cursor", "normal");
            $(this).next().attr("onclick", "");
        }
    });

    if ($("input:hidden[id$='hid_PropInfoStatusID']").val() == 1) {
        //$(".asktheownerpropinfo").find("img").remove();
        $(".asktheownerpropinfo").next().find("a").text("Sold");
        //$(this).find("img").attr("alt","sold");
        //$(this).find("img").attr("title","sold");
        $(".asktheownerpropinfo").next().find("a").css("cursor", "normal");
        $(".asktheownerpropinfo").next().find("a").css("color", "#ff0000");
        $(".asktheownerpropinfo").next().find("a").css("font-weight", "bold");
        $(".asktheowner").attr("onclick", "");
        $(".asktheownerpropinfo").parents("span[id$='SpanContacttheowner']").prev().empty()
    }

    var tmpTxt, txtLen, tmpRestxt;
    $(".personalweburl").each(function () {
        tmpTxt = $.trim($(this).text());
        txtLen = tmpTxt.length;
        
        tmpRestxt = "";
        if (parseInt(txtLen) > 35) {
            tmpRestxt = tmpTxt.substr(0, 34) + ' ' + tmpTxt.substr(34, (parseInt(txtLen) - 34))
        }
        else
        {
			tmpRestxt = tmpTxt;
        }
        $(this).text(tmpRestxt);
    });
    
    
    /*************FeedBack***********/
     try
  {
            var feedbackTab = {
                
                speed:300,
                containerWidth:$('.feedback-panel').outerWidth(),
                containerHeight:$('.feedback-panel').outerHeight(),
                tabWidth:$('.feedback-tab').outerWidth(),
                
                init:function(){
                    $('.feedback-panel').css('height',feedbackTab.containerHeight + 'px');
                    
                    $('a.feedback-tab').click(function(event){

                        if ($('.feedback-panel').hasClass('open')) {
                            $('.feedback-panel').animate({left:'-' + feedbackTab.containerWidth}, feedbackTab.speed)
                            .removeClass('open');
                             $('#form-wrap').show();
                             $('#Results').hide();
                             $("input:text[id$='txtFeedName']").val('')
                            $("input:text[id$='txtFeedEmail']").val('')
                            $("input:text[id$='txtFeedNumbr']").val('')
                            $("textarea[id$='txtFeedQuestion']").val('')
                            $("input:checkbox[id$='chkNewLetter']").attr("checked",false);
                        } else {
                            $('.feedback-panel').animate({left:'0'},  feedbackTab.speed)
                            .addClass('open');
                             $('#form-wrap').show();
                              $('#Results').hide();
                             $("input:text[id$='txtFeedName']").val('')
                            $("input:text[id$='txtFeedEmail']").val('')
                            $("input:text[id$='txtFeedNumbr']").val('')
                            $("textarea[id$='txtFeedQuestion']").val('')
                            $("input:checkbox[id$='chkNewLetter']").attr("checked",false);
                        }
                        event.preventDefault();
                    });
                }
            };
            
            feedbackTab.init();
         }
         catch(err)
         {
         
         }
            $(".button").click(function() {  
           
                
                var blnvalidate=Page_ClientValidate("FeedBackGroup");
                if(blnvalidate==false)
                {
                        if($.trim($("input:text[id$='txtFeedName']").val()).length==0)
                        {
                            $("input:text[id$='txtFeedName']").focus();
                            return false;
                        }
                        
                         if($.trim($("input:text[id$='txtFeedEmail']").val()).length==0)
                        {
                            $("input:text[id$='txtFeedEmail']").focus();
                             return false;
                        }
                        else
                        {
                             $("input:text[id$='txtFeedEmail']").focus();
                             return false;
                        }
                        
                        
                }
                else
                {
                       
                        var response_message = "Thank you for your Feedback !"
                        var Data=ajaxFunctions.SendFeedBack($.trim($("input:text[id$='txtFeedName']").val()),$.trim($("input:text[id$='txtFeedEmail']").val()),$.trim($("input:text[id$='txtFeedNumbr']").val()),
                                                            $.trim($("textarea[id$='txtFeedQuestion']").val()),$("input:checkbox[id$='chkNewLetter']").attr("checked")).value;
                                                      
                            $('#form-wrap').hide();
                            $('#Results').show();
                            $('#Results').html("<p>" + response_message +"</p>")
                            $('#Results').hide().fadeIn(500).animate({opacity: 1.0}, 1000).fadeIn(0, function(){
                                $('.feedback-panel').animate({left:'-' + feedbackTab.containerWidth}, feedbackTab.speed)
                                    .removeClass('open');
                            })
                
                }
                
                return false;
            });
    /*************FeedBack*********/
    
    
});
function SetHeightAdvancedSearch(heightValue)
{
   var Max;
   if(heightValue !=null && heightValue!="undefined" && $.trim(heightValue).length>0)
   {
     Max=heightValue
   }
   else
   {
     var heightwithIn1=$("#withIn1").height();
     var heightwithIn2=$("#withIn2").height();
     var heightwithIn3=$("#withIn3").height();
     var heightwithIn4=$("#withIn4").height();
     var heightwithIn5=$("#withIn5").height();
     var heightwithIn6=$("#withIn6").height();    
     Max=Math.max(parseInt(heightwithIn1),parseInt(heightwithIn2),parseInt(heightwithIn3),parseInt(heightwithIn4),parseInt(heightwithIn5),parseInt(heightwithIn6));
   }

   $("#withIn1").height(parseInt(Max)+10);
   $("#withIn2").height(parseInt(Max)+10);
   $("#withIn3").height(parseInt(Max)+10);
   $("#withIn4").height(parseInt(Max)+10);
   $("#withIn5").height(parseInt(Max)+10);
   $("#withIn6").height(parseInt(Max)+10);
   $("#dvBottomLine").height(parseInt(Max)+25);
   $("#dvBottomLine").show();
}
function ValidateControl(validationGroupName)
{
   $("div[id$='dvServerMessage']").hide()
   var blnvalidate=Page_ClientValidate(validationGroupName);
   if(blnvalidate==false)
      $("#dvValiadtionSummary").show();
   else
      $("#dvValiadtionSummary").hide();
}

function SetModalPopup(PropertyID,IsLoggedin,PageType,pageindex)
{
    
   if(IsLoggedin=="True")
   {
		var IsOnlineAgent =ajaxFunctions.GetAgentProperty(PropertyID).value;
       $("div#dvAskTheOwner").modal();
       $("div#dvButtonSend").click(function(){
       
        if($.trim($("textarea[id$='txtMessage']").val()).length>0)
        {
            var Results= ajaxFunctions.AskTheOwner($("span[id$='lblUserName']").text(),$.trim($("span#spanEmail").text()),$("textarea[id$='txtMessage']").val(),PropertyID,$("#chkIsViewProperty").attr("checked"),$("input:text[id$='txtReferralCode']").val(),IsOnlineAgent,$("input:text[id$='txtPhno']").val(),$("input:text[id$='txtAddress']").val(),$("#ctl00_Content1_ddlpropertyAdd option:selected").text(),$("#chkViewMoreDetails").attr("checked")).value;
			if(Results == 0)
			{
			    $("textarea[id$='txtMessage']").val('');
			    $("input:text[id$='txtPhno']").val('');
			    $("input:text[id$='txtAddress']").val('');
			    $("input:text[id$='txtReferralCode']").val('');
			    $("select[id$='ddlpropertyAdd']").val(0);
			    $("input:checkbox[id$='chkViewMoreDetails']").attr("checked","");
			    $("input:checkbox[id$='chkIsViewProperty']").attr("checked","s");
			    $("div#dvMessage").html("Your message has been Sent.");
			    ajaxFunctions.SetNothingPropertyIDForAskTheOwner();
			}
			else
			{
				$("div#dvMessage").html("This referral code does not exist for this property.");
			}
		} 
		else
		{
			$("div#dvMessage").html("enter your comments.")
		}
      });

      $("div#dvGetPhonenumber").click(function(){
        var PhoneResults= ajaxFunctions.GetOwnerPhoneNumber($("span[id$='lblUserName']").text(),$.trim($("span#spanEmail").text()),PropertyID,IsOnlineAgent).value;
        $("#dvShowOwnerPhoneNumer").html(PhoneResults); 
      });
  }
  else
  {
    if(parseInt(PageType)==2)
    {
        ajaxFunctions.SetPropertyIDForAskTheOwner(PropertyID);
        location.href="Registration.aspx?Type=2";
    }
    else if(parseInt(PageType)==1)
    {
       var idStr="ctl00_Content1_";
       var slidminPrice = document.getElementById("minPrice").value;
       var slidmaxPrice = document.getElementById("maxPrice").value;
       var slidminbed = document.getElementById("minBed").value;
       var slidminbath = document.getElementById("minBath").value;
       var szLocation = $("input:text[id$='szLocation']").val();
		var chkRefRewards =1;
         var chkRefRewards = '0';
		if(document.getElementById("chkRefRewards").checked==true)
		{
			chkRefRewards = '1';
		}
		var chkRefRewards = document.getElementById(idStr+"hid_chkRefRewards").value;
		ajaxFunctions.SetAsktheOwnerSearchForSale(1, slidminPrice, slidmaxPrice, slidminbed, slidminbath, szLocation, PropertyID, pageindex, chkRefRewards, $("input:hidden[id$='hid_chkSold']").val(), $("input:hidden[id$='hdnSearchedWord']").val(), $("input:hidden[id$='hdnCrossPostback']").val());
       location.href="Registration.aspx?Type=1";
    }
    else if(parseInt(PageType)==3)
    {
       var idStr="ctl00_Content1_";
       var slidminPrice = $("select[id$='ddlPriceMin']").val()
        var slidmaxPrice = $("select[id$='ddlPriceMax']").val()
        var slidminbed = $("select[id$='ddlminBeds']").val()
        var slidminbath = $("select[id$='ddlMinBaths']").val()
       var szLocation = $("input:text[id$='szLocation']").val();
       
       var lstMiles = document.getElementById(idStr+"hid_lstMiles").value;
       var propertyTypeVal = document.getElementById(idStr+"hid_propertyTypeVal").value;
       var propertyStatusVal = document.getElementById(idStr+"hid_propertyStatusVal").value;
       var EcoFriendlyfeatures = document.getElementById(idStr+"hid_EcoFriendlyfeatures").value;
       var HeatingOption = document.getElementById(idStr+"hid_HeatingOption").value;
       var DisablityAndAdapted = document.getElementById(idStr+"hid_DisablityAndAdapted").value;
       
       var chkOpenhouse = document.getElementById(idStr+"hid_chkOpenhouse").value;
       var chkSold = document.getElementById(idStr+"hid_chkSold").value;
		var chkRefRewards = document.getElementById(idStr+"hid_chkRefRewards").value;
       var advancesearchFlag = document.getElementById(idStr+"hid_advancesearchFlag").value;
       ajaxFunctions.SetAsktheOwnerAdvanceSearch(1, slidminPrice, slidmaxPrice, slidminbed, slidminbath, szLocation, lstMiles, propertyTypeVal, propertyStatusVal, EcoFriendlyfeatures, HeatingOption, DisablityAndAdapted, chkOpenhouse, chkSold, advancesearchFlag, PropertyID, pageindex, chkRefRewards, $("input:hidden[id$='hdnSearch']").val(), $("input:hidden[id$='hdnPropertyOwner']").val());
       location.href="Registration.aspx?Type=3";
    }
  }
  $("input:text[id$='txtReferralCode']").focus();
}

function closePopup()
{
  $("a.modalCloseImg").trigger("click");
  ajaxFunctions.SetNothingPropertyIDForAskTheOwner();
}

function ShowModelAutomatically()
{
   $("span[id$='SpanContacttheowner']").trigger("click");
}

function CollapseMe()
{
   $("span#ECSearch").text('[+]');
   $("input:hidden[id$='hdbMaxSize']").val($("#searchOptionsbg").height())
   $("#searchOptionsbg").hide();
   $("input:hidden[id$='hdnMaintainEC']").val('[+]')
}

function DispalyActiveContent(objid,objtablsClicked)
{
    initialize();
     SetActive(objtablsClicked);
    $("div.propertyInfo").each(function(){
      $(this).hide();
    });
    $("#"+objid).show();
}

function SetActive(strtabsClicked)
{
    switch (strtabsClicked){
    case "1":
        document.images.ps.src = "images/property_sale_btn/Summary_selected.jpg"
    break;
    case "2":
    document.images.photos.src = "images/property_sale_btn/photos_selected.gif"
    var imagepath = $("a.ImageGallery").find("img").length;
    if (imagepath==0) {
        $("a.ImageGallery").each(function () {
            var imgTag = "<img src=\"" + $(this).attr("href") + " \" width=\"153\" height=\"115\" alt=\"" + $(this).attr("title") + "\"		 title=\"" + $(this).attr("title") + "\" />"
            $(this).html(imgTag)
        });
    }
    break;
    case "3":
    document.images.floorplans.src = "images/property_sale_btn/floorplans_selected.gif"
    if ($("a.clsfloorplan").length > 0) {
        if ($("a.clsfloorplan").find("img").length == 0) {
            var imgTag = "<img src=\"" + $("a.clsfloorplan").attr("href") + " \" width=\"644\" height=\"430\" alt=\"" + $("a.clsfloorplan").attr("title") + "\"		 title=\"" + $("a.clsfloorplan").attr("title") + "\" />"
            $("a.clsfloorplan").html(imgTag)  
        }
    }
    break;
    case "4":
    document.images.ef.src="images/property_sale_btn/eco_feature_selected.gif"
    break;
    case "5":
    document.images.af.src="images/property_sale_btn/accessible_features_selecte.gif"
    break;
case "6":
    document.images.map.src = "images/property_sale_btn/map_selected.gif"
    initialize_map_large();
    var t = setTimeout("initialize_map_large()", 1000);
    break;
    case "7":
    document.images.imgvideo.src="images/property_sale_btn/video_selected.gif"
    break;
case "8":
    document.images.imgStreet.src = "images/property_sale_btn/street_selected.jpg"
    if (parseInt($("input:hidden[id$='hdnCountryID']").val()) == 14 || parseInt($("input:hidden[id$='hdnCountryID']").val()) == 0)
        initialize_street_large();
    break;
    default :
    }
}

function initialize()
{
    document.images.ps.src = "images/property_sale_btn/Summary.jpg"
    document.images.photos.src="images/property_sale_btn/photos.gif"
    document.images.floorplans.src="images/property_sale_btn/floorplans.gif"
    document.images.ef.src="images/property_sale_btn/eco_feature.gif"
    document.images.af.src="images/property_sale_btn/accessible_features.gif"
    document.images.map.src="images/property_sale_btn/map.gif"
    document.images.imgvideo.src = "images/property_sale_btn/video.gif"
    document.images.imgStreet.src = "images/property_sale_btn/street.jpg"
}

function CheckisSrcSet(PropertyID){
  var spanObject=$("#iReferToBuyer").find('#spanPostCode').attr("id");
  $("#iReferToBuyer").attr("src","Referral/ReferAdd.aspx?id=" + PropertyID)
  window.clearInterval(Interval)
}
var Interval;

function SetReferrModel(PropertyID,IsLoggedin,PageType,pageindex,IsCompleted)
{
	if(IsLoggedin=="True")
   {
		if(IsCompleted == "True")
		{
			$("#iReferToBuyer").attr("src","Referral/ReferAdd.aspx?id=" + PropertyID)
			$("#dvRefer").modal()
		   if($.browser.mozilla)
		   Interval= setInterval("CheckisSrcSet("+PropertyID +")",100);
		}
		else
		{
			if(parseInt(PageType)==4)
			{
			 var idStr="ctl00_Content1_";
               var slidminPrice = document.getElementById("minPrice").value;
               var slidmaxPrice = document.getElementById("maxPrice").value;
               var slidminbed = document.getElementById("minBed").value;
               var slidminbath = document.getElementById("minBath").value;
               var szLocation = $("input:text[id$='szLocation']").val();
               var chkRefRewards = '0';
				if(document.getElementById("chkRefRewards").checked==true)
				{
					chkRefRewards = '1';
				}

	        ajaxFunctions.SetAsktheOwnerSearchForSale(1, slidminPrice, slidmaxPrice, slidminbed, slidminbath, szLocation, PropertyID, pageindex, chkRefRewards, $("input:hidden[id$='hid_chkSold']").val(), $("input:hidden[id$='hdnSearchedWord']").val(), $("input:hidden[id$='hdnCrossPostback']").val());
				location.href="MyAccount/EditUserAccount.aspx?Type=4";
			}
			else if(parseInt(PageType)==5)
			{
				ajaxFunctions.SetPropertyIDForAskTheOwner(PropertyID);
				location.href="MyAccount/EditUserAccount.aspx?Type=5";
			}
			else if(parseInt(PageType)==6)
			{
				var idStr="ctl00_Content1_";
                var slidminPrice = document.getElementById(idStr+"hid_slidminPrice").value;
                var slidmaxPrice = document.getElementById(idStr+"hid_slidmaxPrice").value;
                var slidminbed =document.getElementById(idStr+"hid_slidminbed").value;
                var slidminbath = document.getElementById(idStr+"hid_slidminbath").value;
                var szLocation = $("input:text[id$='szLocation']").val();
               
                var lstMiles = document.getElementById(idStr+"hid_lstMiles").value;
                var propertyTypeVal = document.getElementById(idStr+"hid_propertyTypeVal").value;
                var propertyStatusVal = document.getElementById(idStr+"hid_propertyStatusVal").value;
                var EcoFriendlyfeatures = document.getElementById(idStr+"hid_EcoFriendlyfeatures").value;
                var HeatingOption = document.getElementById(idStr+"hid_HeatingOption").value;
                var DisablityAndAdapted = document.getElementById(idStr+"hid_DisablityAndAdapted").value;
               
                var chkOpenhouse = document.getElementById(idStr+"hid_chkOpenhouse").value;
                var chkSold = document.getElementById(idStr+"hid_chkSold").value;
				var chkRefRewards = document.getElementById(idStr+"hid_chkRefRewards").value;
                var advancesearchFlag = document.getElementById(idStr+"hid_advancesearchFlag").value;
                ajaxFunctions.SetAsktheOwnerAdvanceSearch(1, slidminPrice, slidmaxPrice, slidminbed, slidminbath, szLocation, lstMiles, propertyTypeVal, propertyStatusVal, EcoFriendlyfeatures, HeatingOption, DisablityAndAdapted, chkOpenhouse, chkSold, advancesearchFlag, PropertyID, pageindex, chkRefRewards, $("input:hidden[id$='hdnPropertyOwner']").val());
				location.href="MyAccount/EditUserAccount.aspx?Type=6";
			}
		}
  }
  else
  {
            if(parseInt(PageType)==5)
            {
                ajaxFunctions.SetPropertyIDForAskTheOwner(PropertyID);
                location.href="Registration.aspx?Type=5";
            }
            else if(parseInt(PageType)==4)
            {
               var idStr="ctl00_Content1_";
               var slidminPrice = document.getElementById("minPrice").value;
               var slidmaxPrice = document.getElementById("maxPrice").value;
               var slidminbed = document.getElementById("minBed").value;
               var slidminbath = document.getElementById("minBath").value;
               var szLocation = $("input:text[id$='szLocation']").val();
               var chkRefRewards = '0';
				if(document.getElementById("chkRefRewards").checked==true)
				{
					chkRefRewards = '1';
				}
				
               ajaxFunctions.SetAsktheOwnerSearchForSale(1,slidminPrice,slidmaxPrice,slidminbed,slidminbath,szLocation,PropertyID,pageindex,chkRefRewards, $("input:hidden[id$='hid_chkSold']").val(), $("input:hidden[id$='hdnSearchedWord']").val(), $("input:hidden[id$='hdnCrossPostback']").val());
               location.href="Registration.aspx?Type=4";
            }
            else if(parseInt(PageType)==6)
            {
                var idStr="ctl00_Content1_";
                var slidminPrice = document.getElementById(idStr+"hid_slidminPrice").value;
                var slidmaxPrice = document.getElementById(idStr+"hid_slidmaxPrice").value;
                var slidminbed =document.getElementById(idStr+"hid_slidminbed").value;
                var slidminbath = document.getElementById(idStr+"hid_slidminbath").value;
                var szLocation = $("input:text[id$='szLocation']").val();
               
                var lstMiles = document.getElementById(idStr+"hid_lstMiles").value;
                var propertyTypeVal = document.getElementById(idStr+"hid_propertyTypeVal").value;
                var propertyStatusVal = document.getElementById(idStr+"hid_propertyStatusVal").value;
                var EcoFriendlyfeatures = document.getElementById(idStr+"hid_EcoFriendlyfeatures").value;
                var HeatingOption = document.getElementById(idStr+"hid_HeatingOption").value;
                var DisablityAndAdapted = document.getElementById(idStr+"hid_DisablityAndAdapted").value;
               
                var chkOpenhouse = document.getElementById(idStr+"hid_chkOpenhouse").value;
                var chkSold = document.getElementById(idStr+"hid_chkSold").value;
				var chkRefRewards = document.getElementById(idStr+"hid_chkRefRewards").value;
                var advancesearchFlag = document.getElementById(idStr+"hid_advancesearchFlag").value;
                ajaxFunctions.SetAsktheOwnerAdvanceSearch(1, slidminPrice, slidmaxPrice, slidminbed, slidminbath, szLocation, lstMiles, propertyTypeVal, propertyStatusVal, EcoFriendlyfeatures, HeatingOption, DisablityAndAdapted, chkOpenhouse, chkSold, advancesearchFlag, PropertyID, pageindex, chkRefRewards,  $("input:hidden[id$='hdnSearchedWord']").val(),$("input:hidden[id$='hdnPropertyOwner']").val());
               location.href="Registration.aspx?Type=6";
       }
  }
}

function OpenTermsAndConditions(Type)
{
	var date = new Date()
	var ticks = date.getTime()
	var hdnSiteUrl=$("input:hidden[id$='hdnSiteUrl']").val();
	$("#iTermsAndConditions").attr("src",hdnSiteUrl+"/TermsAndConditions.aspx?Type="+Type+"&ticks="+ticks);
	$("#dvTermsAndConditions").modal();
	return false;
} 

function SetDefaultBtnFocus(TextBoxID,ButtonID){
	$("input:text[id$='"+TextBoxID+"']").bind("keydown", function(event) {
		var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
		if (keycode == 13) {
			if ($.browser.opera) {
				document.getElementById(ButtonID).focus();
			} else {
				document.getElementById(ButtonID).click();
			}
			//DeletCookie("BusineesStream");
			return false;
		} else {
			return true;
		}
	});
}

function HideFeedBack()
{
         $('a.feedback-tab').trigger('click');

}
