﻿/*************************************
    Extension to the TemplateBaseControlClass
    Used for determining if the control should display scrollbars if the content overflows
/************************************/
function TemplateBaseControlExtension_ScrollableClass(objects)
{
    this.objects = objects;
}

TemplateBaseControlExtension_ScrollableClass.prototype.GetScrollContainers = function()
{
    return this.objects;
}


function SetScroll(classObject, style)
{
    try{
        if (classObject.GetScrollContainers)
        {
            var objects = classObject.GetScrollContainers();
            var useScroll = style["overflowY"].toLowerCase() == "auto";
            objects[0].style["height"] = useScroll ? "100%" : "auto";
            if (useScroll)
				objects[1].style["overflowY"] = "auto"
				else
				 objects[1].style.removeAttribute("overflowY");

            
        }
    }catch(err){}
}

/*************************************
    Extension to the TemplateBaseControlClass
    Used for hyperlinking
/************************************/
function TemplateBaseControlExtension_HyperLinkableClass(object, isSetable)
{
    this.object = object;
    this.isSetable = isSetable;
}

function SetLink(classObject, value)
{
    //try{
        if (classObject && classObject.object)
        {
			if (classObject.isSetable && value != null && value != "")
			{
				var value = value.replace(/url\(/gi, "");
				if (value.charAt(value.length - 1) == ")")
					value = value.substring(0, value.length - 1);

				$get(classObject.object).onclick = function() { document.location.href = value; };
				$get(classObject.object).style["cursor"] = "pointer";
			}
        }
    //}catch(err){}
}
