        BCS.Core.Engine.addNamespace("Web");
        
        BCS.Web.IndieBanner = Class.create();
        BCS.Web.IndieBanner.prototype = Object.extend(BCS.Web.IndieBanner.prototype, BCS.Web.BaseControl.prototype)
        BCS.Web.IndieBanner.prototype = Object.extend(BCS.Web.IndieBanner.prototype, {
        initialize:function(baseElement,windowElement)
        {
			this.windowElement          = windowElement;
            if (!this.windowElement)
                this.windowElement      = window;
            this.asynchronous			= false; 
            this.baseElement			= baseElement; 
            this.clientID               = "ErrorMessage";
        },
       getParameters: function()
       {
           
            var url = "";
            return url;
        },
        onComplete: function(response, json, options)
		{
			if (response.readyState == 4)
				{
				   
					if (options.owner.isError(response))
					{
//                        options.owner.displayErrorFromResponse(response, options);
					}
					else
					{
					    
					     var xmlObj  = loadXML(response.responseText) ; 
					     //alert(xmlObj)
					     HttpLink  = xmlObj.getElementsByTagName("HttpLink")[0].text;
					     LinkMode  = xmlObj.getElementsByTagName("LinkMode")[0].text;
					     SelectedImage  = xmlObj.getElementsByTagName("SelectedImage")[0].text;
					     
					    options.owner.baseElement.style.cursor = ""
				        options.owner.baseElement.linkPath  = ""; 
				        options.owner.baseElement.LinkMode  = "1"; 
				        
					     if(HttpLink!="")
					     {
					        options.owner.baseElement.style.cursor = "pointer"
					        options.owner.baseElement.linkPath  = HttpLink; 
					        options.owner.baseElement.LinkMode  = LinkMode
					     }
					    
					    options.owner.baseElement.src= '/RandomBanner.aspx?SelectedImage=' + SelectedImage; 
					    
					    
						this.Result =  response.responseText; 
					}
			}
		},
        dataBind: function()
        {
            this.requestUrl =  ApplicationVD + '/AjaxReceive/AjaxIndieBanner.aspx';
            this.severCommandParams  = "" ; 
            this.load();
        },
       onException : function(obj, error, options)
	   {
			//alert(error);
			//options.owner.logMessage(options.clientID, 'An ' + error.name + ' has occurred: \n' + error.message, error.description);
		},
       
        onDestructor:function()
        {
            this.cleanEvents();
        },
        cleanEvents:function()
        {
        }
      }
   );
   
function doLink(elementObj)
{
    if(elementObj.getAttribute("linkPath")!="")
    {
        if(elementObj.getAttribute("LinkMode")=="2")
            WindowOpen(elementObj.getAttribute("linkPath"),500,500,null,"BannerWindow")
        else
            window.location.href = elementObj.getAttribute("linkPath"); 
    }
}