
var currentUrl = window.location.toString()
prot = currentUrl.substr(0,5);
if(prot=="https")
	httpsUrl = "https://www.landlister.com";
else {
	httpsUrl = "http://www.landlister.com";
}

initialDescHeight = 274;
expandedDescHeight = 0;
var propertyPage = false;
function tryLogin(e){
		if(e && e.keyCode == 13) {
			var usr = jQuery("#username").attr("value")
			var pwd = jQuery("#password").attr("value")
			
			jQuery.ajax({  
				type: "POST",  
				url: httpsUrl + "/member.php",  
				data: { TopLogin: 1,Username:usr,Password:pwd},  
				success: function(theResponse) {
	
					if(theResponse==1) {
						document.userlogin.submit();
						window.location = httpsUrl + '/member/myaccount.html';
					} else {
						jQuery("#errorFrame").html('Username or password are invalid, please try again.<br /><br />If you forgot your username or password, please click on "Forgot Password."');
						jQuery("#errorFrame").modal({position: ["20%","40%"],
													 opacity:70,
													 overlayCss: {backgroundColor:"#000"},
													 minHeight:20,
													 onOpen: function (dialog) {
													 	
							dialog.overlay.fadeIn('slow', function () {
								dialog.data.hide();
								dialog.container.fadeIn('slow', function () {
									dialog.data.slideDown('slow');
								});
							});
						}});
	
	
					}
				}
					
				  
			});  
		}
	}


jQuery(document).ready(function(){ 

	
	jQuery("#loginBtn").click(function(event) { 	
		
		var usr = jQuery("#username").attr("value")
		var pwd = jQuery("#password").attr("value")
		
		jQuery.ajax({  
			type: "POST",  
			url: httpsUrl + "/member.php",  
			data: { TopLogin: 1,Username:usr,Password:pwd},  
			success: function(theResponse) {

				if(theResponse==1) {
					document.userlogin.submit();
					window.location = httpsUrl + '/member/myaccount.html';
				} else {
					
					jQuery("#errorFrame").html('Username or password are invalid, please try again.<br /><br />If you forgot your username or password, please click on "Forgot Password."');
					jQuery("#errorFrame").modal({position: ["20%","40%"],
												 opacity:70,
												 overlayCss: {backgroundColor:"#000"},
												 minHeight:20,
												 onOpen: function (dialog) {
						dialog.overlay.fadeIn('slow', function () {
							dialog.data.hide();
							dialog.container.fadeIn('slow', function () {
								dialog.data.slideDown('slow');
							});
						});
					}});


				}
			}
				
			  
		});  
	})
	
	jQuery(".countiesLink").click(function(){
		
		
		jQuery("#filterForm").modal({position: ["19%","15%"],
									 opacity:70,
									 overlayCss: {backgroundColor:"#000"},
									 minHeight:20,
									 minWidth:500,
									 overlayClose:true,
									 onShow:function(){xajax_generateCountySelectionForm(document.getElementById('filter[state]').value,document.getElementById('counties').value)},
									 onOpen: function (dialog) {
											dialog.overlay.fadeIn('slow', function () {
												dialog.data.hide();
												dialog.container.fadeIn('fast', function () {
													dialog.data.fadeIn('fast');
												});
											});
									 }});	
		

		jQuery("#selectItem").click(function(){
			selectedItems = jQuery(".checkboxesList :checkbox:checked").serializeArray();
			var selectedItemsStr = false;
			if(selectedItems.length > 0) {
				var ids = new Array();
				
				for(i=0;i<selectedItems.length;i++) {
					var n = jQuery(selectedItems[i]).attr("name");
					var nParts = n.split("_");
					ids.push(nParts[1]);
				}
				
				selectedItemsStr = ids.join("|")
				
				jQuery("#counties").attr("value",selectedItemsStr);
				
				if(selectedItems.length==1) 
					msg = "1 county selected";
				else
					msg = selectedItems.length + " counties selected";
				
				jQuery(".countiesLink").html(msg)
				
				var stateValue = jQuery("#LightboxState").val();
				
				jQuery(".stateSelector option").each(function() {
					this.selected = (this.value == stateValue); 
				});
			} else {
				msg = "Counties";
				jQuery(".countiesLink").html(msg)
				jQuery("#counties").attr("value","");
			}
			jQuery.modal.close();
		})							 
	})
	
	
	jQuery(".regionsLink").click(function(){
		
		
		jQuery("#filterForm").modal({position: ["19%","15%"],
									 opacity:70,
									 overlayCss: {backgroundColor:"#000"},
									 minHeight:20,
									 minWidth:500,
									 overlayClose:true,
									 onShow:function(){xajax_generateRegionSelectionForm(document.getElementById('filter[state]').value,document.getElementById('regions').value)},
									 onOpen: function (dialog) {
											dialog.overlay.fadeIn('fast', function () {
												dialog.data.hide();
												dialog.container.fadeIn('fast', function () {
													dialog.data.fadeIn('fast');
												});
											});
									 }});	
		

		jQuery("#selectItem").click(function(){
			selectedItems = jQuery(".checkboxesList :checkbox:checked").serializeArray();
			var selectedItemsStr = false;
			if(selectedItems.length > 0) {
				var ids = new Array();
				
				for(i=0;i<selectedItems.length;i++) {
					var n = jQuery(selectedItems[i]).attr("name");
					var nParts = n.split("_");
					ids.push(nParts[1]);
				}
				
				selectedItemsStr = ids.join("|")
				
				jQuery("#regions").attr("value",selectedItemsStr);
				
				if(selectedItems.length==1) 
					msg = "1 area selected";
				else 
					msg = selectedItems.length + " areas selected";
				
				jQuery(".regionsLink").html(msg)
				
				var stateValue = jQuery("#LightboxState").val();
				
				jQuery(".stateSelector option").each(function() {
					this.selected = (this.value == stateValue); 
				});
			} else {
				msg = "State areas";
				jQuery(".regionsLink").html(msg)
				jQuery("#regions").attr("value","");
			}
			jQuery.modal.close();
		})							 
	})
	
	
	jQuery("#section1").click(function() { 	
		
		if(jQuery("#section1").hasClass("sectionCollapsed1")) {
			jQuery("#extraFeatures").removeClass("hidden")
			jQuery("#extraFeatures").css("display","block");
			jQuery("#extraFeatures").animate({height:82},500,"");
			jQuery("#section1").removeClass("sectionCollapsed1");
			jQuery("#section1").html("HIDE FEATURES");
			jQuery("#section1").addClass("sectionExpanded1");
			
		} else {
			
			jQuery("#section1").removeClass("sectionExpanded1");
			jQuery("#section1").html("MORE FEATURES");
			jQuery("#section1").addClass("sectionCollapsed1");
			jQuery("#extraFeatures").animate({height:0},500,function(){
				jQuery("#extraFeatures").addClass("hidden");
				jQuery("#extraFeatures").css("display","none");
			});
		}
		
	
	})

	jQuery("#section2").click(function() { 	

		if(jQuery("#section2").hasClass("sectionCollapsed1")) {
			if(expandedDescHeight==0) {
				jQuery("#fullDesc").css("height","auto");
				expandedDescHeight = jQuery("#fullDesc").height();
				jQuery("#fullDesc").css("height",initialDescHeight);		
			}
			jQuery("#fullDesc").animate({height:expandedDescHeight},800);
			
			jQuery("#section2").removeClass("sectionCollapsed1");
			jQuery("#section2").html("HIDE DESCRIPTION");
			jQuery("#section2").addClass("sectionExpanded1");
			
		} else {
			
			jQuery("#fullDesc").animate({height:initialDescHeight},800);
			
			jQuery("#section2").removeClass("sectionExpanded1");
			jQuery("#section2").html("MORE DESCRIPTION");
			jQuery("#section2").addClass("sectionCollapsed1");
			
		}

	})

	function loader() {
		var h = jQuery("#listingFrame").height();
		var w = jQuery("#listingFrame").width();
		
		jQuery("#loading").css("display","block")
		jQuery("#loading").css("height",h)
		jQuery("#loading").css("width",w-13)
		
		jQuery("#loading").animate({opacity:0.8},800);
	}
	
	jQuery(".opt").click(function(event) { 	
		loader();
		
		jQuery(".searchColumn :checkbox").each(function(){
			jQuery(this).attr("disabled","disabled")
		});
		
		var optionValue = jQuery(this).attr('value');
		var isChecked =jQuery(this).attr('checked'); 
		
		var parentIDGrp = jQuery(this).parent().get(0).id;
		var p = parentIDGrp.split("_");
		var parentID = p[1];
		
		jQuery("#"+parentID+" .anavgroupheaderclear").css("display","block");
		
		if(isChecked) {
			var act = "add";
		} else{
			var act = "remove";
			//check if this is la last checkbox unchecked
			chkNo = jQuery("#"+parentID+"Body :checkbox:checked").length;
			if(chkNo==0) {
				jQuery("#"+parentID+" .anavgroupheaderclear").css("display","none");
			}	
		}
		
		var grp = jQuery(this).attr('name');
		if(grp=="options[]") {
			spec = 0;
		} else {
			s =grp.replace("[]",""); 	
			spec=s;
		}
		
		var isAuction = 0;
		var CurrentUrl = window.location
		var patt=/auctions.html/g;
		var r=patt.test(CurrentUrl);
		if(r) {
			isAuction = 1;
		}
	
	

		jQuery.ajax({  
			type: "POST",  
			url: "lands.php?isAuction="+isAuction,
			data: {options: optionValue,action:act,specialOption:spec,isAuction:isAuction},  
			success: function(theResponse) {
				
				jQuery("#listingFrame").html('<div id="loading" class="loading"></div>' + theResponse)
				jQuery("#loading").css("display","none")

				jQuery(".searchColumn :checkbox").each(function(){
					jQuery(this).attr("disabled","")
				});
				
				var viewMode = jQuery(".modeActive").html();
				
				if(viewMode=="Map") {
					
					if(isAuction) {
						location.href="auctions.html"		
					} else {	
						location.href="land_for_sale.html"
					}
				}
				
			} 
		});  
	})
	
	
	jQuery(".anavgroupheaderclear").click(function(){
		loader();
		var parentID = jQuery(this).parent().get(0).id;
		var opt = new Array();	
		var section;
		var spec = 0;
		jQuery("#"+parentID+"Body :checkbox:checked").each(function(){
			opt[this.value] = this.value;
			section = this.name
		});
		
		var optStr = opt.join("|")
		section = section.replace("[]","");
		
		if(section!="options") {
			spec = section;
		}
		
		var isAuction = 0;
		var CurrentUrl = window.location
		var patt=/auctions.html/g;
		var r=patt.test(CurrentUrl);
		if(r) {
			isAuction = 1;
		}
		
		
		jQuery.ajax({  
			type: "POST",  
			url: "lands.php?isAuction="+isAuction,  
			data: { options: optStr,action:"batchRemove",specialOption:spec,isAuction:isAuction},  
			success: function(theResponse) {
				jQuery("#listingFrame").html('<div id="loading" class="loading"></div>' + theResponse)
				jQuery("#loading").css("display","none")
				
				jQuery("#"+parentID+"Body :checkbox:checked").each(function(){
					jQuery(this).attr("checked",false);
				});
				
				jQuery("#"+parentID+" .anavgroupheaderclear").css('display',"none");
				
				var viewMode = jQuery(".map").hasClass("modeActive");
				
				if(viewMode) {
					if(isAuction){
						href="auctions.html"
					} else {
						location.href="land_for_sale.html"
					}
				}
			} 
		});
		
		return false;
	})
	
	jQuery(".generalgroupheaderclear").click(function(){
		loader();
		
		jQuery("#generalInfoBody input").val("");
		jQuery("#generalInfoBody select").val("");
		jQuery(".countiesLink").html("Counties");
		jQuery(".regionsLink").html("State areas");
		
		var isAuction = 0;
		var CurrentUrl = window.location
		var patt=/auctions.html/g;
		var r=patt.test(CurrentUrl);
		if(r) {
			isAuction = 1;
		}
		
		jQuery.ajax({  
			type: "POST",  
			url: "lands.php?isAuction="+isAuction,  
			data: {action:"clearGeneralInfo",isAuction:isAuction},  
			success: function(theResponse) {
				jQuery("#listingFrame").html('<div id="loading" class="loading"></div>' + theResponse)
				jQuery("#loading").css("display","none")
				
				jQuery(".generalgroupheaderclear").css('display',"none");
				
				var viewMode = jQuery("#view").val();
				if(viewMode=="map") {
					if(isAuction) {
						location.href="auctions.html"	
					} else {
						location.href="land_for_sale.html"
					}
				}
			} 
		});
		
		return false;
	})
	
	jQuery(".smallSearchBtn").click(function(){
		var priceMin 		 = jQuery("#priceMin").attr("value")
		var priceMax 		 = jQuery("#priceMax").attr("value")
		var priceAcreMin 	 = jQuery("#priceAcreMin").attr("value")
		var priceAcreMax 	 = jQuery("#priceAcreMax").attr("value")
		var totalAcresMin 	 = jQuery("#totalAcresMin").attr("value")
		var totalAcresMax 	 = jQuery("#totalAcresMax").attr("value")
		var openAcresMin 	 = jQuery("#openAcresMin").attr("value")
		var openAcresMax 	 = jQuery("#openAcresMax").attr("value")
		var croplandAcresMin = jQuery("#croplandAcresMin").attr("value")
		var croplandAcresMax = jQuery("#croplandAcresMax").attr("value")
		
			priceMin = priceMin.replace(/\,/g,'');
			priceMax = priceMax.replace(/\,/g,'');
			priceAcreMin = priceAcreMin.replace(/\,/g,'');
			priceAcreMax = priceAcreMax.replace(/\,/g,'');
			totalAcresMin = totalAcresMin.replace(/\,/g,'');
			totalAcresMax = totalAcresMax.replace(/\,/g,'');
			openAcresMin = openAcresMin.replace(/\,/g,'');
			openAcresMax = openAcresMax.replace(/\,/g,'');
			croplandAcresMin = croplandAcresMin.replace(/\,/g,'');
			croplandAcresMax = croplandAcresMax.replace(/\,/g,'');
		
		var errors = new Array();
		var price=0;
		var Acre =0;
		var totalAcres = 0;
		var openAcres = 0;
		var croplandAcres = 0;
		
		
		//******************************************
		if(isNaN(priceMin) || priceMin < 0){
			errors[errors.length] = "Price is invalid!";
			jQuery("#priceMin").addClass("redBorderField");
			price = 1
		} else {
			jQuery("#priceMin").removeClass("redBorderField");
		}
		
		if(isNaN(priceMax) || priceMax < 0){
			if(price!=1)
				errors[errors.length] = "Price is invalid!";
			jQuery("#priceMax").addClass("redBorderField");
		} else {
			jQuery("#priceMax").removeClass("redBorderField");
		}
		//******************************************
		
		if(isNaN(priceAcreMin) || priceAcreMin < 0){
			errors[errors.length] = "$/Acre is invalid!";
			jQuery("#priceAcreMin").addClass("redBorderField");
			Acre = 1;
		} else {
			jQuery("#priceAcreMin").removeClass("redBorderField");
		}
		
		if(isNaN(priceAcreMax) || priceAcreMax < 0){
			if(Acre!=1)
				errors[errors.length] = "$/Acre is invalid!";
			jQuery("#priceAcreMax").addClass("redBorderField");
		} else {
			jQuery("#priceAcreMax").removeClass("redBorderField");
		}
		//******************************************
		
		if(isNaN(totalAcresMin) || totalAcresMin < 0){
			errors[errors.length] = "Total Acres is invalid!";
			jQuery("#totalAcresMin").addClass("redBorderField");
			totalAcres = 1;
		} else {
			jQuery("#totalAcresMin").removeClass("redBorderField");
		}
		
		if(isNaN(totalAcresMax) || totalAcresMax < 0){
			if(totalAcres!=1)
				errors[errors.length] = "Total Acres is invalid!";
			jQuery("#totalAcresMax").addClass("redBorderField");
		} else {
			jQuery("#totalAcresMax").removeClass("redBorderField");
		}
		
		//************************************
		if(isNaN(openAcresMin) || openAcresMin < 0){
			errors[errors.length] = "Open Acres is invalid!";
			jQuery("#openAcresMin").addClass("redBorderField");
			openAcres = 1;
		} else {
			jQuery("#openAcresMin").removeClass("redBorderField");
		}
		
		if(isNaN(openAcresMax) || openAcresMax < 0){
			if(openAcres!=1)
				errors[errors.length] = "Open Acres is invalid!";
			jQuery("#openAcresMax").addClass("redBorderField");
		} else {
			jQuery("#openAcresMax").removeClass("redBorderField");
		}
		
		
		//************************************
		if(isNaN(croplandAcresMin) || croplandAcresMin < 0){
			errors[errors.length] = "Cropland Acres is invalid!";
			jQuery("#croplandAcresMin").addClass("redBorderField");
			croplandAcres = 1;
		} else {
			jQuery("#croplandAcresMin").removeClass("redBorderField");
		}
		
		if(isNaN(croplandAcresMax) || croplandAcresMax < 0){
			if(croplandAcres!=1)
				errors[errors.length] = "Cropland Acres is invalid!";
			jQuery("#croplandAcresMax").addClass("redBorderField");
		} else {
			jQuery("#croplandAcresMax").removeClass("redBorderField");
		}
		
		
		if(errors.length > 0) {
			var err = errors.join("<br />");
			jQuery("#someErr").html(err);
			jQuery("#someErr").css("display","block");
		
			return false;
		}
		
	});

	jQuery(".searchBtn").click(function(){
        
		var priceMin = jQuery("#priceMin").val();
		var priceMax = jQuery("#priceMax").val();
		var sizeMin = jQuery("#sizeMin").val();
		var sizeMax = jQuery("#sizeMax").val();
		
		priceMin = priceMin.replace(/\,/g,'');
		priceMax = priceMax.replace(/\,/g,'');
		sizeMin = sizeMin.replace(/\,/g,'');
		sizeMax = sizeMax.replace(/\,/g,'');
		

		var errors = new Array();
		
		
		if(isNaN(priceMin) || priceMin < 0) {
			jQuery("#priceMin").addClass("redBorderField")
		} else {
			jQuery("#priceMin").removeClass("redBorderField")
		}
		
		if(isNaN(priceMax) || priceMax < 0) {
			jQuery("#priceMax").addClass("redBorderField")
		} else {
			jQuery("#priceMax").removeClass("redBorderField")
		}
			
		if(isNaN(sizeMin) || sizeMin < 0) {
			jQuery("#sizeMin").addClass("redBorderField")
		} else {
			jQuery("#sizeMin").removeClass("redBorderField")
		}
		
		if(isNaN(sizeMax) || sizeMax < 0) {
			jQuery("#sizeMax").addClass("redBorderField")
		} else {
			jQuery("#sizeMax").removeClass("redBorderField")
		}
		
		if(isNaN(priceMin) || priceMin < 0 || isNaN(priceMax) || priceMax<0){
			errors.push("Price is invalid!");
		}
		
		if(isNaN(sizeMin) || sizeMin < 0 || isNaN(sizeMax) || sizeMax<0){
			errors.push("Size is invalid!");
		}
		
		if(errors.length > 0) {
			errString = errors.join("<br />");
			jQuery(".errorFrame").html(errString).css('display',"block")
			return false;
		} else {
			jQuery(".errorFrame").css('display',"none")
			jQuery("#searchLandFrm").submit();
			
		}
	})

	jQuery("#savesearchBtn").click(function(){
		var searchName = jQuery("#search_title").val();
		if(searchName == "") {
			jQuery(".contentSection #saveformMessageError").css('display',"block");
			jQuery(".contentSection #saveformMessageError").html('Search Name is required!');
		} else {
			jQuery(".contentSection #saveformMessageError").css('display',"none");
			jQuery(".contentSection .loader").css('display',"block");
			
			jQuery.ajax({  
				type: "POST",  
				url: "land_for_sale.php",  
				data: {searchName: searchName,saveSearchFormSubmited:1},  
				success: function(theResponse) {
					if(theResponse==1) {
						jQuery(".contentSection .loader").css('display',"none");
						jQuery(".contentSection .messageOk").css('display',"block");
						jQuery("#search_title").val("")
					} else {
						jQuery(".contentSection .loader").css('display',"none");
						jQuery(".contentSection #saveformMessageError").html('Click <a href="member.php">here</a> or use the login form at the top right.').css('display',"block");
					}
				}
			});
		}
	});
	
	
	jQuery(".setSearchCriteria").click(function(){
		var cid = this.id.split("_");
		
		jQuery.ajax({
			type: "POST",
			url: "land_for_sale.php",
			data: {searchId: cid[1],loadSaveSearch:1},  
				success: function(theResponse) {
					if(theResponse==1) {
						location.href="land_for_sale.html";	
					} else {
						alert("Unexpected error!");
					}
				}
			});	
		
		return false;
	})

	jQuery(".fav").click(function(){
		if(jQuery(this).hasClass('fav')) {
		
			var ids = this.id.split("_");
			var spanid = this.id
			jQuery.ajax({
				type: "POST",
				url: "land_for_sale.php",
				data: {propId: ids[1],saveAsFavorite:1},  
					success: function(theResponse) {
						if(theResponse==1) {
							jQuery("#"+spanid).removeClass("fav");
							jQuery("#"+spanid).addClass("isFav");
							
							if(ids[0]=="txt") {
								jQuery("#fav_"+ids[1]).html('<img src="images/template/star_full.png" title="This property is your favorite!" />')	
								jQuery("#favTxt").html('Fav')	
							} else {
								jQuery("#"+spanid).html('<img src="images/template/star_full.png" title="This property is your favorite!" />')
								jQuery("#favTxt").html('Fav')	
							}
							alert("Added to Favorites")
						} else {
							alert("You must be logged in to perform this action.\nIf you are not a user click on \"Sign Up\" at the top-right.");
						}
					}
			});	
			
		} 
		
		return false;
	})
	

    jQuery(".faqQuestion").click(function (e) {
        var questionID = this.id;
        var ids = questionID.split("_")
        
                
        if(jQuery("#a_"+ids[1]).hasClass("display")) {
            jQuery("#a_"+ids[1]).removeClass("display");    
        } else {
            jQuery(".faqAnswer").removeClass("display");
            jQuery("#a_"+ids[1]).addClass("display");    
        }
    }); 
   
    
    //check if we neet more description 
    jQuery("#fullDesc").css("height","auto");
    cHeight = jQuery("#fullDesc").height();
    
    if(cHeight <= initialDescHeight ) {
    	jQuery("#section2").hide();
    	jQuery("#fullDesc").css("height",parseInt(initialDescHeight)+16);
    } else {
    	jQuery("#fullDesc").css("height",initialDescHeight);
    }	
	
    
    
//    
//    
//	jQuery(".saveSearch").click(function(){
//		
//		jQuery("#saveSearchForm").modal({position: ["13%","41%"],
//									 opacity:70,
//									 overlayCss: {backgroundColor:"#000"},
//									 minHeight:20,
//									 minWidth:290,
//									 overlayClose:true,
//									 onShow:function(){xajax_generateRegionSelectionForm(document.getElementById('filter[state]').value,document.getElementById('regions').value)},
//									 onOpen: function (dialog) {
//											dialog.overlay.fadeIn('fast', function () {
//												dialog.data.hide();
//												dialog.container.fadeIn('fast', function () {
//													dialog.data.fadeIn('fast');
//												});
//											});
//									 }});
//	});										 
    
	
});


function loading (elementId,txt){
	document.getElementById(elementId).innerHTML = '<img src="images/template/smallloading.gif" align="absmiddle" />&nbsp;'+txt;
}

function addCommas(nStr,noDec)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	
	if(noDec > 0 &&  x.length > 1) {
		
		x2 = "." + x[1].substr(0,noDec);
	} else {
		x2 = "";
	}
	
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}



function stripCommas(frm) {
	if(frm="homepage") {
		jQuery("#searchLandFrm input").each(function(){
			alert("1")
		})
	}
}

function microtime (get_as_float) {
    // Returns either a string or a float containing the current time in seconds and microseconds  
    // 
    // version: 909.322
    // discuss at: http://phpjs.org/functions/microtime    // +   original by: Paulo Ricardo F. Santos
    // *     example 1: timeStamp = microtime(true);
    // *     results 1: timeStamp > 1000000000 && timeStamp < 2000000000
    var now = new Date().getTime() / 1000;
    var s = parseInt(now, 10); 
    return (get_as_float) ? now : (Math.round((now - s) * 1000) / 1000) + ' ' + s;
}

function showSaveForm(){
	jQuery("#saveSearchForm").modal({position: ["13%","41%"],
									 opacity:70,
									 overlayCss: {backgroundColor:"#000"},
									 minHeight:20,
									 minWidth:290,
									 overlayClose:true,
									 onShow:function(){xajax_generateRegionSelectionForm(document.getElementById('filter[state]').value,document.getElementById('regions').value)},
									 onOpen: function (dialog) {
											dialog.overlay.fadeIn('fast', function () {
												dialog.data.hide();
												dialog.container.fadeIn('fast', function () {
													dialog.data.fadeIn('fast');
												});
											});
									 }});
	
}