﻿// JScript File

function ExpCollapse(id)
{
    var _cnt=document.getElementById(id);
    _cnt.style.display=='' ?_cnt.style.display='none'
                           :_cnt.style.display='';
    //if(_cnt.childNodes.length<2) alert("TEST ETTIM");
    _cnt.style.display='';
    if(window.CollapseOthers) CollapseOthers(id);
}

function CollapseOthers(id)
{
    var arr=document.getElementsByTagName("td");
    for(i = 0; i < arr.length;i++)
	    if(arr[i].id.substring(0, arr[i].id.lastIndexOf('_')) == id.substring(0, id.lastIndexOf('_')) && arr[i].id != id)
		    arr[i].style.display='none';
}

function ShowImage(FileID, ControlID, ShowPopup)
{
 ImageViewer.GetImageUrl(FileID,ControlID,ShowPopup,ShowImageCallBack);   
}

function ShowImageCallBack(res)
{
    if(res.error != null)
    {
        alert(res.error.Message);
        return;
    }
    if(res.value[1]=="0"){
        var _cntimage=document.getElementById(res.value[0]+"_image");
        _cntimage.src=res.value[2];
        
        var _cntviewer=document.getElementById(res.value[0]+"_viewer");
        _cntviewer.style.display="";
    }
    else
    {
        var x_Width=Number(res.value[3])+50;
        var x_Height=Number(res.value[4])+50;
		var x_Left=(window.screen.width-x_Width)/2;
        var x_Top=(window.screen.height-x_Height)/2;
        window.open(res.value[2], "", "left="+x_Left+",top="+x_Top+",width="+x_Width+",height="+x_Height+",status=no,resizable=yes");
    }
}
function makevisible(cur,which)
{
    strength=(which==0)? 1 : 0.5
    if (cur.style.MozOpacity)
        cur.style.MozOpacity=strength
    else if (cur.filters)
        cur.filters.alpha.opacity=strength*100
}
