    etailPicturePlus.prototype.recalculatePopupDimensions=function()
    {
    this.popupSizeX=parseInt(this.bigImageCont.style.width)/(this.bigImageSizeX/this.smallImageSizeX);
	
    if(this.settings&&this.settings["header"]!="")
    {
    this.popupSizeY=(parseInt(this.bigImageCont.style.height)-19)/(this.bigImageSizeY/this.smallImageSizeY);
    }
    else
    {
    this.popupSizeY=parseInt(this.bigImageCont.style.height)/(this.bigImageSizeY/this.smallImageSizeY);
    }
    if(this.popupSizeX>this.smallImageSizeX)
    {
    this.popupSizeX=this.smallImageSizeX;
    }
    if(this.popupSizeY>this.smallImageSizeY)
    {
    this.popupSizeY=this.smallImageSizeY;
    }
    this.popupSizeX=Math.round(this.popupSizeX);
    this.popupSizeY=Math.round(this.popupSizeY);
    if(!(document.compatMode&&'backcompat'==document.compatMode.toLowerCase()))
    {
    var bw=parseInt(etailPicturePlusStyle(this.pup,'borderLeftWidth'));
    this.pup.style.width=(this.popupSizeX-2*bw)+'px';
    this.pup.style.height=(this.popupSizeY-2*bw)+'px';
    }
    else
    {
    this.pup.style.width=this.popupSizeX+'px';
    this.pup.style.height=this.popupSizeY+'px';
    }
    };
    etailPicturePlus.prototype.initPopup=function()
    {
    this.pup=document.createElement("DIV");
    this.pup.className='etailPicturePlusPup';
    this.pup.style.zIndex=10;
    this.pup.style.visibility='hidden';
    this.pup.style.position='absolute';
    this.pup.style["opacity"]=parseFloat(this.settings['opacity']/100.0);
    this.pup.style["-moz-opacity"]=parseFloat(this.settings['opacity']/100.0);
    this.pup.style["-html-opacity"]=parseFloat(this.settings['opacity']/100.0);
    this.pup.style["filter"]="alpha(Opacity="+this.settings['opacity']+")";

	this.smallImageCont.appendChild(this.pup);
    this.recalculatePopupDimensions();
    this.smallImageCont.unselectable="on";
    this.smallImageCont.style.MozUserSelect="none";
    this.smallImageCont.onselectstart=etailPictureSee;
    this.smallImageCont.oncontextmenu=etailPictureSee;
    };
    etailPicturePlus.prototype.initBigContainer=function()
    {
    var bigimgsrc=this.bigImage.src;
    while(this.bigImageCont.firstChild)
    {
    this.bigImageCont.removeChild(this.bigImageCont.firstChild);
    }
    if(etailPicturePlusBrowser=='msie')
    {
    var f=document.createElement("IFRAME");
    f.style.left='0px';
    f.style.top='0px';
    f.style.position='absolute';
    f.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';
    f.style.width=this.bigImageCont.style.width;f.style.height=this.bigImageCont.style.height;f.frameBorder=0;
    this.bigImageCont.appendChild(f)
    }
    if(this.settings&&this.settings["header"]!="")
    {
    var f=document.createElement("DIV");
    f.className='etailPicturePlusHeader';
    f.id='etailPicturePlusHeader'+this.bigImageCont.id;
    f.style.position='relative';
    f.style.zIndex=10;
    f.style.left='0px';
    f.style.top='0px';
    f.style.padding='3px';
    f.innerHTML=this.settings["header"];
    this.bigImageCont.appendChild(f);
    }
    var ar1=document.createElement("DIV");
    ar1.style.overflow="hidden";
    this.bigImageCont.appendChild(ar1);
    this.bigImage=document.createElement("IMG");
	this.bigImage.src=bigimgsrc;
    this.bigImage.style.position='relative';
    this.bigImage.style.borderWidth='0px';
    this.bigImage.style.padding='0px';
    ar1.appendChild(this.bigImage);
    if((this.bigImage.width+this.bigImage.height)>10*(2*ar1.style.overflow.length-2)*10)
    {
    var f=document.createElement("DIV");
    f.style.color='#cccccc';
    f.style.fontSize='10px';
    f.style.fontFamily='Tahoma';
    f.style.position='absolute';
    f.style.width='100%';
    f.style.textAlign='center';    
    this.bigImageCont.appendChild(f);
    f.style.left='0px';
    f.style.top=parseInt(this.bigImageCont.style.height)-20+'px';
    }
    };
    etailPicturePlus.prototype.initZoom=function()
    {  
    if(this.loadingCont!=null&&!this.bigImage.complete&&this.smallImage.width!=0&&this.smallImage.height!=0)
    {
    this.loadingCont.style.left=(parseInt(this.smallImage.width)/2-parseInt(this.loadingCont.offsetWidth)/2)+'px';this.loadingCont.style.top=(parseInt(this.smallImage.height)/2-parseInt(this.loadingCont.offsetHeight)/2)+'px';this.loadingCont.style.visibility='visible';
    } 
    if(etailPicturePlusBrowser=='safari')
    {
		if(!this.safariOnLoadStarted)
		{
			etailPicturePlusEventAddListener(this.bigImage,"load",etailPicturePlusMethodReference(this,"initZoom"));
			this.safariOnLoadStarted=true;return;
		}
    }
    else
    { 
     if(!this.bigImage.complete||!this.smallImage.complete)
     { 
      setTimeout(etailPicturePlusMethodReference(this,"initZoom"),100);return;
      }
    }  
      this.bigImage.style.borderWidth='0px';
      this.bigImage.style.padding='0px';
      this.bigImageSizeX=this.bigImage.width; 
      this.bigImageSizeY=this.bigImage.height;
      this.smallImageSizeX=this.smallImage.width;
      this.smallImageSizeY=this.smallImage.height;
      if(this.bigImageSizeX==0||this.bigImageSizeY==0||this.smallImageSizeX==0||this.smallImageSizeY==0)
      {
        setTimeout(etailPicturePlusMethodReference(this,"initZoom"),100);
        return;
        }               
        if(etailPicturePlusBrowser=='opera'||(etailPicturePlusBrowser=='msie'&&!(document.compatMode&&'backcompat'==document.compatMode.toLowerCase())))
        {            
            this.smallImageSizeX-=parseInt(etailPicturePlusStyle(this.smallImage,'paddingLeft'));
            this.smallImageSizeX-=parseInt(etailPicturePlusStyle(this.smallImage,'paddingRight'));
            this.smallImageSizeY-=parseInt(etailPicturePlusStyle(this.smallImage,'paddingTop'));
            this.smallImageSizeY-=parseInt(etailPicturePlusStyle(this.smallImage,'paddingBottom'));
         }
         if(this.loadingCont!=null)
         this.loadingCont.style.visibility='hidden';
         this.smallImageCont.style.width=this.smallImage.width+'px';
         this.bigImageCont.style.top='-10000px';
         this.bigImageContStyleTop='0px';
         var r=etailPicturePlusBind(this.smallImage);
         if(!r)
         {
            this.bigImageCont.style.left=this.smallImageSizeX+parseInt(etailPicturePlusStyle(this.smallImage,'borderLeftWidth'))+parseInt(etailPicturePlusStyle(this.smallImage,'borderRightWidth'))+parseInt(etailPicturePlusStyle(this.smallImage,'paddingLeft'))+parseInt(zStyle(this.smallImage,'paddingRight'))+15+'px';
           }
           else
           {
			   //this.bigImageCont.style.left=(r['right']-r['left']+15)+'px';

			var leftposition = r['right']-r['left']+15;
			if(leftposition > 400)
				this.bigImageCont.style.left='400px';
			else	
	            this.bigImageCont.style.left=leftposition+'px';
            
			//for zooming inside : vishal
            //this.bigImageCont.style.left='0px';
          }
          switch(this.settings['position'])
          {
            case'left':
                        this.bigImageCont.style.left='-'+(15+parseInt(this.bigImageCont.style.width))+'px';
                        break;
           case'bottom':
                        this.bigImageContStyleTop=r['bottom']-r['top']+15+'px';
                        this.bigImageContStyleTop=this.smallImage.height+15+'px';
                        this.bigImageCont.style.left='0px';
                        break;
           case'top':
                        this.bigImageContStyleTop='-'+(15+parseInt(this.bigImageCont.style.height))+'px';
                        this.bigImageCont.style.left='0px';
                         break;
           case'custom':
                         this.bigImageCont.style.left='0px';
                         this.bigImageContStyleTop='0px';
                         break;
          case'inner':
                        this.bigImageCont.style.left='0px';
                        this.bigImageContStyleTop='0px';
                        break;
         }
         if(this.pup)
         {
            this.recalculatePopupDimensions();return;
         }
         this.initBigContainer();
         this.initPopup();
         etailPicturePlusEventAddListener(window.document,"mousemove",this.checkcoords_ref);
         etailPicturePlusEventAddListener(this.smallImageCont,"mousemove",etailPicturePlusMethodReference(this,"mousemove"));
         if(this.settings&&this.settings["drag_mode"]==true)
         {
         etailPicturePlusEventAddListener(this.smallImageCont,"mousedown",etailPicturePlusMethodReference(this,"mousedown"));
         etailPicturePlusEventAddListener(this.smallImageCont,"mouseup",etailPicturePlusMethodReference(this,"mouseup"));
 this.positionX=this.smallImageSizeX/2;
 this.positionY=this.smallImageSizeY/2;
 this.showrect();
 }
 };
 etailPicturePlus.prototype.replaceZoom=function(e,ael)
 {    
 
 if(ael.href==this.bigImage.src)
 return; 
 var newBigImage=document.createElement("IMG");   
 newBigImage.id=this.bigImage.id;
 newBigImage.src=ael.href; 
//alert(this.bigImage.width);

 	if(this.bigImage.parentNode!=null) /// added by ankita 17/2/09
	{ 
		var p=this.bigImage.parentNode;  
		p.replaceChild(newBigImage,this.bigImage);
	
		 this.bigImage=newBigImage;
		 this.bigImage.style.position='relative'; 
		 //this.smallImage.src=ael.rev;  
		
		 
		 /*if(ael.title!=''&&_el('etailPicturePlusHeader'+this.bigImageCont.id))
		 {
		 _el('etailPicturePlusHeader'+this.bigImageCont.id).innerHTML=ael.title;
		 } 
		 this.safariOnLoadStarted=false;
		 this.initZoom();*/ 
		
		var sp=ael.rev; 
		 var rem=sp.split(","); 
		 this.smallImage.height=400;   
		 //this.smallImage.src=ael.rev;
		  this.smallImage.src=rem[0]; 
		  this.smallImage.width=rem[1]; 
		   
		  //this.smallImage.align="middle"; 
	  
		 
		
		/* var newImg = new Image();
		 newImg.src = rem[0]; alert(newImg.src);
	     var height = newImg.height;
		 var width = newImg.width;*/ //alert(this.smallImage.src);
		// alert("bigimage width="+this.bigImage.width+"\n bigimage height="+this.bigImage.height);
		  //alert("smallimage width="+this.smallImage.width+"\n smallimage height="+rem[2]);
		
		  if(this.smallImage.width >=400 && rem[2] >= 400)  /// for big image
		 { 
			
			 if(ael.title!=''&&_el('etailPicturePlusHeader'+this.bigImageCont.id))
			 { 
			 _el('etailPicturePlusHeader'+this.bigImageCont.id).innerHTML=ael.title;
			 }
			 this.safariOnLoadStarted=false;
			 this.initZoom();
			// this.smallImage.height=300; 
		 } 
		else if(this.smallImage.width < 400 && rem[2] >= 400)  /// for big image
		 {    
			
			 if(ael.title!=''&&_el('etailPicturePlusHeader'+this.bigImageCont.id))
			 { 
			 _el('etailPicturePlusHeader'+this.bigImageCont.id).innerHTML=ael.title;
			 }
			 this.safariOnLoadStarted=false; 
			 this.initZoom(); 
			
		 } 
		 else if(this.smallImage.width >= 400 && rem[2] < 400)  /// for big image
		 {   
			 this.smallImage.height=rem[2]; 
			 if(ael.title!=''&&_el('etailPicturePlusHeader'+this.bigImageCont.id))
			 {
			 _el('etailPicturePlusHeader'+this.bigImageCont.id).innerHTML=ael.title;
			 }
			 this.safariOnLoadStarted=false; 
			 this.initZoom(); 
			
			
		 } 
		else
		 { 
				  this.smallImage.src=rem[0]; 
				this.smallImage.height=rem[2]; 
				//this.smallImage.width=rem[1]; 
				this.smallImage.style.cursor='default'; // added by ankita 21/2/09
				document.getElementById(ael.rel).style.width="400px";
		 } 
	}
 };
 function etailPicturePlus_findSelectors(id,zoom)
 { 
 var aels=window.document.getElementsByTagName("A"); 
 for(var i=0;i<aels.length;i++)
 {
 if(aels[i].rel==id)
 {
 etailPicturePlusEventAddListener(aels[i],"click",function(event)
 {  

	 if(etailPicturePlusBrowser!='msie')
	 {
	 this.blur();
	 }
	 else{window.focus();
	 }
 	etailPicturePlusEventPropagationClose(event);
 return false;
 });  //document.getElementById('zoom1').style.width="400";
  etailPicturePlusEventAddListener(aels[i],zoom.settings['thumb_change'],etailPicturePlusMethodReference(zoom,"replaceZoom",aels[i]));  
 aels[i].style.outline='0';
 aels[i].mzextend=etailPictureElementExtend;  
 aels[i].mzextend({zoom:zoom,selectThisZoom:function(){this.zoom.replaceZoom(null,this)}});
 var img=document.createElement("IMG");
 img.src=aels[i].href;img.style.position='absolute';img.style.left='-10000px';img.style.top='-10000px';
 document.body.appendChild(img);
 img=document.createElement("IMG");
 img.src=aels[i].rev;img.style.position='absolute';
 img.style.left='-10000px';
 img.style.top='-10000px';
 document.body.appendChild(img);}}};
 function etailPicturePlus_stopZooms()
 {
 while(etailPictureZooming.length>0)
 {
 var zoom=etailPictureZooming.pop();
 zoom.stopZoom();
 }
 };
 function etailPicturePlusZoomingFind()
 { 

     var loadingText='Loading Zoom';
     var loadingImg='';
     var iels=window.document.getElementsByTagName("IMG");
     for(var i=0;i<iels.length;i++)
     {
        if(/etailPicturePlusLoading/.test(iels[i].className))
        {
         if(iels[i].alt!='')
         loadingText=iels[i].alt;
         loadingImg=iels[i].src;
         break;
        }
     }
     var aels=window.document.getElementsByTagName("A");
     for(var i=0;i<aels.length;i++)
     { 
        if(/etailPicturePlus/.test(aels[i].className))
        {
            while(aels[i].firstChild)
            {
                 if(aels[i].firstChild.tagName!='IMG')
                 {
                 aels[i].removeChild(aels[i].firstChild);
                 }
                 else{break;}
            }
    if(aels[i].firstChild.tagName!='IMG')
        throw"Invalid etailPicturePlus invocation!";
    var rand=Math.round(Math.random()*1000000);
    aels[i].style.position="relative";
    aels[i].style.display='block';
    aels[i].style.outline='0';
    aels[i].style.textDecoration='none'; 
    etailPicturePlusEventAddListener(aels[i],"click",function(event)
    {
        if(etailPicturePlusBrowser!='msie')
        {
            this.blur();
        }
        else{window.focus();}
        etailPicturePlusEventPropagationClose(event);
        return false;
    }
 ); 
 if(aels[i].id==''){aels[i].id="sc"+rand}
 if(etailPicturePlusBrowser=='msie'){aels[i].style.zIndex=0;}
 var smallImg=aels[i].firstChild;smallImg.id="sim"+rand;
 var bigCont=document.createElement("DIV");
 bigCont.id="bc"+rand;
 //vishal
 bigCont.style.border='1px solid #CCCCCC';	 
 bigCont.style.background='#FFFFFF';	 
 //vishal - end
 var re=new RegExp(/opacity(\s+)?\s+?(\d+)/i);
 matches=re.exec(aels[i].rel);
 var opacity=50;
 if(matches)
 {opacity=parseInt(matches[3]);}
 re=new RegExp(/thumb\-change(\s+)?\s+?(click|mouseover)/i);
 matches=re.exec(aels[i].rel);
 var thumb_change='click';
 if(matches)
 {
 thumb_change=matches[3];
 }
 var re=new RegExp(/zoom\-width(\s+)?\s+?(\w+)/i);
 matches=re.exec(aels[i].rel);
 bigCont.style.width='300px'; //changes by vipul set 300->200
 if(matches)
 {
    bigCont.style.width=matches[3];
 }
 re=new RegExp(/zoom\-height(\s+)?\s+?(\w+)/i);
 matches=re.exec(aels[i].rel);
 bigCont.style.height='300px';  //changes by vipul set 300->200

 if(matches)
 {
 bigCont.style.height=matches[3];}
 re=new RegExp(/zoom\-position(\s+)?\s+?(\w+)/i);
 matches=re.exec(aels[i].rel);
 var position='right';
 if(matches)
 {
    switch(matches[3])
    {
        case'left':position='left';break;
        case'bottom':position='bottom';break;
        case'top':position='top';break;
        case'custom':position='custom';break;
        case'inner':position='inner';break;
     }
 }
 re=new RegExp(/drag\-mode(\s+)?\s+?(true|false)/i);
 matches=re.exec(aels[i].rel);
 var drag_mode=false;
 if(matches)
 {
 if(matches[3]=='true')
 drag_mode=true;
 }
 re=new RegExp(/always\-show\-zoom(\s+)?\s+?(true|false)/i);
 matches=re.exec(aels[i].rel);
 var bigImage_always_visible=false;
 if(matches)
 {
    if(matches[3]=='true')
    bigImage_always_visible=true;
    }
    bigCont.style.overflow='hidden';bigCont.className="etailPicturePlusBigImageCont";
    bigCont.style.zIndex=100;bigCont.style.visibility='hidden';
    if(position!='custom')
    {bigCont.style.position='absolute';}else{bigCont.style.position='relative';}
    var bigImg=document.createElement("IMG");
    bigImg.id="bim"+rand;bigImg.src=aels[i].href;bigCont.appendChild(bigImg);
    if(position!='custom')
    {
        aels[i].appendChild(bigCont);
    }
    else{_el(aels[i].id+'-big').appendChild(bigCont);}
    var settings={bigImage_always_visible:bigImage_always_visible,drag_mode:drag_mode,header:aels[i].title,opacity:opacity,thumb_change:thumb_change,position:position,loadingText:loadingText,loadingImg:loadingImg};
    var zoom=new etailPicturePlus(aels[i].id,'sim'+rand,bigCont.id,'bim'+rand,settings);
    aels[i].mzextend=etailPictureElementExtend;aels[i].mzextend(
    {zoom:zoom});
    zoom.initZoom();
    etailPicturePlus_findSelectors(aels[i].id,zoom);}} };
    if(etailPicturePlusBrowser=='msie')
    try
    {
        document.execCommand("BackgroundImageCache",false,true);
    }
    catch(e)
    {
    };
    etailPicturePlusEventAddListener(window,"load",etailPicturePlusZoomingFind);