﻿// JScript File
var _galleryCount = 2;
var _currentGallery = 1;

function ChangeImage(newPhotoPath) {
	var imgShowPanel = document.getElementById('imgShowPanel');
	if (imgShowPanel) {
		imgShowPanel.src = newPhotoPath;
	}
}

function NavigateGallery() {    
    document.getElementById('divImageList').style.display = 'none'; 
    document.getElementById('divImageList2').style.display = 'block';
}

function GoNext() {
    _currentGallery++;
    
    if (_currentGallery > _galleryCount) _currentGallery = 1;
    
    ShowGallery(_currentGallery);
}

function GoBack() {
    _currentGallery--;
    
    if (_currentGallery < 1) _currentGallery = _galleryCount;
    
    ShowGallery(_currentGallery);
}

function ShowGallery(galleryIdToShow) {
    for (var i = 1; i <= _galleryCount; i++) {
        var galleryIdToHide = 'divImageList' + i.toString();
        var galleryToHide = document.getElementById(galleryIdToHide);        
        
        if (galleryToHide) {
            // alert(galleryToHide.id);
            galleryToHide.style.display = 'none';
        }
    }
    
    var galleryIdToShow = 'divImageList' + galleryIdToShow.toString();
    var galleryToShow = document.getElementById(galleryIdToShow);
    
    if (galleryToShow) {
        galleryToShow.style.display = 'block';
    }
}

function SearchThai() {
    var keyword = document.getElementById('q');
    window.location.href = '/thailand-hospital-th/searchresults.aspx?cx=002552486380778138527:4t5fgdfhdki&cof=FORID:9&q=' + keyword.value;
}

function Test() {
    var ifrGallery = parent.document.getElementById('ifrGallery');
    
    if (ifrGallery) {
        alert(ifrGallery);
    }
    
    alert(parent.document);
}

function ChangeImageIFrame(newPhotoPath) {
	var imgShowPanel = parent.document.getElementById('imgShowPanel');
	
	if (imgShowPanel) {
		imgShowPanel.src = newPhotoPath;
	}
}
