  var ivConfig ={showBG:true, bgOpacity :80,bgFadeSteps :10,	imgFadeSteps :10,	imgResizeSteps :10,timeout :5,	initialBlockSize :'100px',loadingImg :null, blockPadding :0,errorMsg :'Unable to load the image'};                        function FWS_configureImageViewer(showBG,bgOpacity,bgFadeSteps,imgFadeSteps,imgResizeSteps, timeout,initialBlockSize,loadingImg,blockPadding,errorMsg) {	ivConfig.showBG =showBG;	ivConfig.bgOpacity =bgOpacity; 	ivConfig.bgFadeSteps =bgFadeSteps; 	ivConfig.imgFadeSteps = imgFadeSteps; 	ivConfig.imgResizeSteps = imgResizeSteps; 	ivConfig.timeout =timeout; 	ivConfig.initialBlockSize = initialBlockSize; 	ivConfig.loadingImg =loadingImg; 	ivConfig.blockPadding =blockPadding; 	ivConfig.errorMsg =errorMsg; }                function FWS_showImage(imgURL) {var size =FWS_getWindowSize(); var psize =FWS_getPageSize(); var offset =FWS_getScrollOffset(); 	if(ivConfig.showBG) {var bg;	if((bg =FWS_getElement('fws_image_viewer_bg')) ==null) {bg=document.createElement('div'); bg.id ='fws_image_viewer_bg';bg.style.width =size[0] +'px';bg.style.height =psize[1] +'px';document.getElementsByTagName('body')[0].appendChild(bg); }	if(Browser.isIE) {bg.style.position ='absolute';bg.style.left =offset[0] +'px';bg.style.top =(offset[1] -100)+'px';bg.style.height =(psize[1] +200)+'px';}else {bg.style.position ='fixed';bg.style.left ='0px';bg.style.top ='0px';}FWS_setOpacity(bg,0); FWS_showElement(bg.id); } var el; 	if((el =FWS_getElement('fws_image_viewer')) ==null) {el =document.createElement('div'); el.style.position ='absolute';el.id ='fws_image_viewer';el.style.overflow ='hidden';el.onclick =function() {FWS_hideElement(bg.id); FWS_hideElement(el.id); };document.getElementsByTagName('body')[0].appendChild(el); } var initialSize = ivConfig.initialBlockSize; var iinitialSize =parseInt(initialSize); el.style.display ='block';el.style.width = initialSize; el.style.height = initialSize; el.style.top =Math.max(0,size[1] /2- iinitialSize /2+offset[1]) +'px';el.style.left =Math.max(0,size[0] /2- iinitialSize /2+offset[0]) +'px';var html ='<img id="fws_image_viewer_img" src="" />';	if(ivConfig.loadingImg !=null) html +='<img id="fws_image_viewer_loadimg" src="'+ ivConfig.loadingImg +'" />';el.innerHTML =html;  	if(ivConfig.showBG) _fadeIn(bg.id,ivConfig.bgOpacity,ivConfig.bgFadeSteps);     var img =FWS_getElement('fws_image_viewer_img'); 	img.style.visibility ='hidden';FWS_setOpacity(img,0); 	if(ivConfig.loadingImg !=null) {var loadImg=FWS_getElement('fws_image_viewer_loadimg'); loadImg.style.position ='absolute';loadImg.style.left =((iinitialSize + ivConfig.blockPadding *2)/2-loadImg.width /2)+'px';loadImg.style.top =((iinitialSize + ivConfig.blockPadding *2)/2-loadImg.height /2)+'px';} var preImg =new Image(); preImg.onload =function() {	if(ivConfig.loadingImg !=null) loadImg.style.visibility ='hidden';	img.src = imgURL; var iwidth =parseInt(preImg.width); var iheight =parseInt(preImg.height);  _setImageSize(img,iinitialSize,iinitialSize); 	img.style.visibility ='visible';_fadeIn(img.id,100,ivConfig.imgFadeSteps); _smoothResize(el.id,img.id,iwidth,iheight,ivConfig.imgResizeSteps); };preImg.onerror =function() {	if(ivConfig.loadingImg !=null) loadImg.style.visibility ='hidden';el.innerHTML ="<p align=\"center\">" + ivConfig.errorMsg +"</p>";el.style.width ='auto';el.style.height ='auto';el.style.top =Math.max(0,size[1] /2-el.offsetHeight /2+offset[1]) +'px';el.style.left =Math.max(0,size[0] /2-el.offsetWidth /2+offset[0]) +'px';};preImg.src = imgURL; }        function _fadeIn(elId,max,steps,i) {	if(typeof i =='undefined')	i =0;var el =FWS_getElement(elId); 	if(i <steps) {FWS_setOpacity(el,i *max/steps); window.setTimeout( '_fadeIn("'+elId +'",'+max+','+steps +','+(i +1)+')',	ivConfig.timeout );}else FWS_setOpacity(el,max); }           function _smoothResize(elId,imgId,width,height,steps,i) {	if(typeof i =='undefined')	i =0;var el =FWS_getElement(elId); var img =FWS_getElement(imgId); var csize =[parseInt(el.style.width),parseInt(el.style.height)]; var wdiff =width -csize[0]; var hdiff =height -csize[1]; 	if(wdiff >0||hdiff >0){var realwidth =wdiff /(steps - i); var realheight =hdiff /(steps - i); 	if(img !=null) _setImageSize(img,csize[0] +realwidth,csize[1] +realheight); el.style.width =(csize[0] +realwidth) +'px';el.style.height =(csize[1] +realheight) +'px';el.style.left =Math.max(0,parseInt(el.style.left) -realwidth /2)+'px';el.style.top =Math.max(0,parseInt(el.style.top) -realheight /2)+'px';window.setTimeout( '_smoothResize("'+elId +'","'+ imgId +'",'+width +','+height +','+steps +','+(i +1)+')',	ivConfig.timeout );}else { 	if(parseInt(el.style.top) <0)el.style.top ='0px';}}     function _setImageSize(img,width,height) {	if(Browser.isIE) {	img.width =width; 	img.height =height; }else {	img.style.width =width +'px';	img.style.height =height +'px';}}
