toggle = function(room,link,caption) {
	var pic = new Image();
	pic.src = room;
	if ( !isImageOk(pic.src) ) {
		inHTML = "<a href=\""+link+"\"><img style=\"display: block;\" id=\"bigImage\" src=\""+room+"\" alt=\""+caption+"\"  border=\"0\" height=\"350\" /><br />"+caption+"</a>";
		// width=\"400\"
		document.getElementById('leftside-gallery').innerHTML = inHTML;
		document.getElementById('bigImage').style.display = 'block';
		//document.getElementById('bigImage').src = pic.src;
	} else {
		inHTML = "<img style=\"display: block;\" id=\"bigImage\" src=\""+room+"\" alt=\""+caption+"\"  border=\"0\" height=\"350\" /><br />"+caption;
		// width=\"400\"
		document.getElementById('leftside-gallery').innerHTML = inHTML;
		document.getElementById('bigImage').style.display = 'none';
	}
}
function isImageOk(img) {
    // During the onload event, IE correctly identifies any images
    // that weren't downloaded as not complete. Others should too.
    // Gecko-based browsers act like NS4 in that they report this
    // incorrectly: they always return true.
    if (!img.complete) {
        return false;
    }

    // However, they do have two very useful properties: naturalWidth
    // and naturalHeight. These give the true size of the image. If
    // it failed to load, either of these should be zero.
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) {
        return false;
    }

    // No other way of checking: assume it's ok.
    return true;
}

/**********************************************
       DETECTING CLIENT'S BROWSER NAME
**********************************************/
var detect = navigator.userAgent.toLowerCase();
var os_ = navigator.platform.toLowerCase();
var browser,thestring;

if (checkIt('safari')) browser = "Safari"
else browser = "not Safari"

if ( os_ == 'macppc' ) os = "Mac"
else os = "not Mac"

if ( os_ == 'macppc' && checkIt('firefox')) os = "FF/Mac"

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}
