function check(parent,child)
{
        $(parent).find("span:not(.red-168-text)").html("&nbsp;");
        $(parent).find("span:not(.red-168-text)").each(function() {
                if (this.id==child.id)
                {
                        $(this).html("√");
                        modify=$(parent).attr("tomodify");
                        if (modify!==undefined)
                        {
                                add=$(parent).attr("toadd");
                                if (add===undefined)
                                        add="";
                                text="&nbsp;"+add+$(child).parent().text().replace(/[^a-z0-9:]/gi,'')+"&nbsp;";
                                $("#"+modify).find("span.tui-fieldset-text").html(text);
                                variable=add.toLowerCase().replace(/[^a-z0-9]/gi,'');
                                eval(variable+"='"+child.id+"';");
                                afunction=add.toLowerCase().replace(/[^a-z0-9]/gi,'');
				eval("if (typeof "+afunction+"_callback === 'function') { "+afunction+"_callback() }");
                        }
                }
        })
}

function closemodal()
{
	$("#modal").css("visibility","hidden");
}

function showmodal()
{
	$("#modal").css("visibility","visible");
}

function hexQword(value) {
	value = value < 0 ? (value + 0x10000000000000000) : (value);
        var str = '0000000000000000' + value.toString(16).toUpperCase();
        return str.slice(-16);
};

function hexDword(value) {
	value = value < 0 ? (value + 0x100000000) : (value);
        var str = '00000000' + value.toString(16).toUpperCase();
        return str.slice(-8);
};

function hexWord(value) {
	value = value < 0 ? (value + 0x10000) : (value);
        var str = '0000' + value.toString(16).toUpperCase();
        return str.slice(-4);
};

function hexByte(value) {
	value = value < 0 ? (value + 0x100) : (value);
        var str = '00' + value.toString(16).toUpperCase();
        return str.slice(-2);
};

function toHex(hexa,code)
{
	if (code==16)
		result=hexWord(hexa);
	else if (code==32)
		result=hexDword(hexa);
	else
		result=hexQword(hexa);
	return result;
}
