// JScript source code
        //cofiguration for the zoom and large image
        dheight=453; //default zoom size
        dwidth=453;
        Dbox=false;  //zoom box automatic shrink?
        DReplace=false;  //strecth page the product detail?(false = overlap the product detail)
        trans_value=0;
        tranp=null;
        rate=0;             
        maxx=0;
        minx=0;
        maxy=0;
        miny=0;
        
	    isIE = false; 
	    navVer = navigator.appVersion; 
	    ver = parseFloat(navVer); 
	    IEPos = navVer.indexOf('MSIE'); 
	    if (IEPos !=-1) { 
  	        isIE = true; 
  	        ver = parseFloat(navVer.substring(IEPos+5,navVer.indexOf(';',IEPos))); 
	    }
	    isIE5up = (isIE && ver >= 5);
	   
	   var enable_zoom=false;
	//get all target div and images 
       var smallimg;
       var largeimg;
       var square;
       var divlarge;
       var startpoint;  
       var zoom_top;

       var thefilter ;  
       var productdetail; 
       var HDVal;
       var atable;
       var zoomZone;
       var sel10;
	   var sel11;
       var insideimg;
       var show_review;
       var moveMainDIV=false;
       	 
       function setup()
	   {
	   enable_zoom=true;
	   if(show_review)
	   {
	     showPopup('reviews_section');
	   }
	   if( moveMainDIV )
	   {init_layers();}
	   
	   	    
	   smallimg=document.getElementById("productImage");
       largeimg=document.getElementById("large_img");
       square=document.getElementById("zoom_square");
       divlarge=document.getElementById("div_large");
       startpoint=document.getElementById("zoom_start");  
       zoom_top=document.getElementById("o_top");

       thefilter =document.getElementById("tbfilter");  
       productdetail=document.getElementById("product_description_block"); 
       HDVal=document.getElementById("HDsrc");
       //atable=document.getElementById("Table1");
       zoomZone=document.getElementById("zoomArea");
       sel10=document.getElementById("sel_10");
	   sel11=document.getElementById("sel_11");
	   insideimg = document.getElementById("inside_img");
	   if (divlarge != null) {
	       divlarge.style.top = startpoint.offsetTop + "px";
	   }
	   else {
	       enable_zoom = false;
	   }
	   }  

	   function overset(e)
	   {
	   //alert(enable_zoom);
	   if (!enable_zoom){return false;}
	   if (smallimg==null){return false;}
	   aimg=new Image();
       aimg.src=largeimg.src; 
       //alert(aimg.width);
       //if(largeimg.src.indexOf("/large/") <0)
       //{return false;}  
       //if(!isIE5up){allevent=e;}else{allevent=event;}
       //zoomZone.onmousemove=aims(allevent);
       //square.onmousemove=aims(allevent); 
       
       largeimg.style.width=parseInt(aimg.width)+"px";
       largeimg.style.height=parseInt(aimg.height)+"px"; 
       
       //get the rate for zoom sqare and set it size 
       rate=parseInt(largeimg.style.width)/parseInt(smallimg.width);
       //alert(rate);
       if(rate<1){return false;} 
       
       zoom_top.style.display="block";      
       zoom_top.style.width=  smallimg.offsetWidth+"px";
       zoom_top.style.height=  smallimg.offsetHeight+"px";
       zoom_top.style.top=  startpoint.offsetTop+"px";
       zoom_top.style.left=  startpoint.offsetLeft+"px";
       
       divlarge.style.border="solid 1px #E5E1D3";
       divlarge.style.backgroundColor="#F3F1EB";

       Set_Trans("o_top",50);
       //alert(zoom_top.style.width+"," +zoom_top.style.height+","+zoom_top.style.top+","+ zoom_top.style.left);
       
       divlarge.style.height=dheight +"px";
       divlarge.style.width=dwidth + "px";  
      
       square.style.width=parseInt(divlarge.style.width)/rate+"px";
       square.style.height=parseInt(divlarge.style.height)/rate+"px";
       

      
       //atable.style.visiblity="hidden";
             
       //set the move area 
       maxx=parseInt(smallimg.offsetWidth) + parseInt(startpoint.offsetLeft);
       minx=parseInt(startpoint.offsetLeft);
       maxy=parseInt(smallimg.offsetHeight)+ parseInt(startpoint.offsetTop);
       miny=parseInt(startpoint.offsetTop);
       
       //productdetail.style.display="block";       
       
       thefilter.style.height=dheight/rate-1 +"px";
       thefilter.style.width=dwidth/rate-1 + "px"; 
          
       insideimg.src= smallimg.src;

	   insideimg.style.height=smallimg.offsetHeight+"px";
	   insideimg.style.width=smallimg.offsetWidth+"px";
	   
	    aims(e);
	   }
	   
	   
       function aims(e){ 
       //alert('hi');
       //catch cursor position
       //alert(enable_zoom);
       if (!enable_zoom){return false;}
        if(!isIE5up){allevent=e;}else{allevent=event;}
        if(!isIE5up){
				var newx=e.pageX;
				var newy=e.pageY;
				
			}else{
				var newx=event.clientX + document.documentElement.scrollLeft;
				var newy=event.clientY + document.documentElement.scrollTop;
				
			}
	  //  return false; 

	    //check cursor position if it's on the product image
	    
		if(newx>minx-1 && newx<maxx+1 && newy>miny-1 && newy<maxy+1){
		  
	        square.style.left=newx-parseInt(square.style.width)/2+"px";
	        square.style.top=newy-parseInt(square.style.height)/2+"px";
	        if(divlarge.style.display=="none"){ 
	            divlarge.style.display="block"; 
	            trans_value=0;
		        tranp=setTimeout("tdisplay()",300);
	        } 

	    }
	    else
	    {
	        //out of image, not diplay, go back
	        hideZoom();	        
	    }
	    
	    //show right part of image in the windiow
	    if(	square)
	    {    
	    catchzoom("large_img",newx-minx,newy-miny,square.style.width,square.style.height,rate);
	    catchzoom("inside_img",newx-minx,newy-miny,square.style.width,square.style.height,1);
	    }
       }        
       
       function catchzoom(imgid,newx,newy,sx,sy,rate){       
        //relative div
        
        aimg=document.getElementById(imgid);        
		dx= parseInt(newx)-parseInt(sx)/2;
		dy= parseInt(newy)-parseInt(sy)/2;        
		aimg.style.left=-dx*rate + "px";
		aimg.style.top=-dy*rate + "px";    
        if(isIE5up){
	    //alert(smallimg.style.left);
	       aimg.style.left=-dx*rate -2 + "px"; 
	    }
        }   
        
         function tdisplay(){
         clearTimeout(tranp);
         trans_value=trans_value+10;
         
         if(trans_value<=100){
            //alert(trans_value);
            Set_Trans("div_large",trans_value);      
            Set_Trans("large_img",trans_value);  
           
            tranp=setTimeout("tdisplay()",20);
         }
         else{
            if(sel10!=null){
	            sel10.style.visibility="hidden";
	        }
            if(sel11!=null){
	            sel11.style.visibility="hidden";
	        }
         
         }
         }   
        
        function hideZoom(e){       
        //hide everything about zoom function
           
            if(square){
		    square.style.width="0px";
            square.style.height="0px";   
            zoom_top.style.display="none";
            if (divlarge != null) {
                divlarge.style.display = "none";
            }
            Set_Trans("div_large",0);      
            Set_Trans("large_img",0);  
            Set_Trans("o_top",0); 
            //productdetail.style.display="block";   
            if(sel10!=null){
	   			sel10.style.visibility="visible";
	   		}
       		if(sel11!=null){
	   			sel11.style.visibility="visible";
	   			
	   		}
	        }
           
        }  
        
        function detectBrowser() {
            BROWSER_TYPE="";
            aname=navigator.appName;
            anav=navigator.userAgent;
            if(aname=="Microsoft Internet Explorer"){
                if(anav.indexOf("Opera")>-1){
                    BROWSER_TYPE="OP";
                }
                else
                {
                    BROWSER_TYPE="IE";
                }
            }
            if(aname=="Netscape"){
                if(anav.indexOf("Firefox")>-1)
                {
                BROWSER_TYPE="FF";
                }
                if(anav.indexOf("Navigator")>-1)
                {
                BROWSER_TYPE="NS";
                }   
                if(anav.indexOf("Safari")>-1)
                {
                BROWSER_TYPE="SF";
                }
                
            }
            if(aname=="Opera"){
                BROWSER_TYPE="OP";
            }
            return(BROWSER_TYPE)
        }
        
    function Set_Trans(objid,aval){
        theobj = document.getElementById(objid);
        if (theobj == null) {return false;}
        if(detectBrowser()=="NS" || detectBrowser()=="FF")
            {
            theobj.style.MozOpacity=aval/100   ;
            }
        if(detectBrowser()=="OP")
            {        		   
		    theobj.style.opacity  = aval/100  ;
		    }
		if(detectBrowser()=="SF")
		    {
		    theobj.style.KhtmlOpacity = aval/100 ;
		    }
		if(detectBrowser()=="IE")
		    {
		    theobj.filters[0].opacity = aval;
		    }    
		
    
    }
    
function hightlightAlternativeImage1(key,totalKeys,imageName,imageFile,xlarge_img,haslarge){
		    document.getElementById("large_img").src=xlarge_img;
            if(haslarge==1)
            {
                enable_zoom=true;
                document.getElementById("zoom_text").style.visibility="visible";
               //document.getElementById("zoom_text").innerText="Mouse Over to Zoom";
            }
            else
            {
                 enable_zoom=false;
                 document.getElementById("zoom_text").style.visibility="hidden";
                 //document.getElementById("zoom_text").innerText="";
            }
            //divlarge.style.visibility="visible";
            //alert(haslarge);
			swapImage(imageName,imageFile)
			
			for (i=0;i<=totalKeys;i++){
			    if (document.all('alternativeImage'+i))
			    {
				document.all('alternativeImage'+i).className = 'alternativeImageText';
				}
			}
			     if (document.all('alternativeImage'+key))
			    {
				document.all('alternativeImage'+key).className = 'alternativeImageTextBold';
				}
		}
		
		if (document.all('alternativeImage0')) 
		{
		document.all('alternativeImage0').className = 'alternativeImageTextBold';
		}
		
		function expandItImage(){
				omoreImages = getMyHTMLElement('moreImages').style
				omoreImagesExpansion = getMyHTMLElement('moreImagesExpansion').style
				if (omoreImages.display=="none"){
				omoreImages.display=""
				omoreImagesExpansion.display="none"}
				else{
				omoreImages.display="none"
				omoreImagesExpansion.display=""
				}
				}
		function collapseItImage(){
				omoreImages = getMyHTMLElement('moreImages').style
				omoreImages.display=""
				}
				
		function init_layers(){		
		
		if ( enable_zoom){
	    getMyHTMLElement('secondary_description_block').innerHTML = getMyHTMLElement('product_description_block').innerHTML ;
        getMyHTMLElement('secondary_description_block').style.display = '';
        getMyHTMLElement('product_description_block').style.display = 'none';}
        }