﻿var winWidth;
var winHeight;
var WinScrollTop;
var arrdrpdown = new Array(2);
arrdrpdown[0] = "";
var baselink = window.location.protocol + "//" + window.location.host + "/";

function getAbsLeft(o) {
    oLeft = o.offsetLeft
    while (o.offsetParent != null) {
        oParent = o.offsetParent
        oLeft += oParent.offsetLeft
        o = oParent
    }
    return oLeft
}
function ValidateChk(id) {

    var chkTreSolitaire = document.getElementById("ctl00_ContentPlaceHolder1_chkTreSolitaire").checked;
    var chkDiaAccent = document.getElementById("ctl00_ContentPlaceHolder1_chkDiaAccent").checked;
    var chkThreeStone = document.getElementById("ctl00_ContentPlaceHolder1_chkThreeStone").checked;
    var chkMatBand = document.getElementById("ctl00_ContentPlaceHolder1_chkMatBand").checked;
    if (chkTreSolitaire == false && chkDiaAccent == false && chkThreeStone == false && chkMatBand == false) {
        /*alert("Select at least one item");
        document.getElementById("ctl00_ContentPlaceHolder1_hdncheck").value="false";
        id.checked = true;*/
        return true;
        //return false;
    }
    else {
        document.getElementById("ctl00_ContentPlaceHolder1_hdncheck").value = "true";
        return true;
    }
}

function move3(whichdiv) {
    tdiv = whichdiv
    tdiv2 = document.getElementById(oDivSub21);
    //alert(tdiv);
    if (parseInt(tdiv.style.left) > 0 && parseInt(tdiv.style.left) <= 5) {

        tdiv.style.left = 0 + "px"
        tdiv2.style.left = parseInt(scrollerwidth) + "px";

    }
    if (parseInt(tdiv.style.left) >= tdiv.offsetWidth * -1) {
        //alert(newtest);
        tdiv2.innerHTML = newtest;
        tdiv.style.left = parseInt(tdiv.style.left) - 5 + "px"
        tdiv2.style.left = parseInt(tdiv2.style.left) - 5 + "px"
        setTimeout("move3(tdiv)", pausebetweenimages)
    }
    else {
        tdiv.innerHTML = tdiv2.innerHTML;
        tdiv2.innerHTML = "";
        tdiv.style.left = 0
        tdiv2.style.left = scrollerwidth;

    }
}

function startscroll(oDivMain, oDivSub1, oDivSub2, oldDiv1) {
    pausebetweenimages = 30
    scrollerdiv1 = oDivSub1;
    //var dMain = document.getElementById(oDivMain);
    document.getElementById(oDivMain).style.overflow = 'hidden';

    scrollerdiv2 = oDivSub2;
    move3(document.getElementById(oDivSub1))
    document.getElementById(oDivMain).style.zIndex = "100";
    document.getElementById(oDivSub2).style.left = scrollerwidth
}
function showdatalist(obj, oDivMain) {

    if (arrdrpdown[0] == "") {
        arrdrpdown[0] = obj;
        arrdrpdown[1] = oDivMain;
        //   alert(arrdrpdown[0]);
    }
    else {
        if (arrdrpdown[0] != obj) {
            document.getElementById(arrdrpdown[0]).style.display = 'none';
            document.getElementById(arrdrpdown[1]).style.zIndex = "0";
            arrdrpdown[0] = obj;
            arrdrpdown[1] = oDivMain;
        }
    }

    var dMain = document.getElementById(oDivMain);
    dMain.style.zIndex = "20000";
    dMain.style.overflow = 'visible';
    var divitem = document.getElementById(obj);
    if (divitem.style.display == 'block') {

        divitem.style.display = 'none';
        dMain.style.zIndex = "100";
    }
    else if (divitem.style.display == 'none') {

        divitem.style.display = 'block';

    }
}
function LoadDiamondShape_CallBack(response) {

    if (response.error != null) {
        alert(response.error); //we should probably do better than this
        return;
    }
    var varObject = response.value;

    if (varObject == null)// || typeof(varObject) != "object")
    {
        alert("Response Unexpected");
        return;
    }

    gTdShapeButton = varObject;
    ChangeData(obj1, iPath1, iImg1, ddlId1, oPriceName1, lblItemId1, lblItemDesc1, oDivMain1, oDivSub11, oDivSub21, oHlnkItem1, sHlnkItem1, itmId11, oZoom1, curobj1, tdShapeButton1, viewlnk1)
    var vlnk = document.getElementById(viewlnk1);
    vlnk.href = sHlnkItem1;
}
function IdentifyResponse(response) {
    if (response.value.Rows != null) {
        return response.value.Rows;
    }
    else {
        return response.value;
    }
}
function fnFetchOptimize() {
    buildring.ChangeToolTip(itmId11, iImg1, sFlgSettingMatching1, sMatchingBandId1, curobj1.id, LoadToolTip_CallBack); //pure ajax
    buildring.DiamondShapeSelection(itmId11, iImg1, sFlgSettingMatching1, sMatchingBandId1, curobj1.id, LoadDiamondShape_CallBack); //pure ajax
}

var extravar = new Array();
var imgids = new Array();
var flgs = new Array();
var arritmNms = new Array();
function LoadToolTip_CallBack(response) {
    var indx = parseFloat(iImg1.split('_')[3].substring(3));

    extravar[indx] = response.value;
    imgids[indx] = iImg1;
    flgs[indx] = parseFloat(iImg1.split('_')[3].substring(3)) % 3;
    arritmNms[indx] = lblItemDesc1;

    var chngtooltip = document.getElementById(iImg1);
    chngtooltip.setAttribute('onmouseover', 'temp(' + indx + ')');
    //chngtooltip.setAttribute('onmouseout','temp1()');

}
function temp(indx) {
    if (flgs[indx] == 2) {

        var o = document.getElementById('diviteminfoLast');
        var o1 = document.getElementById('tdItemNmLast');
        var o2 = document.getElementById('tdInfoLast');
        o.style.display = 'block';
        o1.innerHTML = arritmNms[indx];
        o2.innerHTML = extravar[indx];
        fnTaskSubmit(imgids[indx], 3);
    }
    else {
        var o = document.getElementById('diviteminfo');
        var o1 = document.getElementById('tdItemNm');
        var o2 = document.getElementById('tdInfo');
        o.style.display = 'block';
        o1.innerHTML = arritmNms[indx];
        o2.innerHTML = extravar[indx];
        fnTaskSubmit(imgids[indx], 2);
    }
}
function temp1() {
    var o = document.getElementById('diviteminfoLast');
    var o1 = document.getElementById('tdItemNmLast');
    o.style.display = 'none';
}
function fnFetchRecord(flgOptimized) {

    window.clearTimeout(TimeOptimizeId);
    if (flgOptimized) {
        TimeOptimizeId = window.setInterval("fnFetchOptimize();", 1);
    }
    else {
        TimeOptimizeId = window.setInterval("fnFetchOptimize();", 300);
    }
}



function itemMouseOver(obj) {

    var itemcs = document.getElementById(obj.id);
    //alert(itemcs.className);
    itemcs.className = "cssDropDownOver";
}
function itemMouseOut(obj) {

    var itemcs = document.getElementById(obj.id);
    //alert(itemcs.className);
    itemcs.className = "cssDropDownnew";
}




function showdeadcenterdiv(Xwidth, Yheight, divid) {
    // First, determine how much the visitor has scrolled 

    var scrolledX, scrolledY;
    if (self.pageYoffset) {
        scrolledX = self.pageXoffset;
        scrolledY = self.pageYoffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {
        scrolledX = document.documentElement.scrollLeft;
        scrolledY = document.documentElement.scrollTop;
    } else if (document.body) {
        scrolledX = document.body.scrollLeft;
        scrolledY = document.body.scrollTop;
    }

    // Next, determine the coordinates of the center of browser's window 

    var centerX, centerY;
    if (self.innerHeight) {
        centerX = self.innerWidth;
        centerY = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientheight) {
        centerX = document.documentElement.clientWidth;
        centerY = document.documentElement.clientheight;
    } else if (document.body) {
        centerX = document.body.clientWidth;
        centerY = document.body.clientHeight;
    }

    // Xwidth is the width of the div, Yheight is the height of the 
    // div passed as arguments to the function: 

    var leftoffset = scrolledX + (centerX - Xwidth) / 2;
    var topoffset = scrolledY + (centerY - Yheight) / 2;
    // the initial width and height of the div can be set in the 
    // style sheet with display:none; divid is passed as an argument to // the function 
    var o = document.getElementById(divid);
    var r = o.style;
    //r.position='absolute'; 
    r.top = topoffset + 'px';
    r.left = leftoffset + 'px';
    //r.display = "block"; 

}

function FindWindowSize() {

    // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
    if (window.innerHeight && window.scrollMaxY) {
        yWithScroll = window.innerHeight + window.scrollMaxY;
        xWithScroll = window.innerWidth + window.scrollMaxX;
    }
    else if (document.documentElement.scrollHeight > document.documentElement.offsetHeight) {
        yWithScroll = document.documentElement.scrollHeight;
        xWithScroll = document.documentElement.scrollWidth;
    }
    else {
        yWithScroll = document.documentElement.offsetHeight;
        xWithScroll = document.documentElement.offsetWidth;
    }

    winWidth = xWithScroll;
    winHeight = yWithScroll;

    WinScrollTop = document.documentElement.scrollTop


}




function fillArray_Callback(response) //Callback to fill array
{

    if (response.error != null) {
        alert("Unable to retrive data");
        return;
    }


}
function ZoomClose(obj) {

    var zoomdiv = document.getElementById(obj); //document.getElementById("<%= apDiv1.ClientID %>");
    zoomdiv.style.display = 'none';
    document.getElementById("ModalBG").style.display = 'none';
}
//			function ZoomClose()
//			{
//			    
//			    var zoomdiv = document.getElementById("<%= apDiv1.ClientID %>");
//				//var zoomdiv = document.getElementById("apDiv1").style.display = 'none'; 
//				zoomdiv.style.display = 'none';
//				document.getElementById("ModalBG").style.display = 'none'; 
//				
//				/*document.getElementById('drMetal').disabled = false;
//				if(document.getElementById('hdnfrom').value=="0")
//				{
//				document.getElementById('cmbShape').disabled = true;
//				}
//				else
//				{
//				document.getElementById('cmbShape').disabled = false;
//				}
//				document.getElementById('cmbCarat').disabled = false;
//				document.getElementById('cmbOrder').disabled = false;
//				document.getElementById('drPage').disabled = false;
//				document.getElementById('grPageD').disabled = false;
//				document.getElementById('hdnflg').value = "1";
//				document.getElementById('drMetal').style.display = 'block';
//				document.getElementById('cmbShape').style.display = 'block';
//				document.getElementById('cmbCarat').style.display = 'block';
//				document.getElementById('divpaging').style.display = 'block';
//				*/
//			}

function fnDefalut() {

    if (document.getElementById('hdnDefaultImage').value != "") {
        fnSetFlashVaribles(document.getElementById('hdnDefaultImage').value);
    }
    else if (aShape.length != 0) {
        fnThumbnail(aShape[0][4]);
    }
    else {
        return;
    }
}
function fnThumbnail(strShape) {
    var intCount = 0;
    var flgSet = true;
    document.getElementById('tdThumbnails').innerHTML = "";
    //document.Form1.imgZoom.alt = "";

    for (var i = 0; i < aShape.length; i++) {
        if (strShape == aShape[i][8]) {
            for (var j = 0; j < 4; j++) {
                if (aShape[i][j] != '') {
                    var a = aShape[i][j];
                    var b = aShape[i][j + 4];
                    var len = a.split("\\");
                    var lenb = b.split("\\");
                    a = "";
                    b = "";
                    for (var k = 0; k < len.length; k++) {
                        if (k + 1 == len.length) {
                            a += len[k];
                        }
                        else {
                            a += len[k] + "\\\\";
                        }
                    }
                    for (var k = 0; k < lenb.length; k++) {
                        if (k + 1 == lenb.length) {
                            b += lenb[k];
                        }
                        else {
                            b += lenb[k] + "\\\\";
                        }
                    }
                    //document.Form1.imgZoom.src = aShape[i][j];
                    if (flgSet) {
                        fnSetFlashVaribles(b); //Set Flash Variable
                        flgSet = false;
                    }

                    var objlbl = document.getElementById("lblMsg");
                    objlbl.innerText = "";
                    document.getElementById('tdThumbnails').innerHTML += "<table><tr><td align='center'><img border=1 alt='Image not available' onmouseover='ChangeCursorToHand(this)' onerror=\"LoadImageFailed(this);\" onclick=\"javascript:fnSetFlashVaribles('" + b + "')\"  title='" + aShape[i][8] + "'  src='" + aShape[i][j] + "'></td></tr></table>";
                }
                else {
                    intCount++;
                }
            }
            if (intCount == 4) {
                fnSetFlashVaribles(""); 	//Set Flash Variable
                //if(a)
                //document.getElementById('tdThumbnails').innerHTML  +=  "<table><tr><td align='center'><img border=1 alt='Image not available' style='cursor: Hand' onclick=\"javascript:fnSetFlashVaribles('"+ a +"')\" width=50 height=50  title='" + aShape[i][4] + "'  src='" + aShape[i][j] + "'></td></tr></table>";
                var objlbl = document.getElementById("lblMsg");
                objlbl.innerText = "Image Not Available";
                //document.Form1.imgZoom.src = "";
                //document.Form1.imgZoom.alt = "Image not available";
                //alert('Image not available');
            }

            break;
        }
    }

}

function LoadImageFailed(obj) {
    obj.parentNode.removeChild(obj);
    var imgArray = document.getElementById('tdThumbnails').getElementsByTagName('img');
    if (imgArray.length == 0) {
        var objlbl = document.getElementById("lblMsg");
        objlbl.innerText = "Image Not Available";
    }
}

//Set Flash Varibles
function fnSetFlashVaribles(strImagePath) {
    so = null;

    so = new FlashObject("Image.swf?imageData=" + strImagePath, "imgZoom", "525", "525", "8", "#FFFFFF");
    so.addVariable("lang", "en");
    so.addVariable("enforce", "0");
    so.addParam("menu", "false");
    so.addParam("wmode", "transparent");
    so.addParam("swLiveConnect", "false");
    so.addParam("loop", "false");
    so.addParam("scale", "noborder");
    so.addParam("Quality", "best");
    so.write("flashcontent");

    //document.getElementById('imgZoom').movie="Image.swf?imageData=" + strImagePath;
    //document.getElementById('imgZoom').src = "Image.swf?imageData=" + strImagePath;
    //document.getElementById('imgZoom').src = "Image.swf?imageData=" + img.src;
    //document.getElementById('imgZoom').movie = "Image.swf?imageData=" + img.src;

    //so.addVariable("imageData",loadImage);

}


function window_resize(evt) {
    adjustHeight();
}

function adjustHeight() {
    var intWindowHeight = WindowObject.getInnerDimension().getY();
    var dynModalBG = new DynamicLayer("ModalBG");
    var intModalHeight = dynModalBG.getHeight();

    if (intModalHeight < intWindowHeight) {
        dynModalBG.setHeight(intWindowHeight);
    }
}

function addExtensionsForOpera() {
    /* classes for opera */
    var ModalBG = new CBObject("ModalBG").getObject();
    if (typeof (window.opera) != "undefined") {
        ModalBG.className = "modalOpera";
    }
}

function attachOpacityCSS() {
    /*
    * CSS for opacity support
    * Note that this can be directly added to the body.
    * If you do not care about blindly adhering to standards
    * you can directly include the rules into Master.css
    *
    * Do I care? Yes and no.(visit http://www.sarmal.com/Exceptions.aspx
    * to learn how I feel about it).
    */
    var opacityCSS = document.createElement("link");
    opacityCSS.type = "text/css";
    opacityCSS.rel = "stylesheet";
    opacityCSS.href = "Opacity.css";
    document.getElementsByTagName("head")[0].appendChild(opacityCSS);
}

function zoomlink(id1, id, sCurObj, apdiv, shepid, bid, selid) {
    if (id == oZoom1) {
        id1 = imgZoomId1;
        id = oZoom1;
        sCurObj = curobj1.id;
    }
    else {
        id1 = id1.id;
        sCurObj = sCurObj.replace(sCurObj.substring(sCurObj.length - 13), '0_hdnShapeChange');
    }

    id = document.getElementById(id).value;
    FindWindowSize();
    var DefShape = id1//id1.id;
    var DefShape1;
    DefShape = DefShape.substring(0, DefShape.lastIndexOf('_') + 1);
    DefShape = DefShape + "Hidden1";

    var hShapeItmId = document.getElementById(shepid);
    var hShape = new String(sCurObj);
    hShape = hShape.replace('lblItemName', 'hdnShapeChange');
    hShape = document.getElementById(hShape);
    var SelShape = document.getElementById('ctl00_ContentPlaceHolder1_hdnShape');
    if (hShape.value == "") {
        if (SelShape.value != "")
            DefShape1 = SelShape.value
        else {
            var sShapeButton = id1;
            sShapeButton = sShapeButton.replace('imgZoom', 'tdSettingShapeButton');
            sShapeButton = document.getElementById(sShapeButton);
            if (sShapeButton.innerHTML.indexOf('diamonds/round_button.gif', 0) != -1)
                DefShape1 = "Round";
            else if (sShapeButton.innerHTML.indexOf('diamonds/princess_button.gif', 0) != -1)
                DefShape1 = "Princess";
            else if (sShapeButton.innerHTML.indexOf('diamonds/asscher_button.gif', 0) != -1)
                DefShape1 = "Asscher";
            else if (sShapeButton.innerHTML.indexOf('diamonds/cushion_button.gif', 0) != -1)
                DefShape1 = "Cushion";
            else if (sShapeButton.innerHTML.indexOf('diamonds/radiant_button.gif', 0) != -1)
                DefShape1 = "Radiant";
            else if (sShapeButton.innerHTML.indexOf('diamonds/emerald_button.gif', 0) != -1)
                DefShape1 = "Emerald";
            else if (sShapeButton.innerHTML.indexOf('diamonds/heart_button.gif', 0) != -1)
                DefShape1 = "Heart";
            else if (sShapeButton.innerHTML.indexOf('diamonds/marquise_button.gif', 0) != -1)
                DefShape1 = "Marquise";
            else if (sShapeButton.innerHTML.indexOf('diamonds/oval_button.gif', 0) != -1)
                DefShape1 = "Oval";
            else if (sShapeButton.innerHTML.indexOf('diamonds/pear_button.gif', 0) != -1)
                DefShape1 = "Pear";
            else
                DefShape1 = "Round";
        }
    }
    else
        DefShape1 = hShape.value;
    //alert(DefShape1);
    var buildid = document.getElementById(bid).value;
    document.getElementById(selid).value = id;
    var strLink = baselink + "zoom_new.aspx?sitemid=" + id + "&shape=" + DefShape1 + "&buildid=" + buildid;

    var ifDISPzoom = document.getElementById("ifDISPzoom");
    ifDISPzoom.src = strLink;

    var objDivColumn = document.getElementById(apdiv);
    o = document.getElementById("tdDisplayColumnList");
    objDivColumn.style.left = getAbsLeft(o) + o.offsetWidth - 550 + 'px';
    objDivColumn.style.top = WinScrollTop + 80 + 'px';
    document.getElementById("ModalBG").style.display = 'block';

    document.getElementById("ModalBG").style.width = winWidth + 'px';
    document.getElementById("ModalBG").style.height = winHeight + 'px';
    document.getElementById("ModalBG").style.zIndex = "99999";
    var zoomdiv = document.getElementById(apdiv).style.display = 'block';
    objDivColumn.style.zIndex = "999999";

}

function ChangeData1(obj, iPath, iImg, ddlId, oPriceName, lblItemId, lblItemDesc, oDivMain, oDivSub1, oDivSub2, oHlnkItem, sHlnkItem, itmId1, oZoom, curobj, tdShapeButton, sFlgSettingMatching, sMatchingBandId, imgZoomId, viewlnk) {
    if (sFlgSettingMatching == "0") {
        var hShape = new String(curobj.id);
        hShape = hShape.replace('lblItemName', 'hdnShapeChange');
        hShape = document.getElementById(hShape);
        hShape.value = "";
    }
    else if (sFlgSettingMatching == "1") {
        var hShape = new String(curobj.id);
        hShape = hShape.replace('lblItemNameMatching', 'hdnShapeChangeMatching');
        hShape = document.getElementById(hShape);
        hShape.value = "";
    }
    obj1 = obj; iPath1 = iPath; iImg1 = iImg; ddlId1 = ddlId; oPriceName1 = oPriceName; lblItemId1 = lblItemId;
    lblItemDesc1 = lblItemDesc; oDivMain1 = oDivMain; oDivSub11 = oDivSub1; oDivSub21 = oDivSub2; oHlnkItem1 = oHlnkItem;
    sHlnkItem1 = sHlnkItem; itmId11 = itmId1; oZoom1 = oZoom; curobj1 = curobj; tdShapeButton1 = tdShapeButton;
    sFlgSettingMatching1 = sFlgSettingMatching; sMatchingBandId1 = sMatchingBandId; imgZoomId1 = imgZoomId;
    viewlnk1 = viewlnk;
    fnFetchOptimize();
}
function ChangeData(obj, iPath, iImg, ddlId, oPriceName, lblItemId, lblItemDesc, oDivMain, oDivSub1, oDivSub2, oHlnkItem, sHlnkItem, itmId1, oZoom, curobj, tdShapeButton, sFlgSettingMatching, sMatchingBandId, imgZoomId, viewlnk) {
    //c//--for zoom after metal and shape selected
    var hFirstMatchId = oZoom.replace('Hidden1', 'hdnFirstMatchId');
    hFirstMatchId = document.getElementById(hFirstMatchId);
    hFirstMatchId.value = "";
    //c//--
    itemId = itmId1;
    itmimg = iImg;
    var vTdShapeButton = document.getElementById(tdShapeButton);
    vTdShapeButton.innerHTML = gTdShapeButton;
    document.getElementById(oZoom).value = itmId1;
    var curitem = document.getElementById(curobj.id);
    curitem.className = "cssDropDownnew";
    var obj1 = document.getElementById(obj);
    obj1.style.display = 'none';
    document.getElementById(lblItemId).innerHTML = lblItemDesc;
    var oldDiv1 = document.getElementById(oDivSub1).innerHTML;
    var iImgNew = document.getElementById(iImg);
    var iImgOld = document.getElementById(iImg);
    var oldImgPath = iImgOld.src
    var hypItemPath = document.getElementById(oHlnkItem);
    hypItemPath.href = sHlnkItem;
    iImgNew.src = iPath;
    document.getElementById(ddlId).innerHTML = oPriceName;
    if (navigator.userAgent.indexOf("Firefox") == -1) {
        obj1.style.display = 'none';
        newtest = document.getElementById(oDivSub1).innerHTML;
        document.getElementById(oDivSub1).innerHTML = oldDiv1;
        startscroll(oDivMain, oDivSub1, oDivSub2, oldDiv1);
    }
    else {
        var odivmain1 = document.getElementById(oDivMain);
        odivmain1.style.zIndex = "100";
        odivmain1.style.overflow = 'hidden';
        obj1.style.display = 'none';
    }
}
function zoomlink_New(id1, id, sCurObj, apdiv, bid, selid) {


    if (id == oZoom1) {
        id1 = imgZoomId1;
        id = oZoom1;
        sCurObj = curobj1.id;
    }
    else {
        id1 = id1.id;
        //alert(sCurObj);
        sCurObj = sCurObj.replace(sCurObj.substring(sCurObj.length - 13), '0_hdnShapeChange'); //hdnShapeChangeMatching
        //alert(sCurObj);
    }

    FindWindowSize();
    var DefShape = id1; //id1.id;
    var DefShape1;
    DefShape = DefShape.substring(0, DefShape.lastIndexOf('_') + 1);
    var hShape = new String(sCurObj);
    hShape = hShape.replace('lblItemName', 'hdnShapeChange');
    hShape = document.getElementById(hShape);
    var MatchId = new String(sCurObj.replace('lblItemName', 'hdnShapeChange'));
    var SetId = new String(sCurObj.replace('lblItemName', 'hdnShapeChange'));
    MatchId = MatchId.replace('hdnShapeChange', 'hdnMatchingId');
    SetId = SetId.replace('hdnShapeChange', 'hdnItemId1');
    MatchId = document.getElementById(MatchId).value;
    SetId = document.getElementById(SetId).value;
    var SelShape = document.getElementById('ctl00_ContentPlaceHolder1_hdnShape');

    //--
    var hFirstMatchId = id1;
    hFirstMatchId = hFirstMatchId.replace('imgZoom', 'hdnFirstMatchId');
    hFirstMatchId = document.getElementById(hFirstMatchId);
    if (hFirstMatchId.value != "")//this var is first set from cs for a group only once
    {
        MatchId = hFirstMatchId.value;
        var hFirstSettId = id1;
        hFirstSettId = hFirstSettId.replace('imgZoom', 'hdnFirstSettId');
        hFirstSettId = document.getElementById(hFirstSettId);
        SetId = hFirstSettId.value;
    }
    //--

    if (hShape.value == "") {
        if (SelShape.value != "")
            DefShape1 = SelShape.value;
        else
            DefShape1 = "Round";
    }
    else
        DefShape1 = hShape.value;
    //alert('New '+ DefShape1);
    var buildid = document.getElementById(bid).value;
    document.getElementById(selid).value = id;
    //alert(SetId + ' - ' + MatchId);
    if (MatchId != "0")
        var strLink = baselink + "zoom_new.aspx?itemid1=" + SetId + "&itemid2=" + MatchId + "&shape=" + DefShape1 + "&buildid=" + buildid;
    var ifDISPzoom = document.getElementById('ifDISPzoom');
    ifDISPzoom.src = strLink;
    var objDivColumn = document.getElementById(apdiv);
    o = document.getElementById("tdDisplayColumnList");
    objDivColumn.style.left = getAbsLeft(o) + o.offsetWidth - 550 + 'px';
    objDivColumn.style.top = WinScrollTop + 80 + 'px';
    document.getElementById("ModalBG").style.display = 'block';

    document.getElementById("ModalBG").style.width = winWidth + 'px';
    document.getElementById("ModalBG").style.height = winHeight + 'px';
    var zoomdiv = document.getElementById(apdiv).style.display = 'block';
    objDivColumn.style.zIndex = "999999";
}

	
