/* Config */
FullPathScript = FullPathScript;
/*End Config*/
    whitePixel = new Image();
    whitePixel.src = FullPathScript+"/zoom/blank.gif";
    downlPics = new Image();
    downlPics.src = FullPathScript+"/zoom/download.gif";
    function getPositonEl(object)
    {
        var lleft = object.offsetLeft;
        var ttop = object.offsetTop;
        var parent = object.offsetParent;
        if (/MSIE (5\.5|6|7).+Win/.test(navigator.userAgent))
        {
        	lleft += 3;
        	ttop += 0;
		}
        while(parent && parent.tagName != 'BODY')
        {
           lleft += parent.offsetLeft;
           ttop += parent.offsetTop;
           parent = parent.offsetParent;
        }
        var posValue = new Array(lleft,ttop);
        return posValue;
    }
    function OpenFullImg(id,img)
    {
        mainImg = document.getElementById(id)
        cord = getPositonEl(mainImg);
        if (document.getElementById('FullImg') == null)
        {
            imgDiv = document.createElement("div");
            imgDiv.style.zIndex = 9;
            imgDiv.style.position = "absolute";
            imgDiv.style.top = 0;
            imgDiv.style.left = 0;
            imgDiv.style.visibility = 'hidden';
            imgDiv.id = 'FullImgFrame';
            document.body.appendChild(imgDiv);
            imgTable = "<table cellspacing='0' cellpadding='0' onclick=closeFullImg();>";
            imgTable += "    <tr>";
            imgTable += "        <td><img src='"+FullPathScript+"/zoom/frame_1.png' class='loadpng' /></td>";
            imgTable += "        <td style='background-image: url("+FullPathScript+"/zoom/frame_2.png); height: 5px;'></td>";
            imgTable += "        <td><img src='"+FullPathScript+"/zoom/frame_3.png' class='loadpng' /></td>";
            imgTable += "    </tr>";
            imgTable += "    <tr>";
            imgTable += "        <td style='background-image: url("+FullPathScript+"/zoom/frame_4.png); width: 5px;'></td>";
            imgTable += "        <td align='center' valign='middle'><img id='FullImg' src='"+FullPathScript+"/zoom/blank.gif'; id='FullImg'></td>";
            imgTable += "        <td style='background-image: url("+FullPathScript+"/zoom/frame_6.png); width: 5px;'></td>";
            imgTable += "    </tr>";
            imgTable += "    <tr>";
            imgTable += "        <td><img src='"+FullPathScript+"/zoom/frame_7.png' class='loadpng' /></td>";
            imgTable += "        <td style='background-image: url("+FullPathScript+"/zoom/frame_8.png); height: 5px;'></td>";
            imgTable += "        <td><img src='"+FullPathScript+"/zoom/frame_9.png' class='loadpng' /></td>";
            imgTable += "    </tr>";
            imgTable += "</table>";
            imgDiv.innerHTML = imgTable;
        }
        if (/MSIE (5\.5|6).+Win/.test(navigator.userAgent)) pngLoad();
        doBigImg = new Image();
        doBigImg.src = img;
        document.getElementById('FullImgFrame').style.marginTop = (cord[1]-5)+'px';
        document.getElementById('FullImgFrame').style.marginLeft = (cord[0]-5)+'px';
        document.getElementById('FullImg').style.width = 16+'px';
        document.getElementById('FullImg').style.height = 16+'px';
        document.getElementById('FullImg').style.marginTop = ((mainImg.offsetHeight/2)-8)+'px';
        document.getElementById('FullImg').style.marginBottom = ((mainImg.offsetHeight/2)-8)+'px';
        document.getElementById('FullImg').style.marginLeft = ((mainImg.offsetWidth/2)-8)+'px';
        document.getElementById('FullImg').style.marginRight = ((mainImg.offsetWidth/2)-8)+'px';
        document.getElementById('FullImg').src = downlPics.src;
        imgDiv.style.visibility = 'visible';
        window.setTimeout(WaitDownl , 500);
    }
    function closeFullImg()
    {
        imgDiv.style.visibility = 'hidden';
        document.getElementById('FullImg').style.width = 7+'px';
        document.getElementById('FullImg').style.height = 7+'px';
        document.getElementById('FullImg').src = whitePixel.src;
    }
    function WaitDownl()
    {
        if (doBigImg.complete)
        {   
            document.getElementById('FullImg').src = whitePixel.src;
            setTimeout(SetStartSize,500);
        }
        else
        {   
            window.setTimeout(WaitDownl , 100);
        }
    }
    function SetStartSize()
    {
        topM = (cord[1]-5);
        leftM = (cord[0]-5);
        document.getElementById('FullImgFrame').style.marginTop = topM+'px';
        document.getElementById('FullImgFrame').style.marginLeft = leftM+'px';
        document.getElementById('FullImg').style.marginTop = 0+'px';
        document.getElementById('FullImg').style.marginBottom = 0+'px';
        document.getElementById('FullImg').style.marginLeft = 0+'px';
        document.getElementById('FullImg').style.marginRight = 0+'px';
        document.getElementById('FullImg').style.width = mainImg.offsetWidth+'px';
        document.getElementById('FullImg').style.height = mainImg.offsetHeight+'px';
        widthM = parseInt(document.getElementById('FullImg').style.width);
        heightM = parseInt(document.getElementById('FullImg').style.height);
        xdec = (doBigImg.width/doBigImg.height)
        document.getElementById('FullImg').src = doBigImg.src;
        setTimeout(StartZoom,50);
        setTimeout(StartZoom,100);
    }
    function StartZoom()
    {
        if (parseInt(document.getElementById('FullImg').style.width) <= parseInt(doBigImg.width))
        {
            widthM = widthM+(20*xdec);
            heightM = heightM+20;
            if ((doBigImg.width - parseInt(document.getElementById('FullImg').style.width)) > 20)
            {
	            document.getElementById('FullImg').style.width = parseInt(widthM)+'px';
	            document.getElementById('FullImg').style.height = parseInt(heightM)+'px';
	            topM -= 10;
	            leftM -= 10*xdec;
	            if (topM > 0)
	            {
	                document.getElementById('FullImgFrame').style.marginTop = parseInt(topM)+'px';
	            }
	            if (leftM > 0)
	            {
	                document.getElementById('FullImgFrame').style.marginLeft = parseInt(leftM)+'px';
	            }
	            curStartZoom = setTimeout(StartZoom, 50);
			}
			else
			{
				clearTimeout(curStartZoom);
				topM -= ((doBigImg.height - parseInt(document.getElementById('FullImg').style.height))/2);
				leftM -= ((doBigImg.width - parseInt(document.getElementById('FullImg').style.width))/2);
				document.getElementById('FullImg').style.width = parseInt(doBigImg.width)+'px';
				document.getElementById('FullImg').style.height = parseInt(doBigImg.height)+'px';
				if (topM > 0) document.getElementById('FullImgFrame').style.marginTop = Math.round(topM)+'px';
				if (leftM > 0) document.getElementById('FullImgFrame').style.marginLeft = Math.round(leftM)+'px';
			}
        }
    }