
////////////////////Home Google Map//////////
 var map = null;
 var geocoder = null;

 function initialize() {
	if (GBrowserIsCompatible()) {
	  map = new GMap2(document.getElementById("map_canvas"));
	  map.setCenter(new GLatLng(37.4419, -122.1419), 13);
	  geocoder = new GClientGeocoder();
	}
 }
 function showAddress(address,second_chance) {
	if (geocoder) {
	  geocoder.getLatLng(
		 address,
		 function(point) {
			if (!point) {
	////IF HOME NOT FOUND
			  //alert(address + " not found");
	if(second_chance!=1){
		var new_addr_s1=address.split(",");
		var new_addr=new_addr_s1[1]+", "+new_addr_s1[2];
		//alert(new_addr);
		//showAddress(new_addr,1);
		document.getElementById("map_canvas").innerHTML="";
	}		
			} else {
			  map.setCenter(point, 14);
			  var marker = new GMarker(point);
			  map.addOverlay(marker);
			}
		 }
	  );
	}
 }
 
function getXY(oElement,coord){
	if(coord=="y"){
		var iReturnValue = 0;
		while( oElement != null ) {
			iReturnValue += oElement.offsetTop;
			oElement = oElement.offsetParent;
		}
	}else if(coord=="x"){
		var iReturnValue = 0;
		while( oElement != null ) {
			iReturnValue += oElement.offsetLeft;
			oElement = oElement.offsetParent;
		}
	}
	return iReturnValue;
}

function navigation_add_sub(el,num, orientX, orientY){
	orientX = typeof(orientX) != 'undefined' ? orientX : 0 - 26; ////defaults to horitonzal positioning
	orientY = typeof(orientY) != 'undefined' ? orientY : 30;
	var winW = window_size('w');
	var winH = window_size('h');

	if(el!=null && num!=null){
		var fake_array=eval("n"+num);
		var mn=document.getElementById(el);
		var sn=document.getElementById("sub");
		if(fake_array.length>0){
			var nsn='<table cellpadding="0" cellspacing="0">\n';
			for(x=0;x<fake_array.length;x++){
				nsn=nsn+'\t<tr>\n';
				
							if(fake_array[x+1]=="JAVASCRIPT:ALERT"){
																	nsn=nsn+'\t\t<td class="navigation_sub_left"></td><td class="navigation_sub_off" onClick="alert(\'Here is an alert\');" onMouseOver="this.className=\'navigation_sub_over\';" onMouseOut="this.className=\'navigation_sub_off\';"><a href="Javascript:" class="hilite">';
							
							}else if(fake_array[x+1]=="JAVASCRIPT:CONTACT"){
																	nsn=nsn+'\t\t<td class="navigation_sub_left"></td><td class="navigation_sub_off" onClick="var cords=get_cords(event); final_popup(\'forms.php\',\'absolutes/\',\'$popup=1; $contact_type=\\\'Site Contact\\\';  $form=\\\'messenger_0521200801\\\'; $gray_num=1; $title=\\\'Contact Agent\\\'; $id_agent=\\\'\\\';\',\'popup_popup\',cords,1);" onMouseOver="this.className=\'navigation_sub_over\';" onMouseOut="this.className=\'navigation_sub_off\';"><a href="Javascript:" class="hilite">';
							
							}
							else if(fake_array[x+1]=="JAVASCRIPT:QSPOP"){
																	nsn=nsn+'\t\t<td class="navigation_sub_left"></td><td class="navigation_sub_off" onClick="var cords=\'center\'; final_popup(\'forms.php\',\'absolutes/\',\'$form=\\\'quick_search_dream_home\\\'; $show_qs_bkg=1;\',\'popup_popup\',cords,1);" onMouseOver="this.className=\'navigation_sub_over\';" onMouseOut="this.className=\'navigation_sub_off\';"><a href="Javascript:" class="hilite">';
							
							}
							else if(fake_array[x+1]=="JAVASCRIPT:SEARCH"){
																	nsn=nsn+'\t\t<td class="navigation_sub_left"></td><td class="navigation_sub_off" onClick="var cords=\'center\'; final_popup(\'search_advanced.php\',\'absolutes/\',\'$popup=1;\',\'home_detail_popup\',cords,1);" onMouseOver="this.className=\'navigation_sub_over\';" onMouseOut="this.className=\'navigation_sub_off\';"><a href="Javascript:" class="hilite">';
							
							}
												else{
						nsn=nsn+'\t\t<td class="navigation_sub_left"></td><td class="navigation_sub_off" onClick="make_link(\''+fake_array[x+1]+'\');" onMouseOver="this.className=\'navigation_sub_over\';" onMouseOut="this.className=\'navigation_sub_off\';"><a href="'+fake_array[x+1]+'" class="hilite">';
					}

				nsn=nsn+fake_array[x]+'</a></td><td class="navigation_sub_right"></td>\n';

				nsn=nsn+'\t</tr>';

				x++;
			}
			var cur_cell = document.getElementById("sub_nav"+num);
			var snw = document.getElementById("snw"+num);
			var tablecell = document.getElementById("tablecell"+num);

			var tbc_x = getXY(tablecell,"x");
			var tbc_y = getXY(tablecell,"y");

			//var half_width=((cur_cell.width-sn.width)/2);
			nsn=nsn+'</table>\n';
			sn.innerHTML=nsn;

			elemHeight = sn.clientHeight;
			//alert(tbc_y+orientY+elemHeight+' - '+winH);
			//alert(document.body.scrollTop);
			if((tbc_y+orientY+elemHeight)>(winH+document.body.scrollTop)){
				//newOrientY = (tbc_y+orientY)-(((winH+document.body.scrollTop)-(tbc_y+orientY+elemHeight))*-1);
				newOrientY = (tbc_y-elemHeight)+tablecell.clientHeight+orientY+30;
				sn.style.left=tbc_x+orientX;
				sn.style.top=newOrientY-30;
			}else{
				sn.style.left=tbc_x+orientX;
				sn.style.top=tbc_y+orientY;
			}

		}else{
			var sn=document.getElementById("sub");
			sn.innerHTML='';
			sn.style.left=0;
			sn.style.top=0;
		}
	}else{
		var sn=document.getElementById("sub");
		sn.innerHTML='';
		sn.style.left=0;
		sn.style.top=0;
	}
}
function navigation_remove_sub(){
	var sn=document.getElementById("sub");
	sn.innerHTML='';
	sn.style.left=0;
	sn.style.top=0;
}

function window_size(ret){
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			winW = window.innerWidth;
			winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			winW = document.body.offsetWidth;
			winH = document.body.offsetHeight;
		}
	}
	if (winW <= 695){
		winW = 695;
	}
	if(ret=="h"){
		return winH;
	}else if(ret=="w"){
		return winW;
	}
}

function make_link(url) {
	window.location.href = url; 
}

function mysql_jax(file,path,vars,redirect){
	//alert('in mjax');
	delete mysqljax;
	var mysqljax;
	try{
		// Opera 8.0+, Firefox, Safari
		mysqljax = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			mysqljax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				mysqljax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	mysqljax.onreadystatechange = function(){
		if(mysqljax.readyState == 4){
			//This function is just to send vars to be inserted into mysql dbs thus it returns nothing...
			final_results = mysqljax.responseText;

			if(redirect!=undefined){
				window.location = redirect;
			}
		}

	}
	
	var queryString = "vars="+vars;
	//can add variables above to specify search file

	mysqljax.open("POST", path+file, true);
	mysqljax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	mysqljax.setRequestHeader("Content-length", queryString.length);
	mysqljax.setRequestHeader("Connection", "close");
	mysqljax.send(queryString);
}

function final_jax(file,path,vars,div_name){
	delete finaljax;
	var finaljax;
	try{
		// Opera 8.0+, Firefox, Safari
		finaljax = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			finaljax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				finaljax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	finaljax.onreadystatechange = function(){
		if(finaljax.readyState == 4){

			final_results = finaljax.responseText;
			var final_replace=document.getElementById(div_name);
			final_replace.innerHTML=final_results;

			var final_replace2=document.getElementById(div_name);
			final_replace2.innerHTML=final_replace.innerHTML;
		}

	}
	
	var queryString = "vars="+vars;
	//can add variables above to specify search file

	finaljax.open("POST", path+file, true);
	finaljax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	finaljax.setRequestHeader("Content-length", queryString.length);
	finaljax.setRequestHeader("Connection", "close");
	finaljax.send(queryString);
}
function final_popup(file,path,vars,div_name,cords,gray_out){
	if(cords!="" && cords!="center" && cords!="under" && cords!="br" && cords!="br2")
		eval(cords);
	delete popupjax_new;
	var popupjax_new;
	try{
		// Opera 8.0+, Firefox, Safari
		popupjax_new = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			popupjax_new = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				popupjax_new = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	popupjax_new.onreadystatechange = function(){
		if(popupjax_new.readyState == 4){
			//alert('Popup 1');
			final_results = popupjax_new.responseText;
			if(document.getElementById(div_name)!=null){
				var final_replace=document.getElementById(div_name);
				final_replace.innerHTML=final_results;
			}
			
			//alert(cords+" "+div_name);

			if(cords=='center'){
				var winW = 1024, winH = 786;
				if (parseInt(navigator.appVersion)>3) {
					if (navigator.appName=="Netscape") {
						winW = window.innerWidth;
						winH = window.innerHeight;
					}
					if (navigator.appName.indexOf("Microsoft")!=-1) {
						winW = document.body.offsetWidth;
						winH = document.body.offsetHeight;
					}
				}


				if(div_name=="home_detail_popup"){
					close_popups(0,'main_h_search_form',0);
					if(file=="search_advanced.php"){
						var hd_left=((winW-800)/2);
						final_replace.style.width = '800px';
						final_replace.style.height = '400px';
							final_replace.style.top=(document.body.scrollTop+25)+'px';                          
							final_replace.style.left=hd_left;
					}else{
						var hd_left=((winW-1000)/2);
						final_replace.style.width = '1000px';
						final_replace.style.height = '600px';
							final_replace.style.top=(document.body.scrollTop+25)+'px';                          
							final_replace.style.left=hd_left;
						var fetch_js_exe=document.getElementById('js_exe');
						eval(fetch_js_exe.innerHTML);
					}

					//alert('Center');
				}
				if(div_name=="popup_popup"){
					var hd_left=((winW-450)/2);
					final_replace.style.width = '450px';
							final_replace.style.top=(document.body.scrollTop+75)+'px';                          
							final_replace.style.left=hd_left;
				}
				if(div_name=="advanced_search"){
					close_popups(0,'main_h_search_form',0);
				}
			}else if(cords=="under"){
				var sc_obj=document.main_search.search_city;
				var sc_xpos=findPos(sc_obj,"x");
				var sc_ypos=findPos(sc_obj,"y");
				sc_ypos=parseInt(sc_ypos);
				sc_xpos=parseInt(sc_xpos)+120;
//document.body.scrollTop+
				final_replace.style.width = 150;
						final_replace.style.top=(sc_ypos)+'px';                          
						final_replace.style.left=sc_xpos;
				final_replace.style.height='200px';
				final_replace.style.overflow='auto';
				final_replace.style.textAlign='left';
			}else if(cords=="br"){
				final_replace.style.width = 403;
						//final_replace.style.right=200;
				final_replace.style.height=195;
						//final_replace.style.bottom= 200;
				final_replace.style.textAlign='left';
				var twin_h = document.body.clientHeight + 0;
				var twin_w = document.body.clientWidth + 0;
				//alert (twin_h + " - " + twin_w);

				final_replace.style.top=twin_h - 197;                          
				final_replace.style.left=twin_w - 407;

			}else if(cords=="br2"){
				final_replace.style.width = 227;
						//final_replace.style.right=201;
				final_replace.style.height=300;
						//final_replace.style.bottom= 200;
				final_replace.style.textAlign='left';
			}else{
				
				if (mX < 0){mX = 0;}
				if (mY < 0){mY = 0;}
				move=document.getElementById(div_name);
				if (navigator.appName=="Netscape") {
					winH=winH+(move.offsetHeight/2);
				}
				if(mX+move.offsetWidth>winW){
					mX=mX-move.offsetWidth;
				}else if(mX-(move.offsetWidth/2)<0){
					mX=mX;
				}else{
					mX=mX-(move.offsetWidth/2);
				}
			
				if(mY+move.offsetHeight>winH){
					mY=mY-move.offsetHeight;
				}else if(mY-(move.offsetHeight/2)<0){
					mY=mY;
				}else{
					mY=mY-(move.offsetHeight/2);
				}
				move.style.left=mX;
				move.style.top=mY;
			}
		}

	}
	
	var queryString = "vars="+vars;
	//can add variables above to specify search file

	popupjax_new.open("POST", path+file, true);
	popupjax_new.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	popupjax_new.setRequestHeader("Content-length", queryString.length);
	popupjax_new.setRequestHeader("Connection", "close");
	popupjax_new.send(queryString);
	
	var e = window.event||window.Event;
	//get_cords(e,div_name);
	if(gray_out==1){
		grayOutOnly(true)
	}
}

function close_popups(gray_out,div,resize){
	//alert(resize);
	if(resize!=0){
		//alert("is_null");
		resize=1;
	}

	var close_pops;
	if(div!=undefined && div!=""){
		//alert("1 "+div);
		if(document.getElementById(div)!=null){
			close_pops=document.getElementById(div);
			close_pops.innerHTML="";
		}
	}else{
		//alert("2 "+div);
		if(document.getElementById('popup_popup')!=null){
			close_pops=document.getElementById('popup_popup');
			close_pops.innerHTML="";
		}
	}

	if(resize==1){
		//alert("resize");
		close_pops.style.width="0px";
		close_pops.style.height="0px";
	}
	if(gray_out==1){
		grayOutOnly(false)
	}
}

function grayOutOnly(vis, options) {

	var options = options || {}; 
	var zindex = 20;
	var opacity = options.opacity || 70;
	var opaque = (opacity / 100);
	var bgcolor = options.bgcolor || '#000000';
	var dark=document.getElementById('darkenScreenObject');
	if (!dark) {
			var tbody = document.getElementsByTagName("body")[0];
			var tnode = document.createElement('div');           
			tnode.style.position='absolute';                
			tnode.style.top='0px';                          
			tnode.style.left='0px';                         
			tnode.style.overflow='hidden';                         
			tnode.style.display='none';                   
			tnode.id='darkenScreenObject';                
			tbody.appendChild(tnode);                           
			dark=document.getElementById('darkenScreenObject'); 
	}
	if (vis) {
		close_popups(0,'main_h_search_form',0);

			if(document.body && ( document.body.scrollWidth || document.body.scrollHeight ) ) {
				var pageWidth = document.body.scrollWidth+'px';
				var pageHeight = document.body.scrollHeight+'px';
			} else if( document.body.offsetWidth ) {
					var pageWidth = document.body.offsetWidth+'px';
					var pageHeight = document.body.offsetHeight+'px';
			} else {
					var pageWidth='100%';
					var pageHeight='100%';
			}   
			dark.style.opacity=opaque;                      
			dark.style.MozOpacity=opaque;                   
			dark.style.filter='alpha(opacity='+opacity+')'; 
			dark.style.zIndex=zindex;        
			dark.style.backgroundColor=bgcolor;  
			dark.style.width= pageWidth;
			dark.style.height= pageHeight;
			dark.style.display='block';				 
	} else {
		  if(document.getElementById('main_h_search_form')){
				final_jax('forms.php','absolutes/','\$form=\'main_dream_home_search\';','main_h_search_form');
			//alert('here');
		  }
		  dark.style.display='none';
	}
}

//////////////////////IMG FADING SCRIPT//////////////////
var img_on_top="img2";
var has_run_init_funcs=0;
function initial_img_fader_actions(){
	if(has_run_init_funcs==0){
		var sec_div=document.getElementById('img2');
		sec_div.style.position='absolute';
		sec_div.style.top=116; //findPos(document.getElementById('img1'),'y');
		sec_div.style.left=0; //findPos(document.getElementById('img1'),'x');
		opacity('img2', 100, 0, 10, 'img2');
		has_run_init_funcs=1;
	}
}

function opacity(id, opacStart, opacEnd, millisec, prev_id) {
	//millisec=millisec+2000;
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

	var cur_pic=document.getElementById(id);
	var last_pic=document.getElementById(prev_id);

	cur_pic.style.zIndex=101;
	last_pic.style.zIndex=100;
	//alert(last_pic);

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
    setTimeout("changeOpac(0,'" + prev_id + "')", millisec);
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function findPos(obj,coord) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
		if(coord=="x"){
			return [curleft];
		}else{
			return [curtop];
		}
	}
}

function fade_img(image_path,next){
	var prev;
	if(next=='img1'){
		var cur_pic=document.getElementById(next);	
		var last_pic=document.getElementById('img2');	
		image_on_top="img2";
		prev="img2";
	}else if(next=='img2'){
		var cur_pic=document.getElementById(next);	
		var last_pic=document.getElementById('img1');	
		image_on_top="img1";
		prev="img1";
	}

	cur_pic.src=image_path;
	setTimeout("opacity('" + next + "', 0, 100, 500, '" + prev + "')", 750);

	return image_on_top;
}
/////////////////////////////////

function user_validate(frm){
		//alert("here 1"+frm);
		j=frm.elements.length;
		var temp="";
		var error_fail=0;
		for(x=0;x<j;x++){
			var tp=frm.elements[x].type;
			var tl=frm.elements[x].title;
			var val=frm.elements[x].value;
			var nm=frm.elements[x].name;
			var found_error=0;
			var rule=tl.split("|");
			//alert(tp + "- "+tl+" - "+val+" - "+nm+" - "+rule[0]);
			
			if(tp=="text"){
				if(tl=="empty"){
					//alert("Made It");
					var tstring="";
					cln_spcs=val.split(" ");
					for(i=0;i<cln_spcs.length;i++)
						tstring+=cln_spcs[i];
					if(tstring==null || tstring==""){
						//alert(nm+" in null");
						
						frm.elements[x].value="";
						var er_msg="Invalid Content.";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
						found_error=1;
					}else{
						var er_msg="";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
					}
					
				}else if(tl=="zip"){
					var tstring="";
					cln_spcs=val.split(" ");
					for(i=0;i<cln_spcs.length;i++)
						tstring+=cln_spcs[i];
					if(tstring==null || tstring==""){
						frm.elements[x].value="";
						var er_msg="Zip is required for listings in your area to be properly displayed.";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
						found_error=1;
					}
				}else if(rule[0]=="email_match"){
					var tstring=Trim(val);
					var val2=eval("frm."+rule[1]);
					var tstring2=Trim(val2.value);
					if(tstring!=null || tstring!=""){
						if(tstring!=tstring2){
							
							var er_msg="Email accounts do not match.  Please check spelling.";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;	
						}
						var rslt=echeck(val);
						if(rslt==false){
							
							var er_msg="Invalid email address.";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;
						}
					}else{
						
						var er_msg="Invalid email address.";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
						found_error=1;
					}
				}else if(rule[0]=="email" || rule[0]=="email_null"){
					var tstring=Trim(val);
					if(tstring!=null && tstring!=""){
						//alert("="+tstring+"=");
						var rslt=echeck(tstring);
						if(rslt==false){							
							var er_msg="Invalid email address. 2";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;
						}
					}else{
						if(rule[0]!="email_null"){
							alert(rule[0]);
							var er_msg="Invalid email address. 3";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;
						}
					}
				}
			}else if(tp=="select-one"){
				//alert(nm);
				if(tl=="empty"){
					//alert(tl);
					//alert(val);
					if(val==null || val=="" || val=="0"){
						
						var er_msg="Select Option.";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
						found_error=1;
					}
				}
			}else if(tp=="checkbox"){
				if(rule[0]=="agree"){
					if(frm.elements[x].checked==false){
						var er_msg="You have to agree to proceed forward.";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
						found_error=1;
					}
				}
			}else if(tp=="password"){
				if(rule[0]=="password"){
					//alert("made pass");
					var tstring=Trim(val);
					//alert(tstring);
					var val2=eval("frm."+rule[1]);
					var tstring2=Trim(val2.value);
					if(tstring!=null && tstring!=""){
						if(tstring!=tstring2){
							var er_msg="Passwords do not match.";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;	
						}else if(tstring.length<6){
							var er_msg="Passwords must be at least 6 characters long.";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;	
						}else if(tstring2.length<6){
							var er_msg="Passwords must be at least 6 characters long.";
							var out = eval("document.getElementById('"+nm+"_er_msg')");
							if(out!=null)	out.innerHTML=er_msg;
							found_error=1;	
						}
						
					}else{
						var er_msg="Please enter a valid password.";
						var out = eval("document.getElementById('"+nm+"_er_msg')");
						if(out!=null)	out.innerHTML=er_msg;
						found_error=1;
					}
				}
			}
			if(found_error==0){
				var er_msg="";
				var out = eval("document.getElementById('"+nm+"_er_msg')");
				if(out!=null)	out.innerHTML=er_msg;
			}else{
				error_fail=1;
			}
			temp+=frm.elements[x].type+"\n";
			temp+=frm.elements[x].title+"\n";
			temp+=frm.elements[x].value+"\n";
			
		}
		//alert(temp);
		if(error_fail==1){
			return false;
		}else{
			check_user_name(frm)
		}
	}
	
	function check_user_name(frm){
		//alert("here 2"+frm);
		delete userChkJax;
		var userChkJax;
		try{
			// Opera 8.0+, Firefox, Safari
			userChkJax = new XMLHttpRequest();
		} catch (e){
			// Internet Explorer Browsers
			try{
				userChkJax = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try{
					userChkJax = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e){
					// Something went wrong
					alert("Your browser broke!");
					return false;
				}
			}
		}
		// Create a function that will receive data sent from the server
		userChkJax.onreadystatechange = function(){
			if(userChkJax.readyState == 4){

				final_results = userChkJax.responseText;
				//alert(final_results);
				if(final_results=="true"){
					frm.submit();
				}else if(final_results=="false"){
					var er_msg="Email Address is already being used, please enter a new email address.";
					var out = eval("document.getElementById('primary_email_er_msg')");
					if(out!=null)	out.innerHTML=er_msg;
				}
			}
		}
		
		var queryString = "?sql_op=validate_emailuser&primary_email="+frm.primary_email.value;
		//can add variables above to specify search file

		userChkJax.open("POST", "quick_sign_up.php"+ queryString, true);
		userChkJax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		userChkJax.setRequestHeader("Content-length", queryString.length);
		userChkJax.setRequestHeader("Connection", "close");
		userChkJax.send(queryString);
	}

	function Trim(str) {
		return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
	}
	function echeck(str) {
		var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
		if(pattern.test(str))
			return true;
		else
			return false;
	}
	function SwitchMenuSmart(obj, styleName, hideOthers){
		//// if hideOthers is equal to 1, then it will only allow one div at a time to show up, else it will allow you to open and close them all as you see fit
		if(document.getElementById){
			var el = document.getElementById(obj);
			var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
			if(el.style.display != "block"){ 
				for (var i=0; i<ar.length; i++){
					if(hideOthers==1){
						if (ar[i].className==styleName) 
							ar[i].style.display = "none";
					}
				}
				el.style.display = "block";
			}else{
				el.style.display = "none";
			}
		}
	}
	function get_cords(e){
		var IE_check = document.all?true:false;
		if(!e) var e = window.event||window.Event;

		var mX = 0;
		var mY = 0;

		if (IE_check) {
			mX = e.clientX;			
			mY = e.clientY;
		}else{
			mX = e.pageX;
			mY = e.pageY;
			//alert("e3: "+e+" | mX:"+mX+" | mY:"+mY);
		}

		if (navigator.appName=="Netscape") {
			var winW = window.innerWidth;
			var winH = window.innerHeight;
		}
		if (navigator.appName.indexOf("Microsoft")!=-1) {
			var winW = document.body.scrollWidth;
			var winH = document.body.scrollHeight;
		}
		var cc = "var mX="+ mX +"; var mY="+ mY +"; winW="+winW+"; winH="+winH+";";
		return cc;
	}
	function compute_dreamjax_request(id_lstng,id_user,state,this_action,emailed_to){
		delete dreamjax;
		var dreamjax;
		try{
			// Opera 8.0+, Firefox, Safari
			dreamjax = new XMLHttpRequest();
		} catch (e){
			// Internet Explorer Browsers
			try{
				dreamjax = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try{
					dreamjax = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e){
					// Something went wrong
					alert("Your browser broke!");
					return false;
				}
			}
		}
		// Create a function that will receive data sent from the server
		dreamjax.onreadystatechange = function(){
			if(dreamjax.readyState == 4){
				dream_results = dreamjax.responseText;
				//var popup_replace=document.getElementById('overlay_popup');
				//popup_replace.innerHTML=dream_results;

				var split_dpr = dream_results.split("-");

				if(document.getElementById('dream_num')!=null){
					var dream_num_replace=document.getElementById('dream_num');
					dream_num_replace.innerHTML=split_dpr[2];
				}

				if(document.getElementById('prospect_num')!=null){
					var prospect_num_replace=document.getElementById('prospect_num');
					prospect_num_replace.innerHTML=split_dpr[1];
				}

				if(this_action=="1"){
					if(document.getElementById('lstng_dreamjax_'+id_lstng)!=null){
						var prospect_d_replace=document.getElementById('lstng_dreamjax_'+id_lstng);
						prospect_d_replace.innerHTML=split_dpr[3];
					}
					if(document.getElementById('lstng_dreamjax_'+id_lstng+'_p')!=null){
						var prospect_d_replace_p=document.getElementById('lstng_dreamjax_'+id_lstng+'_p');
						prospect_d_replace_p.innerHTML=split_dpr[0];
					}
				}else if(this_action=="2"){
					if(document.getElementById('lstng_prospectjax_'+id_lstng)!=null){
						var prospect_p_replace=document.getElementById('lstng_prospectjax_'+id_lstng);
						prospect_p_replace.innerHTML=split_dpr[3];
					}
					if(document.getElementById('lstng_prospectjax_'+id_lstng+'_p')!=null){
						var prospect_p_replace_p=document.getElementById('lstng_prospectjax_'+id_lstng+'_p');
						prospect_p_replace_p.innerHTML=split_dpr[0];
					}
				}



			}
	
		}
		//alert('here'+state);
		var queryString = "id_lstng="+id_lstng+"&id_user="+id_user+"&state="+state+"&this_action="+this_action+"&emailed_to="+emailed_to;
		//can add variables above to specify search file

		dreamjax.open("POST", "absolutes/property_denote.php", true);
		dreamjax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		dreamjax.setRequestHeader("Content-length", queryString.length);
		dreamjax.setRequestHeader("Connection", "close");
		dreamjax.send(queryString);
		
		//var popup_replace=document.getElementById('overlay_popup');
		//popup_replace.innerHTML="Success";
		//grayOut(false);
	}

	function ratejax_request(id_lstng,id_user,vote,state){
		delete ratejax;
		var ratejax;
		try{
			// Opera 8.0+, Firefox, Safari
			ratejax = new XMLHttpRequest();
		} catch (e){
			// Internet Explorer Browsers
			try{
				ratejax = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try{
					ratejax = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e){
					// Something went wrong
					alert("Your browser broke!");
					return false;
				}
			}
		}
		// Create a function that will receive data sent from the server
		ratejax.onreadystatechange = function(){
			if(ratejax.readyState == 4){
				rate_results = ratejax.responseText;

				var split_rtr = rate_results.split("-(-)-");
				//alert(split_rtr[0]+' OMG '+split_rtr[1]);


				if(document.getElementById('rating_num')!=null){
					var rate_num_replace=document.getElementById('rating_num');
					rate_num_replace.innerHTML=split_rtr[1];
				}
				if(document.getElementById('lstng_rate_'+id_lstng)!=null){
					var rater_replace=document.getElementById('lstng_rate_'+id_lstng);
					rater_replace.innerHTML=split_rtr[0];
				}
				if(document.getElementById('lstng_rate_'+id_lstng+'_p')!=null){
					var rater_replace_p=document.getElementById('lstng_rate_'+id_lstng+'_p');
					rater_replace_p.innerHTML=split_rtr[0];
				}

				//rater_replace.innerHTML=rate_results;
				//rater_replace.innerHTML='Submitted';
			}
	
		}
		
		var queryString = "id_lstng="+id_lstng+"&id_user="+id_user+"&vote="+vote+"&state="+state;
		//can add variables above to specify search file

		ratejax.open("POST", "absolutes/ratejax.php", true);
		ratejax.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		ratejax.setRequestHeader("Content-length", queryString.length);
		ratejax.setRequestHeader("Connection", "close");
		ratejax.send(queryString);
		
		//var popup_replace=document.getElementById('overlay_popup');
		//popup_replace.innerHTML="Success";
		//grayOut(false);
	}