<!--

var Drag = {

    obj : null,

    init : function(id)
    {
       // alert('here');
       var o = document.getElementById('drag'+id);
        o.id = parseInt(id);
        if (isNaN(o.id)) o.id = 0;
        o.onmousedown   = Drag.start;

        if (isNaN(parseInt(o.style.left  ))) o.style.left   = "0px";
        if (isNaN(parseInt(o.style.top   ))) o.style.top    = "0px";

        o.style.opacity = 0;
        o.style.MozOpacity = 0;
        o.style.KhtmlOpacity = 0;
        o.style.filter = "alpha(opacity=0)";

        o.onDragStart  = new Function();
        o.onDragEnd    = new Function();
        o.onDrag       = new Function();
    },

    start : function(e)
    {
        var o = Drag.obj = this;
        e = Drag.fixE(e);
        var y = parseInt(o.style.top);
        var x = parseInt(o.style.left);
        o.onDragStart(x, y);

        if (o.id > 0)
            {
            o.style.opacity = 0.75;
            o.style.MozOpacity = 0.75;
            o.style.KhtmlOpacity = 0.75;
            o.style.filter = "alpha(opacity=75)";
            }

        o.lastMouseX    = e.clientX;
        o.lastMouseY    = e.clientY;

        document.onmousemove    = Drag.drag;
        document.onmouseup      = Drag.end;

        return false;
    },

    drag : function(e)
    {
        e = Drag.fixE(e);
        var o = Drag.obj;

        var ey  = e.clientY;
        var ex  = e.clientX;
        var y = parseInt(o.style.top);
        var x = parseInt(o.style.left);
        var nx, ny;

        nx = x + (ex - o.lastMouseX);
        ny = y + (ey - o.lastMouseY);

        Drag.obj.style["left"] = nx + "px";
        Drag.obj.style["top"] = ny + "px";
        Drag.obj.lastMouseX = ex;
        Drag.obj.lastMouseY = ey;

        Drag.obj.onDrag(nx, ny);
        return false;
    },

    end : function()
    {
        document.onmousemove = null;
        document.onmouseup   = null;

        if (Drag.obj.id > 0)
            {
           
           // alert (Drag.obj.id);
           
           	Drag.obj.style.opacity = 0;
            Drag.obj.style.MozOpacity = 0;
            Drag.obj.style.KhtmlOpacity = 0;
            Drag.obj.style.filter = "alpha(opacity=0)";
            Drag.obj.style['left'] = '0px';
            Drag.obj.style['top'] = '0px';
//             if (!is.safari)
//                 {
//                 viewport.getAll();
//                 Drag.obj.lastMouseX = Drag.obj.lastMouseX + viewport.scrollX;
//                 Drag.obj.lastMouseY = Drag.obj.lastMouseY + viewport.scrollY;
//                 }
            var xe = Drag.obj.lastMouseX - myImageOffsetX;
            var ye = Drag.obj.lastMouseY - myImageOffsetY;
            
          //  alert ('ye ' + ye);
            
            var cs = parseInt(Drag.obj.id);
            if (cs <= myImageTop && xe > 0 && xe < myImageMaxX && ye > 0 && ye < myImageMaxY)
                {
                while (ye > 64) { ye = ye - 64; xe = xe + (84*3); }
                var ce = 1000 + Math.floor(xe/84);
                var isTrash = false;
                if (ce == myImageTrash) if (confirmLink('Are you sure you want to delete this photo ?')) { var isTrash = true; ce = myImageTop; }
                if ((isTrash || (Drag.obj.id != ce)) && (ce <= myImageTop))
                    {
                    if (cs > ce)
                        {
                        var csid = myImageData[cs];
                        for(var i=(cs-1);i>=ce;i--)
                            {
                            changeBgImage('hold'+(i+1),imgp(myImageData[i],'S','S',myImageFileType[myImageData[i]]));
                            changeImgSrc('dimg'+(i+1),imgp(myImageData[i],'S','S',myImageFileType[myImageData[i]]));
                            myImageData[i+1] = myImageData[i];
                            }
                        changeBgImage('hold'+ce,imgp(csid,'S','S',myImageFileType[csid]));
                        changeImgSrc('dimg'+ce,imgp(csid,'S','S',myImageFileType[csid]));
                        myImageData[ce] = csid;
                        }
                        else
                        {
                        var csid = myImageData[cs];
                        for(var i=(cs+1);i<=ce;i++)
                            {
                            changeBgImage('hold'+(i-1),imgp(myImageData[i],'S','S',myImageFileType[myImageData[i]]));
                            changeImgSrc('dimg'+(i-1),imgp(myImageData[i],'S','S',myImageFileType[myImageData[i]]));
                            myImageData[i-1] = myImageData[i];
                            }
                        if (isTrash)
                            {
                            myImageData[myImageTop] = null;
                            changeVisibility('drag'+myImageTop,false);
                            changeVisibility('hold'+myImageTop,false);
                            changeVisibility('dimg'+myImageTop,false);
                            changeBgImage('hold'+myImageTop,'/images/pad.gif');
                            changeImgSrc('dimg'+myImageTop,'/images/pad.gif');
                            myImageTop--;
                            }
                            else
                            {
                            changeBgImage('hold'+ce,imgp(csid,'S','S',myImageFileType[csid]));
                            changeImgSrc('dimg'+ce,imgp(csid,'S','S',myImageFileType[csid]));
                            myImageData[ce] = csid;
                            }
                        }
                    }
                }
            }

        Drag.obj.onDragEnd(    parseInt(Drag.obj.style["left"]),
                               parseInt(Drag.obj.style["top"]));
        Drag.obj = null;
    },

    fixE : function(e)
    {
        if (typeof e == 'undefined') e = window.event;
        if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
        if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
        return e;
    }
};


var map;

// Hide the property map

function oldshowGallery(div, width, height, imgid, num, hidebutton, showbutton) {
	
	var url = 'http://www.highwoodgroup.dev.uk';
	
	document.getElementById('map').setAttribute('id',div);
	
	document.getElementById(hidebutton).setAttribute('class', 'smlDisabledButton');
	document.getElementById(hidebutton).setAttribute('onClick', '');
	document.getElementById(showbutton).setAttribute('class', 'smlButton');
	document.getElementById(showbutton).setAttribute('onClick', 'showMap(\'mainimage\', 317, 317, \'largeimage\', ' + num + ', \'mapButton\', \'galleryButton\');');
			
	document.getElementById(div).setAttribute('style', 'border:0;background-color:#dadada;display:block;margin-top:0; ' + 'height: ' + height + 'px; ' + 'width: ' + width + 'px');
	
	document.getElementById(imgid).setAttribute('style','display:inline;');
	document.getElementById(imgid).setAttribute('src',url + '/images/developments_present/L/10001_1.jpg');
	
	for (var x = 1; x <= num; x++) {
		msg = 't10001_' + x ;
		
		document.getElementById(msg).setAttribute('style','display:block;float: left; border-top: 2px solid #ffffff; border-right: 2px solid #ffffff; width:104px; height: 63px;');
		document.getElementById(msg).setAttribute('src',url + '/images/developments_present/T/10001_' + x + '.jpg');
	}

}

// Show the property map

function changeContent(thediv,showbutton,hidebutton) {
	
	// alert(thediv);
	
  var specText = '<h2>Kitchens</h2>';
  specText = specText + '<p><ul><li>Fitted kitchen with integrated hob, cooker and tall fridge freezer</li><li>Washer dryer optional</li><li>Dishwasher (narrow model) optional</li></ul></p>';
  specText = specText + '<h2>Bathrooms</h2>'; 
  specText = specText + '<p><ul><li>Fitted and tiled bathroom with mirrored vanity unit and over-bath shower</li><li>Heated towel rail</li><li>Emergency button</li><li>Cushion vinyl flooring (tiling as option)</li><li>Shaver socket amenities</li></ul></p>';
  specText = specText + '<h2>Communal features</h2>'; 
  specText = specText + '<p><ul><li>3 separate communal lounges, one with roof terrace garden</li><li>Library</li><li>Computer areas with internet access</li><li>Guest room with en-suite bathroom</li><li>Gymnasium/exercise area</li><li>Hairdresser/chiropody room</li><li>Buggy, bike and private storage areas</li><li>Laundry room with ample washing and drying facilities</li><li>Family room with games console for visiting grandchildren</li><li>Lift to all floors</li><li>House manager</li><li>Warden call</li><li>Double glazing</li><li>Economic underfloor heating</li><li>Illuminated light switches</li><li>BT points in lounge, main bedroom and bedroom 2 (where applicable)</li><li>Sky+ provision</li><li>Smoke detectors</li><li>Furnishing packages as an option</li><li>Zurich 10 year guarantee external</li></ul></p>';
  specText = specText + '<h2>Additional features</h2>'; 
  specText = specText + '<p><ul><li> Secure development with audio entry system</li><li>Landscaped gardens with natural pond</li><li>Boule park</li><li>Secure parking.</li></ul></p>'; 
  
	if (document.all) {
		document.getElementById(showbutton).setAttribute('className', 'smlButton');
		document.getElementById(hidebutton).setAttribute('className', 'smlDisabledButton');
		
		document.getElementById((thediv)).style.cssText = 'position:relative;z-index:99; float: left; background-color: #ffffff; width: 420px;';
		document.getElementById(thediv).innerHTML = specText;

	} else {
		document.getElementById(showbutton).setAttribute('class', 'smlButton');
		document.getElementById(hidebutton).setAttribute('class', 'smlDisabledButton');
		document.getElementById(thediv).setAttribute('style','position:relative;z-index:99; float: left; background-color: #ffffff; width: 420px;');
		document.getElementById(thediv).innerHTML = specText;
	}
}

function showMap(showdiv, hidediv, showbutton, showbuttontwo, hidebutton) {
	
	// alert(showdiv + ' ' + hidediv + ' ' + showbutton + ' ' + hidebutton);
	
	if (document.all) {

		// alert('document.all');
		 
		 document.getElementById(hidediv).style.cssText = 'position: relative; z-index:1; visibility: hidden';
		
		if( showdiv == 'detailmap' ) {
			document.getElementById(showdiv).style.cssText = 'position: relative; z-index:9; visibility: visible; margin: 0; background-color: #ffffff; border: 1px solid #1b4164; width:317px; height: 380px;';
			document.getElementById('propertyCopyContainer').style.cssText = 'position:relative;z-index:99; float: left; margin-top: -385px; background-color: #ffffff; width: 420px; ';
		} else {
			document.getElementById(showdiv).style.cssText = 'position: relative; float: left; z-index:9; visibility: visible; margin: 0; background-color: #ffffff; border: 1px solid #ffffff; width:318px; ';
			document.getElementById('propertyCopyContainer').style.cssText = 'position:relative;z-index:99; float: left; background-color: #ffffff; width: 420px;';
		}
		
		// swap buttons
		document.getElementById(showbuttontwo).setAttribute('className', 'smlButton');
		document.getElementById(showbutton).setAttribute('className', 'smlButton');
		document.getElementById(hidebutton).setAttribute('className', 'smlDisabledButton');
		
		var bodytop = document.getElementById("FooterContainerLeft").offsetTop;
		var bodyleft = document.getElementById("FooterContainerLeft").offsetLeft;
		var bodywidth = document.getElementById("FooterContainerLeft").offsetWidth;
		var bodyheight = document.getElementById("FooterContainerLeft").offsetHeight;
		
		//document.getElementById("OuterContainer").style.cssText = 'width: 760px; height: 735px;';
		//document.getElementById("InnerContainer").style.cssText = 'width: 760px; height: 731px;';
		//document.getElementById("ContentContainer").style.cssText = 'width: 760px; height: 430px;';
		//document.getElementById("bodyCopyContainer").style.cssText = 'width: 760px; height: 420px;';
		
		// alert( 'top: ' + bodytop + ' left: ' + bodyleft + ' width: ' + bodywidth + ' height: ' + bodyheight );
			
	} else if (document.getElementById) {
		
		// alert('document.getElementById');
		
		document.getElementById(hidediv).setAttribute('style', 'position: relative; visibility: hidden; z-index:1;');
		if( showdiv == 'detailmap' ) {
			document.getElementById(showdiv).setAttribute('style', 'position: absolute; visibility: visible; z-index:9; margin: 0; margin-top: 30px; background-color: #ffffff; border: 1px solid #1b4164; width:317px; height: 380px;');
		} else {
			document.getElementById(showdiv).setAttribute('style', 'position: relative; float: left; visibility: visible; z-index:9; margin: 0; background-color: #ffffff; border: 1px solid #ffffff; width:318px; '); // height: 380px;
		}
		
		// swap buttons
		document.getElementById(showbuttontwo).setAttribute('class', 'smlButton');
		document.getElementById(showbutton).setAttribute('class', 'smlButton');
		document.getElementById(hidebutton).setAttribute('class', 'smlDisabledButton');
						
	}
	
	map.checkResize();

// 	var centerLatitude = 50.923732;
// 	var centerLongitude = -1.40183;
// 	var startZoom = 14;
	
	map.setCenter(new GLatLng(centerLatitude, centerLongitude), startZoom);
	
	map.checkResize();
}

function hideDiv(div, button) {
	document.getElementById((div)).setAttribute('style', 'margin:0;display:none;');
	document.getElementByIdbutton.setAttribute('class', 'smlButton');
	
}

function showDiv(showdiv, hidediv, showbutton, hidebutton) {
	
	var positiontype = '';
	
	if( showdiv == 'map' ) {
		positiontype = 'absolute';
		margintop = '30px';
	} else {
		positiontype = 'relative';
		margintop = '0px';
	}
	
	if (document.all) {
		document.getElementById(showdiv).style.cssText = 'position:' + positiontype + ';z-index:9;visibility:visible;float:left;';
		
		document.getElementById(showbutton).setAttribute('className', 'smlButton');
		document.getElementById(showbutton).setAttribute('className', 'smlDisabledButton');
		document.getElementById(showbutton).setAttribute('class', 'smlButton');
		document.getElementById(showbutton).setAttribute('class', 'smlDisabledButton');
		
	} else if (document.getElementById) {
		document.getElementById(showdiv).setAttribute('style', 'position:' + positiontype + ';z-index:9;margin:0;margin-top:' + margintop + ';background-color:#ffffff;visibility:visible;width:317px;height:390px;');
		document.getElementById((hidediv)).setAttribute('style', 'z-index:1;visibility:hidden;width:0px;height:0px;');
	
		document.getElementById(showbutton).setAttribute('class', 'smlButton');
		document.getElementById(hidebutton).setAttribute('class', 'smlDisabledButton');

	}
}

function oldshowMap(div, width, height, imgid, num, hidebutton, showbutton) {
	
	document.getElementById(hidebutton).setAttribute('class', 'smlDisabledButton');
	document.getElementById(hidebutton).setAttribute('onClick', '');
	document.getElementById(showbutton).setAttribute('class', 'smlButton');
	document.getElementById(showbutton).setAttribute('onClick', 'showGallery(\'mainimage\', 317, 191, \'largeimage\', ' + num + ', \'galleryButton\', \'mapButton\');');

	document.getElementById(imgid).setAttribute('style', 'display:none');
	
	for (var x = 1; x <= num; x++)
   {
  		msg = 't10001_' + x ;
  		
  		document.getElementById(msg).setAttribute('style', 'display:none');
    }
   

	document.getElementById(div).setAttribute('style', 'margin-top:0; ' + 'height: ' + height + 'px; ' + 'width: ' + height + 'px');
	
	document.getElementById(div).setAttribute('id','map');
}

// switch an image over

function imgSwitch(div, v) {
   	document.getElementById(div).setAttribute('src',v);
}
