function WhyViewPic (MainDivID,sWidth,sHeight,bWidth,bHeight,sLeft,sTop,bLeft,bTop,sPicSrc,bPicSrc,pWidth,pHeight)
{
    var oldInstance = window[MainDivID];
	if (oldInstance != null && typeof(oldInstance.Dispose) == "function")
	{
		oldInstance.Dispose();
	}
	oObj=window[MainDivID];
	this.ID = MainDivID;
	this.sWidth = sWidth;
	this.sHeight = sHeight;
	this.bWidth = bWidth;
	this.bHeight = bHeight;
	this.sLeft = sLeft;
	this.sTop = sTop;
	this.bLeft = bLeft;
	this.bTop = bTop;
	this.sPicSrc = sPicSrc;
	this.bPicSrc = bPicSrc;
	this.pWidth = pWidth;
	this.pHeight = pHeight;
    this.DomElement = document.getElementById(MainDivID);
    this.sPicImgDom=document.getElementById("sPicImg")
    this.popUpDivDom=document.getElementById("popUpDiv")
    this.bigPicDivDom=document.getElementById("bigPicDiv")
    this.bPicImgDom=document.getElementById("bPicImg")




	this.DomElement.style.width=sWidth;
	this.DomElement.style.height=sHeight;
	this.DomElement.style.left=sLeft;
	this.DomElement.style.top=sTop;
	this.sPicImgDom.style.width=sWidth;
	this.sPicImgDom.style.height=sHeight;
	this.sPicImgDom.src=sPicSrc;

	this.popUpDivDom.style.width=pWidth;
	this.popUpDivDom.style.height=pHeight;

	this.bigPicDivDom.style.width=bWidth*pWidth/sWidth;
	this.bigPicDivDom.style.height=bHeight*pHeight/sHeight;

	this.bigPicDivDom.style.left=bLeft;
	this.bigPicDivDom.style.top=bTop;

	this.bPicImgDom.style.width=bWidth;
	this.bPicImgDom.style.height=bHeight;
	this.bPicImgDom.src=bPicSrc;

	if (RadControlsNamespace.Browser.IsIE)
	{
		var instance = this;
		this.disposeEventHandler = function ()
		{
			instance.Dispose();
		}
		window.attachEvent('onunload', this.disposeEventHandler);
	}
}

WhyViewPic.prototype.Dispose = function ()
{
    for (var i in this.DomElement)
    {
		if (typeof(this.DomElement[i]) == 'function')
		{
			this.DomElement[i] = null;
		}
    }    
    this.DomElement = null;
}


WhyViewPic.prototype.Initialize = function (configObject, tabData)
{
	RadControlsNamespace.DomEventMixin.Initialize(this);
	this.AttachEventHandlers();
}


WhyViewPic.prototype.AttachEventHandlers = function ()
{
	this.AttachDomEvent(this.DomElement, "mousemove", "MouseMoveHandler");
	this.AttachDomEvent(this.DomElement, "mouseover", "MouseOverHandler");
	this.AttachDomEvent(this.DomElement, "mouseout", "MouseOutHandler");
}

WhyViewPic.prototype.MouseMoveHandler = function (e)
{
		var   y   =   0;   
		if(document.documentElement)   
		  y   =   document.documentElement.scrollTop      
		else   
		  y   =   document.body.scrollTop   		
		var   x   =   0;   
		if(document.documentElement)   
		  x   =   document.documentElement.scrollLeft      
		else   
		  x   =   document.body.scrollLeft   		


		var obj=this.DomElement;
		var totaltop=0;
		var totalleft=0;
		while(obj.offsetParent)
		{
			totaltop+=obj.offsetTop;
			totalleft+=obj.offsetLeft;
			obj=obj.offsetParent;
		}
		popLeft=event.clientX-this.pWidth/2-totalleft+x;
		popTop=event.clientY-this.pHeight/2-totaltop+y
		

		if(popLeft<0)
			popLeft=0;
		if(popLeft>this.sWidth-this.pWidth)
			popLeft=this.sWidth-this.pWidth;

		if(popTop<0)
			popTop=0;
		if(popTop>this.sHeight-this.pHeight)
			popTop=this.sHeight-this.pHeight;



		this.popUpDivDom.style.left=popLeft; 
		this.popUpDivDom.style.top=popTop; 

		//alert(bigPicDiv.scrollLeft);
		this.bigPicDivDom.scrollLeft=popLeft*this.bWidth/this.sWidth;
		this.bigPicDivDom.scrollTop=popTop*this.bHeight/this.sHeight;
	//alert(e)
}

WhyViewPic.prototype.MouseOverHandler = function (e)
{
	this.bigPicDivDom.style.display="block";
	this.popUpDivDom.style.display="block";
}

WhyViewPic.prototype.MouseOutHandler = function (e)
{
	this.bigPicDivDom.style.display="none";
	this.popUpDivDom.style.display="none";
}

WhyViewPic.prototype.SetImageUrl = function(simageUrl,bimageUrl)
{
	this.sPicSrc = simageUrl;
	this.bPicSrc = bimageUrl;
	this.sPicImgDom.src=simageUrl;
	this.bPicImgDom.src=bimageUrl;
}
