var trackClick=0;var detailpage=false;jQuery(document).ready(function(){setTimeout(function(){jQuery('#msg').fadeOut(1000)},3000);setTimeout(function(){jQuery('#authMessage').fadeOut(1000)},3000);jQuery('#editlink').click(function(){jQuery('#edit').toggle();jQuery('#st').toggle()});jQuery('#menumaster').click(function(){jQuery('#menuchild').toggle()});initLogin()});function click(id){jQuery("#"+id).html('')}function close_div(id){jQuery("#"+id).html('')}function toggle_details_link(id,id2,tab_id){jQuery("#"+id2).fadeOut('slow');jQuery("#"+id).fadeIn('slow');if(tab_id){jQuery("#"+tab_id).html('')}}function jqCheckAll(id,name,master){if(jQuery('#'+master).is(':checked')){jQuery("form#"+id+" INPUT[@name="+name+"][type='checkbox']").attr('checked',true)}else{jQuery("form#"+id+" INPUT[@name="+name+"][type='checkbox']").attr('checked',false)}}function checkChangePasswordForm(){var errorMsg="";if(jQuery("#UserOldPassword").val()==""){errorMsg+="Old password must not be blank \n"}if(jQuery("#UserNewPassword").val()==""){errorMsg+="New password must not be blank \n"}if(jQuery("#UserConfirmPassword").val()==""){errorMsg+="Confirm password must not be blank and should match with new password. \n"}if(errorMsg!=""){alert(errorMsg);return false}return true}function updateLoginHeader(strData){var arrResponce=strData.split("~~");strData=arrResponce[2];jQuery('#header_signup').html(strData);initLogin();jQuery("#signin_menu").toggle();jQuery("#signin").toggleClass("menu-open");if(jQuery.trim(arrResponce[0])=='failer'){jQuery("input[id='UserPassword']").val('');jQuery("#signin_menu #msg").html(arrResponce[1])}else{jQuery("#aLogin").html("My Account");jQuery("#aLogin").attr("href","/users")}}function initLogin(){jQuery("#signin").click(function(e){e.preventDefault();jQuery("#signin_menu").toggle();jQuery("#signin").toggleClass("menu-open")});jQuery("#signin_menu").mouseup(function(){return false});jQuery(document).mouseup(function(e){if(jQuery(e.target).parent("a.signin").length==0){jQuery("#signin").removeClass("menu-open");jQuery("#signin_menu").hide()}})}function toggleSearch(src,div){jQuery('#search_1').hide();jQuery('#search_2').hide();jQuery('#search_3').hide();jQuery('#'+div).show('slow');jQuery('#link_1').css('color','#707070');jQuery('#link_1').css('cursor','pointer');jQuery('#link_2').css('color','#707070');jQuery('#link_2').css('cursor','pointer');jQuery('#link_3').css('color','#707070');jQuery('#link_3').css('cursor','pointer');jQuery('#'+src).css('color','red');jQuery('#'+src).css('cursor','default');options={path:'/',expires:10};if(src=="link_1"){jQuery.cookie('search','city',options)}else if(src=="link_2"){jQuery.cookie('search','zipcode',options)}else if(src=="link_3"){jQuery.cookie('search','mls',options)}else{jQuery.cookie('search','city',options)}}function clearText(src,text){t=jQuery("#"+src).val();if(jQuery.trim(t)==text){jQuery("#"+src).val('')}}function addText(src,text){t=jQuery("#"+src).val();if(jQuery.trim(t)==''){jQuery("#"+src).val(text)}}function changePropertyStyle(objElement){divid=jQuery(objElement).attr('value');jQuery("#res").css('display','none');jQuery("#cn").css('display','none');jQuery("#tw").css('display','none');jQuery("#mul").css('display','none');jQuery("#lnd").css('display','none');jQuery("#com").css('display','none');jQuery("#"+divid).css('display','block')}function selectAllNone(strCheckedStatus){form=document.forms['CommunityTemplateAdminGeneratePagesForm'];for(i=0;i<form.elements.length;i++){if(form.elements[i].type=="checkbox"){form.elements[i].checked=strCheckedStatus}}}function selectAllCategory(strCheckedStatus){form=document.forms['StaticPageAdminIndexForm'];for(i=0;i<form.elements.length;i++){if(form.elements[i].type=="checkbox"){form.elements[i].checked=strCheckedStatus}}}function selectAllCity(strCheckedStatus,strCheckBoxName){form=document.forms['SearchPropertiesAdminSearchCommunitiesForm'];for(i=0;i<form.elements.length;i++){if(form.elements[i].type=="checkbox"&&form.elements[i].name.indexOf("data[SearchProperties]["+strCheckBoxName+"]")!=-1){form.elements[i].checked=strCheckedStatus}}}function selectAllCommunity(strCheckedStatus,strId){form=document.forms['SearchProperties'];for(i=0;i<form.elements.length;i++){if(form.elements[i].type=="checkbox"&&form.elements[i].name.indexOf("data[SearchProperties][community]")!=-1){form.elements[i].checked="Check All"==strCheckedStatus?true:false}}"Check All"==strCheckedStatus?jQuery('#'+strId).val("Uncheck All"):jQuery('#'+strId).val("Check All")}function execute_script(){jQuery("#loading_status").show();jQuery("#ajax_execute").html("");jQuery.ajax({type:"POST",url:"/CommunitySearches/ajax_execute_script",success:function(data){jQuery("#ajax_execute").append("<i><br />"+data+"</i>")},complete:function(){script_start=0;jQuery("#loading_status").html("<img src='/img/success.png'> Script Execution completed sucessfully.");jQuery("#loading_status").fadeOut(1000);getAjaxUpdate(1)}});if(script_start){getAjaxUpdate(0)}}function getAjaxUpdate(flag){var TimerID=setTimeout(function(){if(script_start||flag==1){jQuery.ajax({type:"POST",url:"/getAjaxRequest.php",cache:false,success:function(data){jQuery("#ajax_execute").html("");jQuery("#ajax_execute").html(data)}});getAjaxUpdate(0);return}else{clearTimeout(TimerID);return 0}},5000)}function customesearch(field,div){var text=document.getElementById(div);if(field.value=='custom'){text.style.display="block"}if(field.value!='custom'){text.style.display="none"}}var arrMlsPro=new Array();function jQuery_addfavorite(mlsno){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";if(mlsno!=""){arrMlsPro[mlsno]=jQuery("#divFavorite_"+mlsno).html();jQuery("#divFavorite_"+mlsno).html(strWait);jQuery.ajax({type:"POST",url:"/users/ajaxaddfavourite",data:"mlsnum="+mlsno,success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){jQuery("#divFavorite_"+mlsno).html(arrMlsPro[mlsno]);callbackdialog='addfavourite';mls=mlsno;jQuery('#listing_login_dialogbox').dialog("open")}else{jQuery("#divFavorite_"+mlsno).html(data)}},complete:function(){jQuery("#favoritestatus_"+mlsno).hide();jQuery("#favoritestatus_"+mlsno).fadeIn(1000);jQuery("#favoritestatus_"+mlsno).fadeOut(15000)}})}}function jQuery_removefavorite(mlsno){if(confirm("Are you sure you want to remove this property from your favorite list?")){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";if(mlsno!=""){jQuery("#divFavorite_"+mlsno).html(strWait);jQuery.ajax({type:"POST",url:"/users/ajaxremovefavourite",data:"mlsnum="+mlsno,success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){alert("not allowed to perfome this operation")}else{jQuery("#divFavorite_"+mlsno).html(data)}},complete:function(){jQuery("#favoritestatus_"+mlsno).hide();jQuery("#favoritestatus_"+mlsno).fadeIn(1000);jQuery("#favoritestatus_"+mlsno).fadeOut(15000)}})}}}function jQuery_removefavorite_favouritepage(mlsno){if(confirm("Are you sure you want to remove this property from your favorite list?")){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";if(mlsno!=""){arrMlsPro[mlsno]=jQuery("#divFavorite_"+mlsno).html();jQuery("#favoritestatus_"+mlsno).html(strWait);jQuery.ajax({type:"POST",url:"/users/removefavourite",data:"mlsnum="+mlsno,success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){alert("not allowed to perfome this operation")}else{jQuery("#divFavorite_"+mlsno).fadeOut(5000)}},complete:function(){jQuery("#favoritestatus_"+mlsno).hide();jQuery("#favoritestatus_"+mlsno).fadeIn(5000);jQuery("#favoritestatus_"+mlsno).fadeOut(5000)}})}}}function jQuery_Delete_Savesearch(id){if(confirm("Are you sure you want to remove this saved search from your favorite list?")){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";if(id!=""){jQuery("#searchsavestatus_"+id).html(strWait);jQuery.ajax({type:"POST",url:"/search_saves/ajaxdelete",data:"id="+id,success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){alert("not allowed to perfome this operation")}else{jQuery("#divSavedSearch_"+id).fadeOut(5000)}},complete:function(){jQuery("#searchsavestatus_"+id).hide();jQuery("#searchsavestatus_"+id).fadeIn(5000);jQuery("#searchsavestatus_"+id).fadeOut(5000)}})}}}function jQuery_savesearch(){jQuery.ajax({type:"POST",url:"/SearchSaves/ajaxadd",success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){callbackdialog="savesearch";jQuery('#listing_login_dialogbox').dialog("open")}else{jQuery("#save_search_title_dialogbox").dialog("open")}},complete:function(){}})}function updateHeader(){jQuery.ajax({type:"POST",url:"/users/getloginheader",success:function(data){alert(data)}})}function changeEmailNotification(id){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/mail_loader.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";var strSuccess="<table border=0 cellspacing=0><tr><td align=right><img src='/img/success.png'/></td><td valign=middle align=left> Successfully updated.</td></tr></table>";var strFail="<table border=0 cellspacing=0><tr><td align=right><img src='/img/warning.png'/></td><td valign=middle align=left> Error! Try again.</td></tr></table>";jQuery("#emailnotificationwait_"+id).html(strWait);jQuery("#emailnotificationwait_"+id).show();jQuery.ajax({type:"POST",url:"/SearchSaves/ajaxedit",data:"id="+id+"&value="+jQuery('#emailnotification'+id).val(),success:function(data){if(jQuery.trim(data)=='Success'){jQuery("#emailnotificationwait_"+id).html(strSuccess)}else{jQuery("#emailnotificationwait_"+id).html(strFail)}},complete:function(){jQuery("#emailnotificationwait_"+id).fadeOut(5000)}})}function jQuery_detailaddfavorite(mlsno){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";if(mlsno!=""){arrMlsPro[mlsno]=jQuery("#topdivFavorite_"+mlsno).html();jQuery("#topdivFavorite_"+mlsno).html(strWait);jQuery("#bottomdivFavorite_"+mlsno).html(strWait);jQuery.ajax({type:"POST",url:"/users/ajaxaddfavourite/1",data:"mlsnum="+mlsno,success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){jQuery("#topdivFavorite_"+mlsno).html(arrMlsPro[mlsno]);jQuery("#bottomdivFavorite_"+mlsno).html(arrMlsPro[mlsno]);callbackdialog='addfavourite';mls=mlsno;jQuery('#detailpage_login').dialog("open")}else{jQuery("#topdivFavorite_"+mlsno).html(data);jQuery("#bottomdivFavorite_"+mlsno).html(data)}},complete:function(){jQuery(".favoritestatus_"+mlsno).hide();jQuery(".favoritestatus_"+mlsno).fadeIn(1000);jQuery(".favoritestatus_"+mlsno).fadeOut(15000)}})}}function jQuery_detailremovefavorite(mlsno){if(confirm("Are you sure you want to remove this property from your favorite list?")){var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";if(mlsno!=""){jQuery("#topdivFavorite_"+mlsno).html(strWait);jQuery("#bottomdivFavorite_"+mlsno).html(strWait);jQuery.ajax({type:"POST",url:"/users/ajaxremovefavourite/1",data:"mlsnum="+mlsno,success:function(data){if(jQuery.trim(data)=='Error:Loginrequire'){alert("not allowed to perfome this operation")}else{jQuery("#topdivFavorite_"+mlsno).html(data);jQuery("#bottomdivFavorite_"+mlsno).html(data)}},complete:function(){jQuery(".favoritestatus_"+mlsno).hide();jQuery(".favoritestatus_"+mlsno).fadeIn(1000);jQuery(".favoritestatus_"+mlsno).fadeOut(15000)}})}}}function jQuery_searchpage(action,id,totalcount){if(jQuery("#searchpages").length>0)jQuery("#searchpages").remove();jQuery("#divSearchpage").html('<img src="/img/ajax-loader_search.gif">&nbsp;&nbsp;&nbsp;Loading...<br><br><br>');for(var i=1;i<=totalcount;i++){jQuery("#link_"+i).removeClass('active');jQuery("#link_"+i).css({'margin':'0px','padding':'0px','width':'auto','text-align':'center','background-color':'#1C486F','height':'30px'})};jQuery("#"+id).addClass('active');jQuery("#"+id).css({'margin':'0px','padding':'0px','width':'auto','text-align':'center','background-color':'#995B19','height':'30px'});jQuery.ajax({type:"POST",url:"/properties/"+action,success:function(data){jQuery("#divSearchpage").html(data)},complete:function(){}})}
function selectAllSubdivision(strCheckedStatus,strId)
{
    form =document.forms['SearchProperties'];
    for (i = 0; i < form.elements.length; i++) {
        if (form.elements[i].type == "checkbox" && form.elements[i].name.indexOf("data[SearchProperties][subdivision]")!=-1){
        		form.elements[i].checked = "Check All"==strCheckedStatus?true:false;
        }
    }
    "Check All"==strCheckedStatus?jQuery('#'+strId).val("Uncheck All"):jQuery('#'+strId).val("Check All");
}
function selectAll(strCheckedStatus,strId,strKey)
{
    form =document.forms['SearchProperties'];
    for (i = 0; i < form.elements.length; i++) {
        if (form.elements[i].type == "checkbox" && form.elements[i].name.indexOf("data[SearchProperties]["+strKey+"]")!=-1){
        		form.elements[i].checked = "Check All"==strCheckedStatus?true:false;
        }
    }
    "Check All"==strCheckedStatus?jQuery('#'+strId).val("Uncheck All"):jQuery('#'+strId).val("Check All");
}
function jQuery_trackclick(){
	jQuery.ajax({
		type : "POST",
		url : "/properties/trackClick",
		cache : false,
		success : function(data){
//			alert(data);
			trackClick=data;
		}
	});
}
function createCookie(name,value,days) {
//	alert(value);
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires;
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
function eraseCookie(name) {
	createCookie(name,"",-1);
}
function checkAuth(){
	jQuery.ajax({
		type : "POST",
		url : "/properties/checkAuthentication",
		cache : false,
		success : function(data){
//			alert(data);
		}
	});
}
function checkLeadForm(){
	var flag=false;
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	with(document.Lead){
		if(""==txtfirstname.value){
			jQuery('#txtfirstname_msg').html("<span class='error-message'>First name is required</span>");
			flag=true;
		}else jQuery('#txtfirstname_msg').html("");
		if(""==txtlastname.value){
			jQuery('#txtlastname_msg').html("<span class='error-message'>Last name is required</span>");
			flag=true;
		}else jQuery('#txtlastname_msg').html("");
		if(""==txtphone.value){
			jQuery('#txtphone_msg').html("<span class='error-message'>Phone is required</span>");
			flag=true;
		}else jQuery('#txtphone_msg').html("");
		if(""==txtemail.value){
			jQuery('#txtemail_msg').html("<span class='error-message'>Email address required</span>");
			flag=true;
		}else if(reg.test(txtemail.value)==false){
			jQuery('#txtemail_msg').html("<span class='error-message'>Invalid Email Address</span>");
			flag=true;
		}else jQuery('#txtemail_msg').html("");
		if(""==txtPassword.value){
			jQuery('#txtPassword_msg').html("<span class='error-message'>Password is required</span>");
			flag=true;
		}else jQuery('#txtPassword_msg').html("");
		if(txtPassword.value!=txtConfirmPassword.value){
			jQuery('#txtConfirmPassword_msg').html("<span class='error-message'>Both password must be same</span>");
			flag=true;
		}else jQuery('#txtConfirmPassword_msg').html("");
		if(true==flag){
			return false;
		}
	}
	return true;
}

function checkForm(){
	var flag1=false;
	var reg1 = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	with(document.user){
		if(""==txtFirstName.value){
			jQuery('#txtFirstName_msg').html("First name is required");
			flag1=true;
		}else jQuery('#txtFirstName_msg').html("");
		if(""==txtLastName.value){
			jQuery('#txtLastName_msg').html("Last name is required");
			flag1=true;
		}else jQuery('#txtLastName_msg').html("");
		if(""==txtEmail.value){
			jQuery('#txtEmail_msg').html("Email is required");
			flag1=true;
		}else if(reg1.test(txtEmail.value)==false){
			jQuery('#txtEmail_msg').html("Invalid Email Address");
			flag1=true;
		}else jQuery('#txtEmail_msg').html("");
		if(flag1==true){
			return false;
		}
    }
        return true;
}

function getSubdivisionsByCity(cityid){
	var strWait = "<table border=0 cellspacing=0 style='border:0px;'><tr><td align=right><img src='/img/loading.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";
	jQuery('#subdivision').html(strWait);
	jQuery.ajax({
		type : "POST",
		url:"/properties/searchDivisions",
		data:"cityid=" + cityid,
		success: function(data){
		    jQuery('#subdivision').html(data);
	    },
	    complete:function(){
	        jQuery("#subdivision").hide();
	        jQuery("#subdivision").fadeIn(1000);
	    }
	});
}
function getPropertySubtypes(property_type){
	var strWait = "<table border=0 cellspacing=0 style='border:0px;'><tr><td align=right><img src='/img/loading.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";
	jQuery('#property_subtype').html(strWait);
	jQuery.ajax({
		type : "POST",
		url:"/properties/searchPropertySubTypes",
		data:"property_type=" + property_type,
		success: function(data){
		    jQuery('#property_subtype').html(data);
	    },
	    complete:function(){
	        jQuery("#property_subtype").hide();
	        jQuery("#property_subtype").fadeIn(1000);
	    }
	});
}
/*****code added on 8thmarch,2011 start  for login box of detail page****/
function jQuery_leadlogin(){
	callbackdialog ="leadlogin";
    jQuery('#detailpage_login').dialog("open");
}
/*****code added on 8th march,2011 end****/

function changestatus(id){	
	var strSt=jQuery('#statuse_'+id).val();
	var strSuccess = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Successfully updated.</td></tr></table>";
	var strFail = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Error! Try again.</td></tr></table>";	
	jQuery("#status_" + id).show();
	jQuery.ajax({
		type:"POST",
		url :"/Comments/comment_edit",
		data:"id=" + id + "&value="+strSt,	
		success: function(data){		
		  if(jQuery.trim(data)=='Success'){
			  jQuery("#status_" + id).html(strSuccess);
		  
		  }else{
			  jQuery("#status_" + id).html(strFail);
		  }
		},
	 complete:function(){
            jQuery("#status_"+id).fadeOut(1000);
     }
	});
}
function commentadd(mls){
	
	var strWait = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Please wait...</td></tr></table>";
	var strSuccess = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Successfully submitted.</td></tr></table>";
	var strFail = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Error! Try again.</td></tr></table>";
	var strempty = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Not Null field</td></tr></table>";
	jQuery("#btn_" ).html(strWait);
	jQuery("#btn" ).hide();
	jQuery("#btn_" ).show();	
	jQuery.ajax({
		type:"POST",
		url:"/Properties/comment_Add",
		data:"mls=" + mls +"&value="+ jQuery('#comment').val(),
		success: function(data){		
		if(jQuery.trim(data) == 'Success'){
			jQuery("#comment_").html(strSuccess);		
		}else if(jQuery.trim(data) == 'Empty'){
			jQuery("#comment_").html(strempty);
		
		}else{
			jQuery("#comment_").html(strFail);
		}
    },
    complete:function(){
        jQuery("#comment_").fadeOut(5000);
        jQuery("#btn_").fadeOut(1000);
        jQuery("#btn" ).show(1000);
    }
	});
}

function commentrply(mls,id){	
	var strWait = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Please wait...</td></tr></table>";
	var strSuccess = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Successfully submitted.</td></tr></table>";
	var strempty = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Not Null field</td></tr></table>";
	
	jQuery.ajax({
		type:"POST",
		url:"/Properties/comment_replay",		
		data:"mls=" + mls + "&id="+ id + "&value=" + jQuery('#rplytext' +id).val(),
		success: function(data){		
		if(jQuery.trim(data) == 'Success'){
			 jQuery("#comment1_").html(strSuccess);
			jQuery("#replay_" + id).hide();
		}else if(jQuery.trim(data) == 'Empty'){
			 jQuery("#comment1_").html(strempty);
		
		}else{
			 jQuery("#comment1_").html(strFail);
		}
    },
    complete:function(){
        jQuery("#comment1_").fadeOut(5000);
        
      }
	});
}

function jQuery_addforupdtes(mlsno){
    var strWait = "<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";
    if(mlsno != ""){
    	arrMlsPro[mlsno] = jQuery("#divUpdates_" + mlsno).html();
        jQuery("#divUpdates_" + mlsno).html(strWait);
        jQuery.ajax({
            type : "POST",
            url:"/users/ajaxaddforupdtes",
            data:"mlsnum=" + mlsno,
            success: function(data){
        		if(jQuery.trim(data) == 'Error:Loginrequire'){
                    //jQuery('#login_mlsno').val(mlsno);
                    //jQuery('#login').dialog('open');
                    jQuery("#divUpdates_" + mlsno).html(arrMlsPro[mlsno]);
                    callbackdialog='addforupdtes';
                    mls = mlsno;
                	jQuery('#listing_login_dialogbox').dialog("open");
                    
                }else{
                    jQuery("#divUpdates_" + mlsno).html(data);
                }
            },
            complete:function(){
                jQuery("#favoritestatus_"+mlsno).hide();
                jQuery("#favoritestatus_"+mlsno).fadeIn(1000);
                jQuery("#favoritestatus_"+mlsno).fadeOut(15000);
            }
        });
    }
}
function jQuery_removeforupdtes(mlsno){
    if(confirm("Are you sure you want to remove this property from your favorite list?"))
    {
        var strWait = "<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";
        if(mlsno != ""){
            jQuery("#favoritestatus_" + mlsno).html(strWait);
            jQuery.ajax({
                type : "POST",
                url:"/users/ajaxjremoveforupdtes",
                data:"mlsnum=" + mlsno,
                success: function(data){
                    if(jQuery.trim(data) == 'Error:Loginrequire'){
                        alert("not allowed to perfome this operation");
                    }else{
                        jQuery("#divUpdates_" + mlsno).html(data);
                    }
                },
                complete:function(){
                    jQuery("#favoritestatus_"+mlsno).hide();
                    jQuery("#favoritestatus_"+mlsno).fadeIn(1000);
                    jQuery("#favoritestatus_"+mlsno).fadeOut(15000);
                }
            });
        }
    }
}

function changestatus_avatar(id){
	
	var strSuccess="<table border=0 cellspacing=0><tr><td valign=middle align=left> Successfully updated.</td></tr></table>";
	var strFail = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Error! Try again.</td></tr></table>";
	jQuery("#status_"+id).show();
	jQuery.ajax({
	type:"POST",
	url:"/Avatars/changestatus",
	data:"id=" + id + " &value="+ jQuery('#status'+id).val(),
	success : function(data){
		if(jQuery.trim(data)=='Success'){
			jQuery('#status_' + id).html(strSuccess);
		}
		else{
			jQuery('#status_' +id).html(strFail);
		}
	},
	complete: function(){
		jQuery('#status_' +id).fadeOut(1000);
	}
	});
}
function changepublic_avatar(id){
	var strSuccess="<table border=0 cellspacing=0><tr><td valign=middle align=left> Successfully updated.</td></tr></table>";
	var strFail = "<table border=0 cellspacing=0><tr><td valign=middle align=left> Error! Try again.</td></tr></table>";
	jQuery.ajax({
		type:"POST",
		url:'/Avatars/changepublic',
		data:"id=" +id + " &value="+ jQuery('#public'+id).val(),
		success:function (data){
		if(jQuery.trim(data)=='Success'){
			jQuery('#public_' + id).html(strSuccess);
		}
		else{
			jQuery('#public_' +id).html(strFail);
		}
	},
	complete:function(){
		jQuery("#public_"+id).fadeOut(1000);
	}
	});
}
function jQuery_remove_emailupdate(mlsno){
	if(confirm("Are you sure you want to remove this property from your email update list?")){
		var strWait="<table border=0 cellspacing=0><tr><td align=right><img src='/img/wait.gif'/></td><td valign=middle align=left> Please wait...</td></tr></table>";
		if(mlsno!=""){
			arrMlsPro[mlsno]=jQuery("#divFavorite_"+mlsno).html();
			jQuery("#favoritestatus_"+mlsno).html(strWait);
			jQuery.ajax({
				type:"POST",
				url:"/users/removemailupdatepro",
				data:"mlsnum="+mlsno,
				success:function(data){
					if(jQuery.trim(data)=='Error:Loginrequire'){
						alert("not allowed to perfome this operation");
					}else{
						jQuery("#divFavorite_"+mlsno).fadeOut(5000);
					}
				},
				complete:function(){
					jQuery("#favoritestatus_"+mlsno).hide();
					jQuery("#favoritestatus_"+mlsno).fadeIn(5000);
					jQuery("#favoritestatus_"+mlsno).fadeOut(5000);
				}
			});
		}
	}
}
/*******14Feb2012*******/
function validatetellmore()
{
	var name=document.getElementById('PropertiesDetailsTellMeMoreName').value;
	var email=document.getElementById('PropertiesDetailsTellMeMoreEmail').value;
	var phone=document.getElementById('PropertiesDetailsTellMeMorePhone').value;
	if(name=="")
	{
		alert('Please insert your Name.');
		document.getElementById('PropertiesDetailsTellMeMoreName').focus();
		return false;
	}else if(email=="")
	{
		alert('Please insert your Email Address.');
		document.getElementById('PropertiesDetailsTellMeMoreEmail').focus();
		return false;
	}else if(!checkEmail(email))
	{
		alert("Please insert your correct Email Address.");
		document.getElementById('PropertiesDetailsTellMeMoreEmail').focus();	
		return false;	
	}else if(phone=="")
	{
		alert('Please insert Phone.');
		document.getElementById('PropertiesDetailsTellMeMorePhone').focus();
		return false;
	}else if(!IsPhone(phone))
	{
		alert("Please insert correct Phone.");
		document.getElementById('PropertiesDetailsTellMeMorePhone').focus();	
		return false;	
	}
	
	return true;
}
function validaterequest()
{
        var name=document.getElementById('PropertiesDetailsRequestName').value;
        var email=document.getElementById('PropertiesDetailsRequestEmail').value;
        var phone=document.getElementById('PropertiesDetailsRequestPhone').value;
        var f_date_b=document.getElementById('f_date_b').value;
        if(name=="")
        {
                alert('Please insert your Name.');
                document.getElementById('PropertiesDetailsRequestName').focus();
                return false;
        }else if(email=="")
        {
                alert('Please insert your Email Address.');
                document.getElementById('PropertiesDetailsRequestEmail').focus();
                return false;
        }else if(!checkEmail(email))
        {
                alert("Please insert your correct Email Address.");
                document.getElementById('PropertiesDetailsRequestEmail').focus();	
                return false;
        }else if(phone=="")
        {
                alert('Please insert phone.');
                document.getElementById('PropertiesDetailsRequestPhone').focus();
                return false;
        }else if(!IsPhone(phone))
        {
                alert("Please insert correct Phone.");
                document.getElementById('PropertiesDetailsRequestPhone').focus();	
                return false;		
        }else if(f_date_b=="")
        {
                alert('Please insert Date for the showing.');
                document.getElementById('f_date_b').focus();
                return false;
        }

        return true;
}
function checkEmail(emailaddr) {
        var regEmail = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
        if (regEmail.test(emailaddr))
        {
                return (true);
        }
        return (false);
}
function IsPhone(phone) {
        var regex = /^[0-9\+\-\s\.]*$/;
        if(!regex.test(phone))
        {
                return (false);
        }	
        return (true);
}
/*******14Feb2012*******/
