function aitc_radio_check(name1){
var a=document.getElementsByName(name1);
for (c=0;c<a.length;c++)
{
	var fld = eval("document.all."+a[c].id);
	fld.src = "/TPM/images/rb.gif";
	try { 
		var btt = eval("document.all."+a[c].id+"_h");
		btt.value = ""; 
		}
	catch (e) {}
	}
}

function aitc_radio_getvalue(name1){
var a=document.getElementsByName(name1);
for (c=0;c<a.length;c++)
{
	var fld = eval("document.all."+a[c].id);
	if (fld.src.substr(fld.src.length-14,14) == "rb_checked.gif") {
		var b = eval(fld.id + "_var");
		return b;
		}
		}
}

function aitc_radio_getvalue1(name1,path){
var a=eval(path+".document").getElementsByName(name1);
for (c=0;c<a.length;c++)
{
	var fld = eval(path+".document.all."+a[c].id);
	if (fld.src.substr(fld.src.length-14,14) == "rb_checked.gif") {
		var b = eval(path + "." + fld.id + "_var");
		return b;
		}
	}
}

var aitc_chooser_blur = 0;
function aitc_chooser_popupWin(url1, width, height, value1, field1, field_value, name11){
	//alert("1= " + url1+" 2= " +width+" 3= " +height+" 4= " +value1+" 5= " +field1+" 6= " +field_value+" 7= " +name11);
	var oldID;
	if (name11) { 
		var name1 = name11.substr(0, name11.length - 8);
		if (name11.substr(name11.length - 8,name11.length) == "_display") oldID = eval("document.all." + name1).value;
	}
	var popUpWin=0;
	var left=window.event.screenX-(width-(2-event.offsetX));
	var top=window.event.screenY+(18-event.offsetY);
	aitc_chooser_focusvalue = value1;
	var url="/TPM/includes/aitc_chooser_main_win.asp?asp="+url1+"&value1="+value1+"&field1="+field1+"&field2="+name11+"&blur="+aitc_chooser_blur+"&field_value="+escape(field_value)+"&oldID="+oldID;
	aitc_chooser_blur=0;
	if (screen.height < (top + height+40)) top = top - (50 + height);
	popUpWin = window.showModalDialog(url,"dialog_choose","dialogHeight: "+height+"px; dialogWidth: "+width+"px; dialogTop: "+top+"px; dialogLeft: "+left+"px; edge: Raised; center: No; help: No; resizable: Yes; status: No;");
	eval(popUpWin);
	try {
		var dispField = eval("document.all."+name11)
		if (!dispField) throw 1
	}
	catch(e){
		try {
			var dispField = eval("document.all."+field1+"_display")
		}catch(e){}
	}
	if(dispField) dispField.value = aitc_chooser_replaceQuote(dispField.value);
	if (popUpWin) return true;
  }

function dinamic_load_valuelist (src) {
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp.open("GET", src, false);
	xmlhttp.send();
	return unescape(xmlhttp.responseText);
}

function chooser_nls_copy(key) {
	if((window.event.ctrlKey) && (window.event.altKey)) {
		window.clipboardData.setData('Text',unescape('%3C%25 NLS_H(%22'+key+'%22) %25%3E'));
		}
}

function aitc_lc_law_docPreview(cType, pId) {
	if(pId != "") {
		var width = 600;
		var height = 500;
		var path =  dinamic_load_valuelist ("/TPM/lc/law_documents/lc_law_doc_getPath.asp?cType="+cType+"&pId="+pId);
		var left = (screen.width - width) / 2;
		var top = (screen.height - height) / 2;
		if (cType == 1) var src = "/TPM/attachments/lc/law_documents/general/" + path
		else var src = "/TPM/attachments/lc/law_documents/specific/" + path
		window.open(src, '_blank', 'toolbar=no, scrollbars=no, menubar=no, status=no, scrollbars=yes, resizable=yes, width='+width+', height='+height+', left='+left+', top='+top);
	}
}

