
var galleryLoader;
var selectedGallery = 0;
var showGallery_196 = false;
var requestUri_196 = location.href;
var re = /[\?&](ghash=(.*))/gi;
requestUri_196 = requestUri_196.replace(re, '');
if(requestUri_196.indexOf('?') < 0) {
    requestUri_196 = requestUri_196 + '?';
} else {
    requestUri_196 = requestUri_196 + '&';
}
if (galleryLoader == undefined || selectedGallery == 1) {
    showGallery_196 = true;
}
 showGallery_196 = true;
var imageGalleryLeftPos_196       = 31;
var previewImgContainerHeight_196 = 367;
var imageGalleryWidth_196         = 449;
var maxGalleryXPos_196            = 31;
var minGalleryXPos_196            = -300;
var thumbnailsPosition_196        = 'H';
var scrollingSpeed_196            = 60;
var slideShowDelay_196            = 10000;
var ihost_196                     = 'http://images.sonoranseacondo.com/';
var ipath_196                     = ihost_196 + '27/';
var Photos_196                    = new Array();
Photos_196[0] = new Array( ipath_196 + '5393.jpg', ipath_196 + 'thumbnail_5393.jpg', "5.jpg", "Villa Alegria-Las Mareas", "Villa Alegria-Las Mareas", "480", "319");
Photos_196[1] = new Array( ipath_196 + '5394.jpg', ipath_196 + 'thumbnail_5394.jpg', "7.jpg", "Villa Alegria-Las Mareas", "Villa Alegria-Las Mareas", "480", "319");
Photos_196[2] = new Array( ipath_196 + '5395.jpg', ipath_196 + 'thumbnail_5395.jpg', "2.jpg", "Villa Alegria-Las Mareas", "Villa Alegria-Las Mareas", "480", "319");
Photos_196[3] = new Array( ipath_196 + '5396.jpg', ipath_196 + 'thumbnail_5396.jpg', "1.jpg", "Villa Alegria-Las Mareas", "Villa Alegria-Las Mareas", "480", "319");
Photos_196[4] = new Array( ipath_196 + '5397.jpg', ipath_196 + 'thumbnail_5397.jpg', "6.jpg", "Villa Alegria-Las Mareas", "Villa Alegria-Las Mareas", "480", "319");
Photos_196[5] = new Array( ipath_196 + '5398.jpg', ipath_196 + 'thumbnail_5398.jpg', "20.jpg", "Villa Alegria-Las Mareas", "Villa Alegria-Las Mareas", "480", "319");
Photos_196[6] = new Array( ipath_196 + '5399.jpg', ipath_196 + 'thumbnail_5399.jpg', "19.jpg", "View at night from Villa Alegria-Las Mareas", "View at night from Villa Alegria-Las Mareas", "480", "319");
if (showGallery_196) {
    var preloadPhotos_196 = new Array('' + ihost_196 + 'b_next.gif', '' + ihost_196 + 'b_next_over.gif', '' + ihost_196 + 'b_pause.gif', '' + ihost_196 + 'b_pause_over.gif', '' + ihost_196 + 'b_play.gif', '' + ihost_196 + 'b_play_over.gif', '' + ihost_196 + 'b_previous.gif', '' + ihost_196 + 'b_previous_over.gif', '' + ihost_196 + 'b_scroll_down.gif', '' + ihost_196 + 'b_scroll_down_over.gif', '' + ihost_196 + 'b_scroll_up.gif', '' + ihost_196 + 'b_scroll_up_over.gif', '' + ihost_196 + 'title_bg.gif', '' + ihost_196 + 'show_rental_details.gif', '' + ihost_196 + 'show_rental_details_over.gif', '' + ipath_196 + '5393.jpg', '' + ipath_196 + 'thumbnail_5393.jpg', '' + ipath_196 + 'thumbnail_5394.jpg');
    var preloadPhotos = new Array('' + ihost_196 + 'b_next.gif', '' + ihost_196 + 'b_next_over.gif', '' + ihost_196 + 'b_pause.gif', '' + ihost_196 + 'b_pause_over.gif', '' + ihost_196 + 'b_play.gif', '' + ihost_196 + 'b_play_over.gif', '' + ihost_196 + 'b_previous.gif', '' + ihost_196 + 'b_previous_over.gif', '' + ihost_196 + 'b_scroll_down.gif', '' + ihost_196 + 'b_scroll_down_over.gif', '' + ihost_196 + 'b_scroll_up.gif', '' + ihost_196 + 'b_scroll_up_over.gif', '' + ihost_196 + 'title_bg.gif', '' + ihost_196 + 'show_rental_details.gif', '' + ihost_196 + 'show_rental_details_over.gif', '' + ipath_196 + '5393.jpg', '' + ipath_196 + 'thumbnail_5393.jpg', '' + ipath_196 + 'thumbnail_5394.jpg');
    var preloadPhotosAfter_196 = new Array('' + ipath_196 + '5394.jpg', '' + ipath_196 + '5395.jpg', '' + ipath_196 + 'thumbnail_5395.jpg', '' + ipath_196 + '5396.jpg', '' + ipath_196 + 'thumbnail_5396.jpg', '' + ipath_196 + '5397.jpg', '' + ipath_196 + 'thumbnail_5397.jpg', '' + ipath_196 + '5398.jpg', '' + ipath_196 + 'thumbnail_5398.jpg', '' + ipath_196 + '5399.jpg', '' + ipath_196 + 'thumbnail_5399.jpg');
} else {
    var preloadPhotos_196 = new Array(ihost_196 + 'title_bg.gif');
    var preloadPhotos = new Array(ihost_196 + 'title_bg.gif');
}
function drawGallery_196()
{
    if (document.getElementById("gallery_slideshow_196") != null ) {
    igallery_196 = document.getElementById("gallery_slideshow_196");
    } else {
    igallery_196 = document.getElementById("gallery_slideshow");
    }
    if (showGallery_196) {
    preview_pane_196 = document.createElement('div');
    preview_pane_196.setAttribute('id', "previewPane_196");
    gncontainer_196 = document.createElement('div');
    gncontainer_196.setAttribute('id', "galleryTitle_196");
    gnscontainer_196 = document.createElement('div');
    gnTitle_196 = document.createTextNode( "Laguna Del Mar Gallery" );
    gnscontainer_196.appendChild(gnTitle_196);
    gncontainer_196.appendChild(gnscontainer_196);
    preview_pane_196.appendChild(gncontainer_196);
    preview_pane_img_div_196 = document.createElement('div');
    preview_pane_img_div_196.setAttribute('id', 'gPreviewImgContainer_196');
    preview_pane_img_196 = document.createElement('img');
    preview_pane_img_196.setAttribute('id', 'gPreviewImg_196');
    if (Photos_196.length > 0) {
        var margin_top = roundnumber_196( (previewImgContainerHeight_196/2 - 4) - (Photos_196[0][6]/2), 0);
        preview_pane_img_196.setAttribute('src', Photos_196[0][0]);
        preview_pane_img_196.setAttribute('width', Photos_196[0][5]);
        preview_pane_img_196.setAttribute('height', Photos_196[0][6]);
        preview_pane_img_196.setAttribute('style', 'margin-top: ' + margin_top + 'px;');
    }
    preview_pane_img_div_196.appendChild(preview_pane_img_196);
    preview_pane_196.appendChild(preview_pane_img_div_196);
    itext_196 = document.createElement('div');
    itext_196.setAttribute('id', "imgTextContainer_196");
    if (Photos_196.length > 0 && Photos_196[0][3] != '') {
        itext_196.innerHTML = Photos_196[0][3];
    }
    preview_pane_196.appendChild(itext_196);
    sscontainer_196 = document.createElement('div');
    sscontainer_196.setAttribute('id', "slideShowContainer_196");
    prev_img_a_196 = document.createElement('a');
    prev_img_a_196.setAttribute('onclick', "prevPhoto_196();return false");
    prev_img_a_196.setAttribute('href', "javascript:prevPhoto_196();");
    prev_img_a_196.setAttribute('onfocus', "this.blur()");
    prev_img_196 = document.createElement('img');
    prev_img_196.setAttribute('id', 'prevSlideCtrl_196');
    prev_img_196.setAttribute('src', ihost_196 + 'b_previous.gif');
    prev_img_196.setAttribute('alt', 'Previous');
    prev_img_196.setAttribute('title', 'Previous');
    prev_img_a_196.appendChild(prev_img_196);
    sscontainer_196.appendChild(prev_img_a_196);
    stop_img_a_196 = document.createElement('a');
    stop_img_a_196.setAttribute('onclick', "stopSlideShow_196();return false");
    stop_img_a_196.setAttribute('href', "javascript:stopSlideShow_196();");
    stop_img_a_196.setAttribute('id', "stopSlideCtrlA_196");
    stop_img_a_196.setAttribute('onfocus', "this.blur()");
    stop_img_196 = document.createElement('img');
    stop_img_196.setAttribute('id', 'stopSlideCtrl_196');
    stop_img_196.setAttribute('src', ihost_196 + 'b_pause.gif');
    stop_img_196.setAttribute('alt', 'Pause');
    stop_img_196.setAttribute('title', 'Pause');
    stop_img_a_196.appendChild(stop_img_196);
    sscontainer_196.appendChild(stop_img_a_196);
    start_img_a_196 = document.createElement('a');
    start_img_a_196.setAttribute('onclick', "startSlideShow_196();return false");
    start_img_a_196.setAttribute('href', "javascript:startSlideShow_196();");
    start_img_a_196.setAttribute('id', "startSlideCtrlA_196");
    start_img_a_196.setAttribute('onfocus', "this.blur()");
    start_img_196 = document.createElement('img');
    start_img_196.setAttribute('id', 'startSlideCtrl_196');
    start_img_196.setAttribute('src', ihost_196 + 'b_play.gif');
    start_img_196.setAttribute('alt', 'Play');
    start_img_196.setAttribute('title', 'Play');
    start_img_a_196.appendChild(start_img_196);
    sscontainer_196.appendChild(start_img_a_196);
    next_img_a_196 = document.createElement('a');
    next_img_a_196.setAttribute('onclick', "nextPhoto_196();return false");
    next_img_a_196.setAttribute('href', "javascript:nextPhoto_196();");
    next_img_a_196.setAttribute('onfocus', "this.blur()");
    next_img_a_196.setAttribute('class', "none_196");
    next_img_a_196.setAttribute('className', "none_196");
    next_img_196 = document.createElement('img');
    next_img_196.setAttribute('id', 'nextSlideCtrl_196');
    next_img_196.setAttribute('src', ihost_196 + 'b_next.gif');
    next_img_196.setAttribute('alt', 'Next');
    next_img_196.setAttribute('title', 'Next');
    next_img_a_196.appendChild(next_img_196);
    sscontainer_196.appendChild(next_img_a_196);
    preview_pane_196.appendChild(sscontainer_196);
    icontainer_196 = document.createElement('div');
    icontainer_196.setAttribute('id', "galleryContainer_196");
    arr_left_img_div_196 = document.createElement('div');
    arr_left_img_div_196.setAttribute('id', "arrow_left_196");
    arr_left_img_196 = document.createElement('img');
    arr_left_img_196.setAttribute('src', ihost_196 + "b_scroll_left.gif");
    arr_left_img_196.setAttribute('id', "arrow_left_image_196");
    arr_left_img_196.setAttribute('width', "31");
    arr_left_img_196.setAttribute('height', "69");
    arr_left_img_div_196.appendChild(arr_left_img_196);
    icontainer_196.appendChild(arr_left_img_div_196);
    arr_right_img_div_196 = document.createElement('div');
    arr_right_img_div_196.setAttribute('id', "arrow_right_196");
    arr_right_img_196 = document.createElement('img');
    arr_right_img_196.setAttribute('src', ihost_196 + "b_scroll_right.gif");
    arr_right_img_196.setAttribute('id', "arrow_right_image_196");
    arr_right_img_196.setAttribute('width', "33");
    arr_right_img_196.setAttribute('height', "69");
    arr_right_img_div_196.appendChild(arr_right_img_196);
    icontainer_196.appendChild(arr_right_img_div_196);
    the_img_div_196 = document.createElement('div');
    the_img_div_196.setAttribute('id', "theImages_196");
    the_img_div_container_196 = document.createElement('div');
    the_img_div_container_196.setAttribute('style', "left: 31px;");
    for (var i=0; i<Photos_196.length; i++) {
        prev_img_a_196 = document.createElement('a');
        prev_img_a_196.setAttribute('onclick', "showPreview_196(Photos_196[" + i + "][0], " + i +", Photos_196[" + i + "][3], Photos_196[" + i + "][5], Photos_196[" + i + "][6]);return false");
        prev_img_a_196.setAttribute('href', "javascript:showPreview_196(Photos_196[" + i + "][0], " + i +", Photos_196[" + i + "][3], Photos_196[" + i + "][5], Photos_196[" + i + "][6]);");
        prev_img_196 = document.createElement('img');
        prev_img_196.setAttribute('src', Photos_196[i][1]);
        prev_img_196.setAttribute('alt', Photos_196[i][4]);
        if (i == Photos_196.length) {
            prev_img_196.setAttribute('style', 'margin: 0px;');
        }
        prev_img_a_196.appendChild(prev_img_196);
        the_img_div_container_196.appendChild(prev_img_a_196);
    }
    slide_end_div_196 = document.createElement('div');
    slide_end_div_196.setAttribute('id', "slideEnd_196");
    the_img_div_container_196.appendChild(slide_end_div_196);
    the_img_div_196.appendChild(the_img_div_container_196);
    icontainer_196.appendChild(the_img_div_196);
    igallery_196.appendChild(preview_pane_196);
    igallery_196.appendChild(icontainer_196);
}
}
window.ua = navigator.userAgent.toLowerCase();
var Safari = (ua.indexOf('safari') != -1)?true:false;

var slideShowInterval_196;
var currentPhoto_196           = 0;
var arrowImageHeight_196       = 31;	// Height of arrow image in pixels;
var previewImage_196           = false;
var previewImageParent_196     = false;
var slideSpeed_196             = 0;
var previewImagePane_196       = false;
var slideEndMarker_196         = false;
var galleryContainer_196       = false;
var disablePlay_196            = false;

function getTopPos_196(inputObj)
{
    var returnValue = inputObj.offsetTop;
    while((inputObj = inputObj.offsetParent) != null) {
        returnValue += inputObj.offsetTop;
    }
    return returnValue;
}

function getLeftPos_196(inputObj)
{
    var returnValue = inputObj.offsetLeft;
    while((inputObj = inputObj.offsetParent) != null) {
        returnValue += inputObj.offsetLeft;
    }
    return returnValue;
}

function roundnumber_196(n, d)
{
    n = n - 0;
    if (d == null) d = 2;
    var f = Math.pow(10, d);
    n += Math.pow(10, - (d + 1));
    n = Math.round(n * f) / f;
    n += Math.pow(10, - (d + 1));
    n += '';
    return d == 0 ? n.substring(0, n.indexOf('.')) :  n.substring(0, n.indexOf('.') + d + 1);
}

function showPreview_196(newSrc, idx, imageText, width, height)
{
    currentPhoto_196 = idx;
    var previewImage_196 = document.getElementById('gPreviewImg_196');
    var margin_top_196 = roundnumber_196( (previewImgContainerHeight_196/2 - 4) - (height/2), 0);
    previewImage_196.src = newSrc;
    previewImage_196.width = width;
    previewImage_196.height = height;
    previewImage_196.setAttribute('style', 'margin-top: ' + margin_top_196 + 'px;');
    if (imageText == 'undefined') {
        imageText = '';
    }
    var imgTextContainer_196 = document.getElementById('imgTextContainer_196');
    if (imageText != '') {

    }
    imgTextContainer_196.innerHTML = imageText;
}

function initSlide_196(e)
{
    if(document.all) {
        e = event;
    }
    var id = this.id;

    if(this.src.indexOf('over') < 0) {
        this.src = this.src.replace('.gif','_over.gif');
    }

    if (Safari) {
      slideSpeed_196 = 10;
    } else {
        if (thumbnailsPosition_196 == 'V') {
            slideSpeed_196 = e.clientY + Math.max(document.body.scrollTop, document.documentElement.scrollTop) - getTopPos_196(this);
            if(this.src.indexOf('down') >= 0) {
                slideSpeed_196 = (slideSpeed_196) * -1;
            } else {
                slideSpeed_196 = arrowImageHeight_196 - slideSpeed_196;
            }
            slideSpeed_196 = Math.round(slideSpeed_196 * 15 / arrowImageHeight_196);
        } else {
            if(this.id=='arrow_right_image_196') {
                slideSpeedMultiply_196 = Math.floor((e.clientX - this.offsetLeft) / 5);
                slideSpeed_196 = -1 * slideSpeedMultiply_196;
                slideSpeed_196 = Math.max(-10, slideSpeed_196);
            } else {
                slideSpeedMultiply_196 = 10 - Math.floor((e.clientX - this.offsetLeft) / 5);
                slideSpeed_196 = 1 * slideSpeedMultiply_196;
                slideSpeed_196 = Math.min(10, slideSpeed_196);
                if(slideSpeed_196 < 0) { slideSpeed_196 = 10; }
            }
        }
    }
}

function stopSlide_196()
{
    slideSpeed_196 = 0;
    this.src = this.src.replace('_over', '');
}

function slidePreviewPane_196()
{
    if(slideSpeed_196 != 0) {
        if (thumbnailsPosition_196 == 'V') {
            var topPos_196 = previewImagePane_196.style.top.replace(/[^\-0-9]/g,'')/1;

            if(slideSpeed_196 < 0 && slideEndMarker_196.offsetTop < (previewImageParent_196.offsetHeight - topPos_196)) {
                slideSpeed_196 = 0;
            }
            topPos_196 = topPos_196 + slideSpeed_196;
            if(topPos_196 > 0) {
                topPos_196 = 0;
            }
            previewImagePane_196.style.top = topPos_196 + 'px';
        } else {
            var leftPos_196 = previewImageParent_196.offsetLeft;
            leftPos_196 = leftPos_196/1 + slideSpeed_196;
            if(leftPos_196 > maxGalleryXPos_196) {
                leftPos_196 = maxGalleryXPos_196;
                slideSpeed_196 = 0;
            }
            if(leftPos_196 < minGalleryXPos_196){
                leftPos_196 = minGalleryXPos_196;
                slideSpeed_196 = 0;
            }
			previewImageParent_196.style.left = leftPos_196 + 'px';
        }
    }
    setTimeout('slidePreviewPane_196()', scrollingSpeed_196);
}

function revealThumbnail_196()
{
    this.style.filter = 'alpha(opacity=100)';
    this.style.opacity = 1;
}

function hideThumbnail_196()
{
    this.style.filter = 'alpha(opacity=50)';
    this.style.opacity = 0.5;
}

function initGalleryScript_196()
{
    drawGallery_196();

    previewImageParent_196 = document.getElementById('theImages_196');
    if( previewImageParent_196 != null ) {
        galleryContainer_196  = document.getElementById('galleryContainer_196');

        previewImagePane_196 = document.getElementById('theImages_196').getElementsByTagName('DIV')[0];
        previewImagePane_196.style.top = '0px';

        var images_196 = previewImagePane_196.getElementsByTagName('IMG');
        for(var no=0; no<images_196.length; no++) {
            images_196[no].onmouseover = revealThumbnail_196;
            images_196[no].onmouseout = hideThumbnail_196;
        }
        slideEndMarker_196 = document.getElementById('slideEnd_196');

        if (thumbnailsPosition_196 == 'V') {
            document.getElementById('arrow_up_image_196').onmousemove = initSlide_196;
            document.getElementById('arrow_up_image_196').onmouseout = stopSlide_196;

            document.getElementById('arrow_down_image_196').onmousemove = initSlide_196;
            document.getElementById('arrow_down_image_196').onmouseout = stopSlide_196;
        } else {
            document.getElementById('arrow_left_image_196').onmousemove = initSlide_196;
            document.getElementById('arrow_left_image_196').onmouseout = stopSlide_196;

            document.getElementById('arrow_right_image_196').onmousemove = initSlide_196;
            document.getElementById('arrow_right_image_196').onmouseout = stopSlide_196;
        }

        document.getElementById('prevSlideCtrl_196').onmousemove = initCtrlBtn_196;
        document.getElementById('prevSlideCtrl_196').onmouseout = stopCtrlBtn_196;

        document.getElementById('startSlideCtrl_196').onmousemove = initCtrlBtn_196;
        document.getElementById('startSlideCtrl_196').onmouseout = stopCtrlBtn_196;

        document.getElementById('stopSlideCtrl_196').onmousemove = initCtrlBtn_196;
        document.getElementById('stopSlideCtrl_196').onmouseout = stopCtrlBtn_196;

        document.getElementById('nextSlideCtrl_196').onmousemove = initCtrlBtn_196;
        document.getElementById('nextSlideCtrl_196').onmouseout = stopCtrlBtn_196;

        slidePreviewPane_196();
    }
}

function rprentals_button_196(rpr_el)
{
    if(rpr_el.src.indexOf('over') < 0) {
        rpr_el.src = rpr_el.src.replace('.gif', '_over.gif');
    } else {
        rpr_el.src = rpr_el.src.replace('_over.gif', '.gif');
    }
}

/*** Slide show functions ***/
function initCtrlBtn_196()
{
    if (this.id != 'startSlideCtrl_196' || disablePlay_196 == false) {
        if(this.src.indexOf('over') < 0) {
            this.src = this.src.replace('.gif', '_over.gif');
        }
    }
}
function stopCtrlBtn_196()
{
    if (this.id != 'startSlideCtrl_196' || disablePlay_196 == false) {
        if(this.src.indexOf('over') >= 0) {
            this.src = this.src.replace('_over', '');
        }
    }
}
function nextPhoto_196()
{
    currentPhoto_196++;
    if (currentPhoto_196 >= Photos_196.length) { currentPhoto_196 = 0; }
    showPreview_196(Photos_196[currentPhoto_196][0], currentPhoto_196, Photos_196[currentPhoto_196][3], Photos_196[currentPhoto_196][5], Photos_196[currentPhoto_196][6]);
}

function prevPhoto_196()
{
    currentPhoto_196--;
    if (currentPhoto_196 >= Photos_196.length || currentPhoto_196 < 0) { currentPhoto_196 = Photos_196.length-1; }
    showPreview_196(Photos_196[currentPhoto_196][0], currentPhoto_196, Photos_196[currentPhoto_196][3], Photos_196[currentPhoto_196][5], Photos_196[currentPhoto_196][6]);
}

function doSlideshow_196()
{
    nextPhoto_196( );
    slideShowInterval_196 = setTimeout("doSlideshow_196()", slideShowDelay_196);
}

function startSlideShow_196(initpic)
{
    slideShowInterval_196 = setTimeout("doSlideshow_196()", slideShowDelay_196);
    var elm = document.getElementById('startSlideCtrl_196');
    var elm_ctrl = document.getElementById('startSlideCtrlA_196');
    disablePlay_196 = true;
    if(elm.src.indexOf('over') < 0) {
        elm.src = elm.src.replace('.gif', '_over.gif');
    }
}

function stopSlideShow_196()
{
    clearTimeout(slideShowInterval_196);
    var elm = document.getElementById('startSlideCtrl_196');
    var elm_ctrl = document.getElementById('startSlideCtrlA_196');
    disablePlay_196 = false;
    if(elm.src.indexOf('over') >= 0) {
        elm.src = elm.src.replace('_over', '');
    }
}

function initGalleryScript()
{
    initGalleryScript_196();
}

function viodAction_196()
{

}

// Image Preloader
function ImagePreloader_196(images, callback)
{
	// store the callback
	this.callback = callback;

	// initialize internal state.
	this.nLoaded = 0;
	this.nProcessed = 0;
	this.aImages = new Array;

	// record the number of images.
	this.nImages = images.length;

	// for each image, call preload()
	for ( var i = 0; i < images.length; i++ )
		this.preload_196(images[i]);
}
ImagePreloader_196.prototype.preload_196 = function(image)
{
	// create new Image object and add to array
	var oImage = new Image;
	this.aImages.push(oImage);

	// set up event handlers for the Image object
	oImage.onload = ImagePreloader_196.prototype.onload_196;
	oImage.onerror = ImagePreloader_196.prototype.onerror_196;
	oImage.onabort = ImagePreloader_196.prototype.onabort_196;

	// assign pointer back to this.
	oImage.oImagePreloader = this;
	oImage.bLoaded = false;
	oImage.source = image;

	// assign the .src property of the Image object
	oImage.src = image;
}
ImagePreloader_196.prototype.onComplete_196 = function()
{
	this.nProcessed++;
	if ( this.nProcessed == this.nImages )
		this.callback(this.aImages);
}
ImagePreloader_196.prototype.onload_196 = function()
{
	this.bLoaded = true;
	this.oImagePreloader.nLoaded++;
	this.oImagePreloader.onComplete_196();
}
ImagePreloader_196.prototype.onerror_196 = function()
{
	this.bError = true;
	this.oImagePreloader.onComplete_196();
}
ImagePreloader_196.prototype.onabort_196 = function()
{
	this.bAbort = true;
	this.oImagePreloader.onComplete_196();
}

// Image Preloader
function ImagePreloader(images,callback)
{
	// store the callback
	this.callback = callback;

	// initialize internal state.
	this.nLoaded = 0;
	this.nProcessed = 0;
	this.aImages = new Array;

	// record the number of images.
	this.nImages = images.length;

	// for each image, call preload()
	for ( var i = 0; i < images.length; i++ )
		this.preload(images[i]);
}
ImagePreloader.prototype.preload = function(image)
{
	// create new Image object and add to array
	var oImage = new Image;
	this.aImages.push(oImage);

	// set up event handlers for the Image object
	oImage.onload = ImagePreloader.prototype.onload;
	oImage.onerror = ImagePreloader.prototype.onerror;
	oImage.onabort = ImagePreloader.prototype.onabort;

	// assign pointer back to this.
	oImage.oImagePreloader = this;
	oImage.bLoaded = false;
	oImage.source = image;

	// assign the .src property of the Image object
	oImage.src = image;
}
ImagePreloader.prototype.onComplete = function()
{
	this.nProcessed++;
	if ( this.nProcessed == this.nImages )
		this.callback(this.aImages);
}
ImagePreloader.prototype.onload = function()
{
	this.bLoaded = true;
	this.oImagePreloader.nLoaded++;
	this.oImagePreloader.onComplete();
}
ImagePreloader.prototype.onerror = function()
{
	this.bError = true;
	this.oImagePreloader.onComplete();
}
ImagePreloader.prototype.onabort = function()
{
	this.bAbort = true;
	this.oImagePreloader.onComplete();
}

/**** invalid preloader ****
// Image Preloader
function ImagePreloader(images,callback)
{
	// store the callback
	this.callback = callback;

  for ( var i = 0; i < images.length; i++ ) { preLdImg(images[i]); }
  this.callback(images);
}

//this part special for safari only
function preLdImg(oHref) {
  if( typeof( oHref ) != 'string' ) { return; }
  if( window.imgLdAr ) { for( var x = 2; x < window.imgLdAr.length; x++ ){ imgLdAr[x].onerror = null; imgLdAr[x].onload = null; } }
  window.imgLdAr = new Array(); window.imgCount = 0; window.hasLoadedImg = new Array();
  for( var x = 2; x < arguments.length; x++ ) {
    if( typeof( arguments[x] ) != 'string' || !document.images ) { self.location.href = oHref; }
    imgLdAr[x] = new Image();
    imgLdAr[x].onload = new Function( //write the function as a string. Allows me to put in the number of images
      'if( hasLoadedImg[imgLdAr['+x+'].src] ){ return; } hasLoadedImg[imgLdAr['+x+'].src] = true; window.imgCount++;'+
      ( arguments[1] ? ( arguments[1] + '( window.imgCount / ' + ( arguments.length - 2 ) + ' );' ) : '' )+
      "if( imgCount == " + ( arguments.length - 2 ) + " ) { self.location.href = '"+oHref+"'; }" );
    imgLdAr[x].onerror = new Function( "for(var x = 2;x<window.imgLdAr.length;x++){imgLdAr[x].onerror=null;imgLdAr[x].onload=null;}if( window.confirm( 'Pre-load error:\\n\\nThe following image failed to load:\\n'+this.src+'\\n\\nDo you want to jump to the next page without pre-loading images?' ) ) { self.location.href = '"+oHref+"'; }" );
    imgLdAr[x].src = arguments[x];
    if( imgLdAr[x].complete ) { imgLdAr[x].onload(); }
  }
}
*******/


if (galleryLoader == undefined) {
    document.write('<div id="gallery_slideshow_196"><\/div>');
    var giv = new ImagePreloader_196(preloadPhotos_196, initGalleryScript_196);
    var aiv = new ImagePreloader_196(preloadPhotosAfter_196, viodAction_196);
}
