﻿var imgGallery;
var lblTitle;

function GetElementById(tagName, Id) {
	var tags = document.getElementsByTagName(tagName);
	for (i = 0; tags[i]; i++) {
		var ids = tags[i].id.split('_');
		var id = ""
		for (j = 0; ids[j]; j++) {
			id = ids[j];
		}
		if (id == Id)
			return tags[i];
	}
	return null;
}

function GetSubItem(id)
{
	PageMethods.GetSubItem(id, SubItemResult);
}

function SubItemResult(result) {
	if(imgGallery == null)
		imgGallery = GetElementById('img', 'imgImage');
	if (lblTitle == null)
		lblTitle = GetElementById('span', 'lblTitle');

	imgGallery.src = result[0];
	lblTitle.innerHTML = result[1];
}
