function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Apartment(name,url,numBedrooms,numBathrooms,numReceptions,numStudies,numTarraces,numGardens,minSleeps,maxSleeps,rate1Pound,rate2Pound,minDays){
	this.name=name;
	this.url=url;
	this.minSleeps=minSleeps;
	this.maxSleeps=maxSleeps;
	this.minDays=minDays;
	this.numBedrooms=numBedrooms;
	this.numBathrooms=numBathrooms;
	this.numReceptions=numReceptions;
	this.numStudies=numStudies;
	this.numTarraces=numTarraces;
	this.numGardens=numGardens;
	this.locationDescr='';
	this.apartmentDescr='';
	this.nbNotes='';
	this.heatingNotes='';
	this.pubTransNotes='';
	this.rate1Euro=0;
	this.rate1Pound=rate1Pound;
	this.rate1Descr='';
	this.rate2Euro=0;
	this.rate2Pound=rate2Pound;
	this.rate2Descr='';
	this.addressGen='';
	this.sestiere='';
	this.apartmentImg1=''
	this.apartmentImg1Map=''
	this.apartmentImg2=''
	this.apartmentImg2Map=''
	this.locationImg1=''
	this.locationImg1Map=''
	this.locationImg2=''
	this.locationImg2Map=''
}

function getListElement(i){
	var cssCls='apartmentEvenRow';
	var outputBuffer='';
	if (!isNaN(i)){
		if(i % 2){
			cssCls='apartmentOddRow';
		}
	}
	outputBuffer+='<tr class="' + cssCls +'" onClick="location.href=\'' + this.url + '\'">';
	outputBuffer+='<td width="160"><a href="' + this.url + '"><strong>' + this.name + '</strong></a></td>';
	outputBuffer+='<td width="35">' + this.numBedrooms + '</td>';
	outputBuffer+='<td width="35">' + this.numBathrooms + '</td>';
	outputBuffer+='<td width="35">' + this.numReceptions + '</td>';
	outputBuffer+='<td width="35">' + this.numStudies + '</td>';
	outputBuffer+='<td width="35">' + this.numTarraces + '</td>';
	outputBuffer+='<td width="35">' + this.numGardens + '</td>';
	outputBuffer+='<td width="93">';
	outputBuffer+=(this.maxSleeps>0)?this.minSleeps+'/'+this.maxSleeps:this.minSleeps;
	outputBuffer+='</td><td width="93">';
	outputBuffer+=(this.rate2Pound>0)?this.rate1Pound+'/'+this.rate2Pound:this.rate1Pound;
	outputBuffer+='</td><td width="93">' + this.minDays + '</td>';
	outputBuffer+='</tr>';
	return outputBuffer;
}

Apartment.prototype.getListElement=getListElement;

var apartments=new Array();
this.minSleeps=4;

santasofia=new Apartment('Santa Sofia','santasofia_loc.htm',3,2,1,0,1,0,4,6,1400,0,7);
martinengo=new Apartment('Martinengo','martinengo_loc.htm',2,2,2,1,1,0,4,5,1400,0,7);
miracoli=new Apartment('Miracoli','miracoli_loc.htm',3,3,1,0,0,0,6,0,2800,0,7);
widman=new Apartment('Widman','widman_loc.htm',3,3,1,1,1,0,2,6,2000,0,7);
ghetto1=new Apartment('Ghetto I','ghetto1_loc.htm',3,2,1,0,0,0,4,5,1100,0,7);
salvador=new Apartment('San Salvador','salvador_loc.htm',3,3,1,0,0,0,5,6,800,900,7);
andrea=new Apartment('Sant\'Andrea','andrea_loc.htm',3,1,1,0,0,0,4,6,600,800,3);
toletta=new Apartment('Toletta','toletta_loc.htm',2,1,1,0,0,0,4,5,700,0,7);
santoma=new Apartment('San Tomà','santoma_loc.htm',2,2,1,0,0,0,2,4,700,0,7);
mende=new Apartment('Mende','mende_loc.htm',2,1,1,0,0,0,4,0,650,0,7);
samuele=new Apartment('San Samuele','samuele_loc.htm',2, 1.5 ,1,0,1,0,2,4,650,0,3);
malipiero=new Apartment('Malipiero','malipiero_loc.htm',1,1,1,0,0,0,2,3,900,0,3);
frezzeria=new Apartment('Frezzeria','frezzeria_loc.htm',3,1,1,0,0,0,2,5,600,700,3);
sensa=new Apartment('Sensa','sensa_loc.htm',2,1,1,0,0,0,2,4,600,0,7);
canciano=new Apartment('San Canciano','canciano_loc.htm',1,1,1,0,0,0,2,0,550,0,3);
ghetto2=new Apartment('Ghetto II','ghetto2_loc.htm',1,1,1,0,0,0,2,3,525,0,7);
madonna=new Apartment('Madonna','madonna_loc.htm',1,1,1,0,0,1,3,4,700,0,3);
accademia=new Apartment('Accademia','accademia_loc.htm',2,2,0,0,0,0,4,0,900,0,7);
mercanti=new Apartment('Mercanti','mercanti_loc.htm',1,1,0,0,0,0,2,4,450,0,3);
sanpolo=new Apartment('San Polo studio','sanpolo_loc.htm',1,1,0,0,0,0,2,0,390,0,7);
campiello=new Apartment('Campiello','campiello_loc.htm',2,2,1,0,0,0,2,4,800,0,7);
sanzandegola=new Apartment('San Zan Degola','sanzandegola_loc.htm',2,2,1,0,0,1,4,0,1200,0,7);
antonin=new Apartment('Antonin','antonin_loc.htm',1,2,1,0,0,0,2,0,700,0,7);
lezze=new Apartment('Corte lezze','lezze_loc.htm',2,2,1,0,0,1,2,4,600,0,7);
cendon=new Apartment('Cendon','cendon_loc.htm',2,1,1,0,0,0,2,4,600,0,7);


//apartments=new Array(accademia,antonin,campiello,frezzeria,madonna,malipiero,martinengo,miracoli,canciano,samuele,salvador,andrea,sanpolo,sanzandegola,santasofia,sensa,toletta);
apartments=new Array(accademia,campiello,cendon,lezze,madonna,malipiero,martinengo,miracoli,samuele,widman);

function changeImg(imgObj,newSrc){
	var obj=document.getElementById('apartmentImg1');
	obj.src=newSrc;
	//alert(obj.src);
	//alert(imgObj.toString());
}