function validateSearchOffer(form, v){
if(form.pricefrom.value.length > 0 && !isReal(form.pricefrom)){
alert('Introduceti o valoare corecta pentru campul \'Pret\'!');
form.pricefrom.select();
return false;
}
if(form.priceto.value.length > 0 && !isReal(form.priceto)){
alert("Introduceti o valoare corecta pentru campul \'Pret\'!");
form.priceto.select();
return false;
}
if(form.unitpricefrom + "" != "undefined"){
if(form.unitpricefrom.value.length > 0 && !isReal(form.unitpricefrom)){
alert("Introduceti o valoare corecta pentru campul \'Pret/mp\'!!");
form.unitpricefrom.select();
return false;
}
if(form.unitpriceto.value.length > 0 && !isReal(form.unitpriceto)){
alert("Introduceti o valoare corecta pentru campul \'Pret/mp\'!!");
form.priceto.select();
return false;
}
if(form.pricefrom.value.length > 0 && form.priceto.value.length > 0){
if(form.priceto.value < form.pricefrom.value){
alert("Primul pret trebuie sa fie mai mic decat cel de al doilea!");
form.priceto.focus();
return false;
}
}
}
if(form.roomsfrom + "" != "undefined"){
if(form.roomsfrom.value.length > 0 && !isInteger(form.roomsfrom)){
alert("Introduceti o valoare corecta pentru campul \'Numar camere\'!");
form.roomsfrom.select();
return false;
}
if(form.roomsto.value.length > 0 && !isInteger(form.roomsto)){
alert("Introduceti o valoare corecta pentru campul \'Numar camere\'!");
form.roomsto.select();
return false;
}
if(form.roomsfrom.value.length > 0 && form.roomsto.value.length > 0){
if(form.roomsto.value < form.roomsfrom.value){
alert("Primul numar de camere trebuie sa fie mai mic decat cel de al doilea!");
form.roomsto.focus();
return false;
}
}
}
if(form.areasizefrom + "" != "undefined"){
if(form.areasizefrom.value.length > 0 && !isReal(form.areasizefrom)){
alert("Va rugam introduceti o valoare corecta pentru campul \'Suprafata\'!");
form.areasizefrom.select();
return false;
}
if(form.areasizeto.value.length > 0 && !isReal(form.areasizeto)){
alert("Va rugam introduceti o valoare corecta pentru campul \'Suprafata\'!");
form.areasizeto.select();
return false;
}
if(form.areasizefrom.value.length > 0 && form.areasizeto.value.length > 0){
if(form.areasizeto.value < form.areasizefrom.value){
alert("Prima valoare din campul 'Suprafata' trebuie sa fie mai mica decat cea de a doua!");
form.areasizeto.focus();
return false;
}
}
}
if(form.lotareasizefrom + "" != "undefined"){
if(form.lotareasizefrom.value.length > 0 && !isReal(form.lotareasizefrom)){
alert("VVa rugam introduceti o valoare corecta pentru campul \'Suprafata teren\'!");
form.lotareasizefrom.select();
return false;
}
if(form.lotareasizeto.value.length > 0 && !isReal(form.lotareasizeto)){
alert("Va rugam introduceti o valoare corecta pentru campul \'Suprafata teren\'!");
form.lotareasizeto.select();
return false;
}
if(form.lotareasizefrom.value.length > 0 && form.lotareasizeto.value.length > 0){
if(form.lotareasizeto.value < form.lotareasizefrom.value){
alert("Prima valoare din campul 'Suprafata teren' trebuie sa fie mai mica decat cea de a doua!");
form.lotareasizeto.focus();
return false;
}
}
}
if(form.streetsizefrom + "" != "undefined"){
if(form.streetsizefrom.value.length > 0 && !isInteger(form.streetsizefrom)){
alert("Va rugam introduceti o valoare corecta pentru campul \'Front stradal\'!");
form.streetsizefrom.select();
return false;
}
if(form.streetsizeto.value.length > 0 && !isInteger(form.streetsizeto)){
alert("Va rugam introduceti o valoare corecta pentru campul \'Front stradal\'!");
form.streetsizeto.select();
return false;
}
if(form.streetsizefrom.value.length > 0 && form.streetsizeto.value.length > 0){
if(form.streetsizeto.value < form.streetsizefrom.value){
alert("Prima valoare din campul \'Front stradal\' trebuie sa fie mai mica decat cea de a doua!");
form.streetsizeto.focus();
return false;
}
}
}
if(form.floornumberfrom + "" != "undefined"){
if(form.floornumberfrom.value.length > 0 && !isInteger(form.floornumberfrom)){
alert("Introduceti o valoare corecta pentru campul \'Numarul etajului\'!");
form.floornumberfrom.select();
return false;
}
if(form.floornumberto.value.length > 0 && !isInteger(form.floornumberto)){
alert("Introduceti o valoare corecta pentru campul \'Numarul etajului\'!");
form.floornumberto.select();
return false;
}
if(form.floornumberto.value.length > 0 && form.floornumberfrom.value.length > 0){
if(form.floornumberto.value < form.floornumberfrom.value){
alert("Primul numar al etajului trebuie sa fie mai mic decat cel de al doilea!");
form.floornumberto.focus();
return false;
}
}
}
if(form.constructionyearfrom + "" != "undefined"){
if(form.constructionyearfrom.value.length > 0 && !isInteger(form.constructionyearfrom)){
alert("Dati un an de constructie valid!");
form.constructionyearfrom.focus();
return false;
}
if(form.constructionyearto.value.length > 0 && !isInteger(form.constructionyearto)){
alert("Dati un an de constructie valid!");
form.constructionyearto.focus();
return false;
}
if(form.constructionyearfrom.value.length > 0 && (form.constructionyearfrom.value < 1800 || form.constructionyearfrom.value > new Date().getFullYear())){
alert("Dati un an de constructie intre 1800 si " + new Date().getFullYear() + "!");
form.constructionyearfrom.focus();
return false;
}
if(form.constructionyearto.value.length > 0 && (form.constructionyearto.value < 1800 || form.constructionyearto.value > new Date().getFullYear())){
alert("Dati un an de constructie intre 1800 si " + new Date().getFullYear() + "!");
form.constructionyearto.focus();
return false;
}
if(form.constructionyearfrom.value > form.constructionyearto.value){
alert("Primul an de constructie nu trebuie sa fie mai mare decat cel de al doilea!");
form.constructionyearto.focus();
return false;
}
}
form.search.value = "yes";
return true;
}
function toggleFields(form){
truthval = (isbuilding[form.typeid.selectedIndex]) ? true : false;
inactivecolor = truthval ? "#ffffff" : "#f0f0f0";
form.roomsfrom.disabled = !truthval;
form.roomsfrom.style.background = inactivecolor;
form.roomsto.disabled = !truthval;
form.roomsto.style.background = inactivecolor;
form.roomstype.disabled = !truthval;
form.roomstype.style.background = inactivecolor;
form.confort.disabled = !truthval;
form.confort.style.background = inactivecolor;
form.confort.disabled = !truthval;
form.confort.style.background = inactivecolor;
form.confort.disabled = !truthval;
form.confort.style.background = inactivecolor;
form.constructionyearfrom.disabled = !truthval;
form.constructionyearfrom.style.background = inactivecolor;
form.constructionyearto.disabled = !truthval;
form.constructionyearto.style.background = inactivecolor;
form.floornumberfrom.disabled = !truthval;
form.floornumberfrom.style.background = inactivecolor;
form.floornumberto.disabled = !truthval;
form.floornumberto.style.background = inactivecolor;
/*
for(i=0; i < form.elements.length; i++){
if(form.elements[i].type == "checkbox" && form.elements[i].name.indexOf("feature") == 0){
form.elements[i].disabled = !truthval;
}
}
*/
}
function submitFromScope(form, scriptname, scopequerystring){
document.location.href = scriptname + "?" + scopequerystring + (scopequerystring == "" ? "?" : "&") + "scope=" + form.scope.value + "&countyid=" + form.countyid.value
}
function openOfferDetails(offerid){
var height = (window.screen.availHeight > 600 ? 600 : window.screen.availHeight - 100);
var width = (window.screen.availWidth > 640 ? 640 : window.screen.availWidth - 100);
openCenterWindowWithScrollbars("offerdetails_blank.php?offerid=" + offerid + "&width=" + width, "view_details_" + offerid, width, height);
}
function openOfferDetails2(offerid, rootpath){
var height = (window.screen.availHeight > 600 ? 600 : window.screen.availHeight - 100);
var width = (window.screen.availWidth > 640 ? 640 : window.screen.availWidth - 100);
openCenterWindowWithScrollbars(rootpath + "/offer/offerdetails_blank.php?offerid=" + offerid + "&width=" + width, "view_details_" + offerid, width, height);
}
function checkPeriod(form, index){
form.periodtype[index].checked = true;
}
function resetForm(form){
form.typeid.selectedIndex = 0;
form.scope.selectedIndex = 0;
if(form.countyid + "" != "undefined") form.countyid.selectedIndex = 0;
if(form.city + "" != "undefined") form.city.value = "";
if(form.cartier + "" != "undefined") form.cartier.value = "";
if(form.zone + "" != "undefined") form.zone.value = "";
if(form.address + "" != "undefined") form.address.value = "";
if(form.pricefrom + "" != "undefined") form.pricefrom.value = "";
if(form.priceto + "" != "undefined") form.priceto.value = "";
if(form.unitpricefrom + "" != "undefined") form.unitpricefrom.value = "";
if(form.unitpriceto + "" != "undefined") form.unitpriceto.value = "";
if(form.period + "" != "undefined") form.periodtype.selectedIndex = 0;
//if(form.datefrom + "" != "undefined") form.datefrom.value = "";
//if(form.dateto + "" != "undefined") form.dateto.value = "";
if(form.periodtype + "" != "undefined") form.periodtype[0].checked = true;
if(form.roomstype + "" != "undefined") form.roomstype.selectedIndex = 0;
if(form.wallstype + "" != "undefined") form.wallstype.selectedIndex = 0;
if(form.confort + "" != "undefined") form.confort.selectedIndex = 0;
if(form.roomsfrom + "" != "undefined") form.roomsfrom.value = "";
if(form.roomsto + "" != "undefined") form.roomsto.value = "";
if(form.areasizefrom + "" != "undefined") form.areasizefrom.value = "";
if(form.areasizeto + "" != "undefined") form.areasizeto.value = "";
if(form.lotareasizefrom + "" != "undefined") form.lotareasizefrom.value = "";
if(form.lotareasizeto + "" != "undefined") form.lotareasizeto.value = "";
if(form.streetsizefrom + "" != "undefined") form.streetsizefrom.value = "";
if(form.streetsizeto + "" != "undefined") form.streetsizeto.value = "";
if(form.floornumberfrom + "" != "undefined") form.floornumberfrom.value = "";
if(form.floornumberto + "" != "undefined") form.floornumberto.value = "";
if(form.buildingfloorsnumberfrom + "" != "undefined") form.buildingfloorsnumberfrom.value = "";
if(form.buildingfloorsnumberto + "" != "undefined") form.buildingfloorsnumberto.value = "";
if(form.constructionyearfrom + "" != "undefined") form.constructionyearfrom.value = "";
if(form.constructionyearto + "" != "undefined") form.constructionyearto.value = "";
if(form.buildingtype + "" != "undefined") form.buildingtype.selectedIndex = 0;
if(form.fieldtype + "" != "undefined") form.fieldtype.selectedIndex = 0;
if(form.description + "" != "undefined") form.description.value = "";
if(form.unknownprice + "" != "undefined") form.unknownprice.checked = true;
}
function chooseCounty(form){
if(form.countyid.value == 10){//Bucuresti
form.city.value = "Bucuresti"
document.getElementById("tr_city").style.display = "none";
document.getElementById("tr_sector").style.display = "";
}
else{
form.city.value = ""
document.getElementById("tr_city").style.display = "";
document.getElementById("tr_sector").style.display = "none";
}
}
function scopeChange ( form ) {
if ( form.scope.selectedIndex != 1 ) {//inchirieri sau vanzari/inchirieri
//afisez regim hotelier
if ( form.regimhotelier + "" != "undefined"){
document.getElementById("regimhotelier_tr").style.display = "";
form.regimhotelier.disabled = false;
if (form.regimhotelier.checked) {
changePriceText(form, true);
}
}
}
else{// vanzari
//ascund regim hotelier
if ( form.regimhotelier + "" != "undefined"){
document.getElementById("regimhotelier_tr").style.display = "none";
form.regimhotelier.disabled = true;
changePriceText(form, false)
}
}
}
function showHideRegimHotelier(form){
scopeChange(form);
}
function changePriceText ( form, isregimhotelier ) {
if ( isregimhotelier ) {
document.getElementById("pret_td").innerHTML="Pret/zi: ";
}
else{
document.getElementById("pret_td").innerHTML="Pret: ";
}
}