//var ROOT = "/dreamhomes/site"
var ROOT = ""
/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 
var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]=["images/property_001.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[1]=["images/property_002.jpg", ROOT + "/villas/", ""] //plain image syntax
fadeimages[2]=["images/property_003.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[3]=["images/property_004.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[4]=["images/property_005.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[5]=["images/property_006.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[6]=["images/property_007.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[7]=["images/property_008.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[8]=["images/property_009.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[9]=["images/property_010.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[10]=["images/property_011.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[11]=["images/property_012.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[12]=["images/property_013.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[13]=["images/property_014.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[14]=["images/property_015.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[15]=["images/property_016.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[16]=["images/property_017.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[17]=["images/property_018.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[18]=["images/property_019.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[19]=["images/property_020.jpg", ROOT + "/villas/", ""] //image with link syntax
fadeimages[20]=["images/property_021.jpg", ROOT + "/villas/", ""] //image with link syntax

var fadeimages2=new Array()
fadeimages2[0]=["images/plot_001.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[1]=["images/plot_002.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //plain image syntax
fadeimages2[2]=["images/plot_003.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[3]=["images/plot_004.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[4]=["images/plot_005.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[5]=["images/plot_006.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[6]=["images/plot_007.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[7]=["images/plot_008.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[8]=["images/plot_009.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[9]=["images/plot_010.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[10]=["images/plot_011.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[11]=["images/plot_012.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[12]=["images/plot_013.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[13]=["images/plot_014.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[14]=["images/plot_015.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[15]=["images/plot_016.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[16]=["images/plot_017.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[17]=["images/plot_018.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[18]=["images/plot_019.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[19]=["images/plot_020.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[20]=["images/plot_021.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax
fadeimages2[21]=["images/plot_022.jpg", ROOT + "/plots-ruins-and-off-plan/", ""] //image with link syntax

var fadebgcolor="#73B5E5"

////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all

function startshow(theimages, delayfactor)
{
	new fadeshow(theimages, 315, 240, 0, 4000, 2000, delayfactor);
}

 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, delayfactor, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.counter = 0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
this.delayfactor=delayfactor;
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
if(obj.counter > 1 && obj.delayfactor > 1)
	obj.delayfactor=1;
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay*obj.delayfactor)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
this.counter++;
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

function toggleDiv(divId, type)
{
	obj = document.getElementById(divId);
	if(obj)
	{
		if(obj.style.display == type)
			obj.style.display = "none";
		else
			obj.style.display = type;
	}
}
function showDiv(divId, type)
{
	obj = document.getElementById(divId);
	if(obj)
	{
		obj.style.display = type;
	}
}
function hideDiv(divId)
{
	obj = document.getElementById(divId);
	if(obj)
	{
		obj.style.display = "none";
	}
}
function toUpper(obj)
{
	obj.value = obj.value.toUpperCase();
}
function changePropertyImage(newSrc, newCaption)
{
	imageObj = document.getElementById('largePropertyImage');
	if(imageObj)
	{
		imageObj.src = ROOT + "/uploadedimages/large_" + newSrc;		
		imageObj.alt = newCaption;
		document.getElementById('largePropertyImageLink').href = ROOT + "/uploadedimages/original_" + newSrc;
	}
}
function moveUp(element) {
  for(i = 0; i < element.options.length; i++) {
    if(element.options[i].selected == true) {
      if(i != 0) {
        var temp = new Option(element.options[i-1].text,element.options[i-1].value);
        var temp2 = new Option(element.options[i].text,element.options[i].value);
        element.options[i-1] = temp2;
        element.options[i-1].selected = true;
        element.options[i] = temp;
      }
    }
  }
}
function moveDown(element) {
  for(i = (element.options.length - 1); i >= 0; i--) {
    if(element.options[i].selected == true) {
      if(i != (element.options.length - 1)) {
        var temp = new Option(element.options[i+1].text,element.options[i+1].value);
        var temp2 = new Option(element.options[i].text,element.options[i].value);
        element.options[i+1] = temp2;
        element.options[i+1].selected = true;
        element.options[i] = temp;
      }
    }
  }
}
function updateList(list, textBox) {
  textBox.value = '';
  for(i = 0; i < list.options.length; i++) {
    if (i == 0) {
      textBox.value += list.options[i].value;
    } else {
      textBox.value += ',' + list.options[i].value;
    }
  }
}
function swap(list) {
  var j = 0;
  for(i = 0; i < list.options.length; i++) {
    if(list.options[i].selected == true) {
      j++;
      switch (j) {
        case 1:
        var i1 = i;
        var temp = new Option(list.options[i].text, list.options[i].value);
        break;
        case 2:
        var i2 = i;
        var temp2 = new Option(list.options[i].text, list.options[i].value);
        break;
      }
    }
  }
  if (j != 2) {
    alert('Only 2 items can be swapped');
  } else {
    list.options[i1] = temp2;
    list.options[i1].selected = true;
    list.options[i2] = temp;
    list.options[i2].selected = true;
  }
}

if(document.all)
{
try {
document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
}
	