function MagicZoomPlusEffectLoad(productInfo,bp,bpl) {
MagicZoom_stopZooms();

    if(!productInfo['id'] || productInfo['id'] == undefined) {
	  setTimeout(function(){MagicZoomPlusEffectLoad(productInfo,bp); }, 500);
	  return;
    }

    origImg = document.getElementById('ProductPic' + productInfo.id);
    large = origImg.src.replace('medium','large');//getAttribute('onclick').replace(/popupimg\s*\(\s*(\"|\'?){0,1}([^\"\']*)(\"|\'?){0,1}\s*\)/i, '$2');
    thumb = origImg.src;
    
    if (bpl != undefined) {
	multiply_images(getImages(origImg.parentNode.parentNode),bpl,productInfo);
    } 
    
    if (origImg.getAttribute('onclick')) {
	magicZoomPlus_enableEffect(productInfo,origImg,large,thumb); 
    }
    //popup link
    if (document.getElementById('divProductPic' + productInfo.id).parentNode.childNodes[document.getElementById('divProductPic' + productInfo.id).parentNode.childNodes.length-2].firstChild) {
      if(MagicTools.browser.ie) {
	  document.getElementById('divProductPic' + productInfo.id).parentNode.childNodes[document.getElementById('divProductPic' + productInfo.id).parentNode.childNodes.length-2].firstChild.onclick = function(){MagicThumb.expand(null,0);}
      } else {
	  document.getElementById('divProductPic' + productInfo.id).parentNode.childNodes[document.getElementById('divProductPic' + productInfo.id).parentNode.childNodes.length-2].firstChild.setAttribute('onclick','MagicThumb.expand(null,0);')
      }
    }
   
 

MagicZoom_findZooms();
MagicThumb.refresh();
}


function getImages (obj) { //gets all multiply images
      var imgs = new Array();
      var iCnt=0;
      if (!obj) {return;}
      for (var ix=0; ix < obj.childNodes.length; ix++) {
            var cObj = obj.childNodes[ix];
            if (!cObj.tagName) { continue; }
            if (cObj.tagName.toLowerCase().match('img') && !cObj.src.toLowerCase().match('images/spacer.gif')) {
                  imgs[iCnt++] = cObj;
            }
      }
      return imgs;
}

function multiply_images (m_img,l_img,productInfo) { //enables effect to multiply images
var selector_size = "40";

/*adding main image selector*/
if (m_img.length > 0) {
	var mult_a = document.createElement('a')
	mult_a.rev = thumb;
	mult_a.rel = 'mzoomAtag' + productInfo.id;
	mult_a.href =  large;
	
	var mult_img = document.createElement('img')
	mult_img.src = thumb;
	mult_img.border = '0';
	mult_img.width = selector_size;
	mult_img.height = selector_size;
	
	mult_a.appendChild(mult_img);
	document.getElementById('divProductPic' + productInfo.id).parentNode.insertBefore(mult_a,m_img[0]);
}
/*****************************/


    for (var ch1=0; ch1 < m_img.length; ch1++ ){
	var mult_a = document.createElement('a')
	mult_a.rev = m_img[ch1].src.replace('micro','medium');
	mult_a.rev = mult_a.rev.replace('.jpg','_.jpg');
	mult_a.rel = 'mzoomAtag' + productInfo.id;
	mult_a.href =  l_img[ch1+1+','];
	
	var mult_img = document.createElement('img')
	mult_img.src = m_img[ch1].src;
	mult_img.border = '0';
	mult_img.width = selector_size;
	mult_img.height = selector_size;
	
	mult_a.appendChild(mult_img);
	document.getElementById('divProductPic' + productInfo.id).parentNode.replaceChild(mult_a,m_img[ch1]);

    }
}

function magicZoomPlus_enableEffect (productInfo,origImg,large,thumb) {

//OPTIONS
	var rel = "";
	rel += "opacity: 50; ";
	rel += "zoom-width: 200px; ";
	rel += "zoom-height: 200px; ";
	rel += "zoom-position: right; ";
	//rel += "show-title: false; ";
	rel += "thumb-size: 300px; ";
	rel += "thumb-change: click;";


	MagicThumb.options = {backgroundFadingOpacity : 0.8,
			      captionSlideDuration: 0.5}
//OPTIONS


	origImg.style.display = 'none';//.hide(); 
      
	ael = document.createElement('a');
	ael.setAttribute('rel', rel);
	ael.id = 'mzoomAtag' + productInfo.id;
	//ael.title = productInfo.name;//comment to disable zoom title
	ael.href =  large;
	ael.className = 'MagicZoom MagicThumb';
	

	var iel = document.createElement('img');
	ael.appendChild(iel);
	iel.src = thumb;

	origImg.parentNode.insertBefore(ael, origImg);

	/* message element */
	var mel = document.getElementById('mzoomStag' + productInfo.id);
	if(mel) mel.remove();
	mel = document.createElement('span');
	mel.id = 'mzoomStag' + productInfo.id;
	mel.innerHTML ="";//"Move your mouse over image. Click to enlarge";
	ael.parentNode.insertBefore(mel, ael.nextSibling);

}

