﻿function CheckChange(_chkimg, _chkfavorite, _imgchkon, _imgchkoff)
{
    var imgobj;
    var chkobj;

    imgobj = document.getElementById(_chkimg);        
    if(imgobj == null) return;

    obj = document.getElementById(_chkfavorite);
    if(obj == null) return;    
        
    if(obj.checked)
    {
        obj.checked = false;
        imgobj.src = _imgchkoff;
    }
    else
    {
        obj.checked = true;
        imgobj.src = _imgchkon;
    }
}

function CheckFavorite(_componentheader, _chkfavoriteheader, _chkfavoritecnt, _setfavorite, _setexecute)
{
	try
	{
	    var strchk = "";
	    var obj;
	    var setobj;
	    var postobj;

        for(var i = 0;i < _chkfavoritecnt;i++)
        {
            obj = document.getElementById(_componentheader + _chkfavoriteheader + i.toString());
            if(obj == null) return;
            if(obj.checked == true) strchk += obj.value.toString() + "|";
        }

        setobj = document.getElementById(_componentheader + _setfavorite);
        if(setobj == null) return;
	    setobj.value = strchk;
	    
        postobj = document.getElementById(_componentheader + _setexecute);
        if(postobj == null) return;
	    postobj.value = _componentheader;
        
        return true;
    }
	catch(e)
	{
	}
}

function CheckExecute(_componentheader, _setexecute)
{
	try
	{
	    var postobj;

        postobj = document.getElementById(_componentheader + _setexecute);
        if(postobj == null) return;
	    postobj.value = _componentheader;
        
        return true;
    }
	catch(e)
	{
	}
}
