
function openHGallery(type,ID,nr) {
var img = new Image();
img.src = "http://www.daoreal.com/icon/"+type+"/"+ID+"/"+nr+".jpg";
mywidth = img.width;
myheight = img.height;
window.open('/gallery.html?type='+type+'&ID='+ID+'&filename='+nr+'','gallery','width='+mywidth+',height='+myheight+',toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0');
}

function openLGallery(type,location,nr) {
var img = new Image();
img.src = "/images/locations/"+location+"-"+nr+".jpg";
mywidth = img.width;
myheight = img.height;
window.open('/gallery.html?type='+type+'&location='+location+'&nr='+nr+'','gallery','width='+mywidth+',height='+myheight+',toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0');
}

function openMGallery(type,map) {
var img = new Image();
img.src = "/images/maps/"+map+".jpg";
mywidth = img.width;
myheight = img.height;
window.open('/gallery.html?type='+type+'&map='+map+'','gallery','width='+mywidth+',height='+myheight+',toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0');
}

function openCallback() {
window.open('/callback.html','callback','width=270, height=440, toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0');
}

function openInfoRequest() {
window.open('/info-request.html','infoRequest','width=300, height=590, toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0');
}

function openCatalog() {
window.open('/catalogue.html','catalogue','width=800, height=600, toolbar=0,menubar=0,scrollbars=0,status=0,resizable=0');	
}

function yandex_search() {
	document.web.submit();	
}

function id_search_form_submit() {
	id=document.id_search_form.ID.value;
if (document.id_search_form.property_type.options[0].selected) {document.id_search_form.action="/apartments.html?ID="+id+"&info=descr";}
if (document.id_search_form.property_type.options[1].selected) {document.id_search_form.action="/house.html?ID="+id;}
if (document.id_search_form.property_type.options[2].selected) {document.id_search_form.action="/land.html?ID="+id;}
if (document.id_search_form.property_type.options[3].selected) {document.id_search_form.action="/hotel.html?ID="+id;}
	document.id_search_form.submit();
}

function apartments_id_search_submit() {
	document.id_search_form_apartments.submit();	
}


function houses_id_search_submit() {
	id=document.id_search_form_houses.ID.value;
	document.id_search_form_houses.action="/house-"+id+".html";
	document.id_search_form_houses.submit();	
}

function houses_detail_search_submit(page,numBegin,begin,order,type) {
	document.detail_search_form_houses.action="/Bulgaria-houses-search.html?page="+page+"&numBegin="+numBegin+"&begin="+begin+"&order="+order+"&type="+type;
	document.detail_search_form_houses.submit();	
}

function lands_id_search_submit() {
	id=document.id_search_form_lands.ID.value;
	document.id_search_form_lands.action="/land-"+id+".html";
	document.id_search_form_lands.submit();	
}

function lands_detail_search_submit(page,numBegin,begin,order,type) {
	document.detail_search_form_lands.action="/Bulgaria-lands-search.html?page="+page+"&numBegin="+numBegin+"&begin="+begin+"&order="+order+"&type="+type;
	document.detail_search_form_lands.submit();	
}

function price_range_submit(type,min_p,max_p) {
	switch(type) {
		case 'land': 	document.detail_search_form_lands.action="/Bulgaria-lands-search.html?page=1&numBegin=1&begin=0&order=ID&type=0";
						document.detail_search_form_lands.price_min.value = min_p;
						document.detail_search_form_lands.price_max.value = max_p;
						document.detail_search_form_lands.submit();	
		break;
		case 'house': 	
						document.detail_search_form_houses.action="/Bulgaria-houses-search.html?page=1&numBegin=1&begin=0&order=ID&type=0";
						document.detail_search_form_houses.price_min.value = min_p;
						document.detail_search_form_houses.price_max.value = max_p;
						document.detail_search_form_houses.submit();	
		break;
	}
}

function callback_submit() {
var name=document.callback.name.value;
var mail=document.callback.mail.value;
var phone=document.callback.phone.value;

if(name=='') {document.getElementById('noname').innerHTML="Missing name !";} else {document.getElementById('noname').innerHTML="";}
if(phone=='') {document.getElementById('nophone').innerHTML="Missing phone number !";} else {document.getElementById('nophone').innerHTML="";}
if(!emailCheck(mail)) {document.getElementById('nomail').innerHTML="Missing e-mail address / invalid e-mail address  !";} else {document.getElementById('nomail').innerHTML="";}
if((name!='')&&(phone!='')&&(emailCheck(mail))){document.callback.submit();}	

}

function common_info_request_submit() {
var name=document.common_info_request.name.value;
var mail=document.common_info_request.mail.value;

if(name=='') {document.getElementById('noname').innerHTML="Missing name !";} else {document.getElementById('noname').innerHTML="";}
if(!emailCheck(mail)) {document.getElementById('nomail').innerHTML="Missing e-mail address / invalid e-mail address !";} else {document.getElementById('nomail').innerHTML="";}
if((name!='')&&(emailCheck(mail))){document.common_info_request.submit();}	

}

function forum_search_submit(page,numBegin,begin) {
	document.forum_search_form.action="/real-estates-Bulgaria-forum.html?search=1&page="+page+"&numBegin="+numBegin+"&begin="+begin;
	document.forum_search_form.submit();
}
