// Common JavaScript Functions
function setSelectByValue(field, val)
{//alert("setting " + field.name);
	var opts = field.options;
//alert("ok");
	for (var i=0; i < opts.length; i++)
	{
		if (field.options[i].value== val)
		{
			field.selectedIndex = i;
		}
	}
}

function showBlock(id, blockName)
{
	document.getElementById(blockName+"_"+id).style.display = 'block';
}

function hideBlock(id, blockName)
{
	var varCheck=document.getElementById(blockName+"_"+id).style.display;
	
	if(varCheck=='block'){
		document.getElementById(blockName+"_"+id).style.display = 'none';
	}
	else {
		document.getElementById(blockName+"_"+id).style.display = 'block';	
	}
}

/* class changing */
var changeClass_previousElement = new Object();
var changeClass_previousClass = '';

function changeClass(obj, highlightClass)
{
	// set the previous element back to its old class
	changeClass_previousElement.className = changeClass_previousClass;
	// remember this element and class so we can set it back
	changeClass_previousElement = obj;
	changeClass_previousClass = obj.className;
	// set this element to the highlight class
	obj.className = highlightClass;
}

function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=460');");
}
function popUpBig(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800,height=600');");
}

function viewRN2(uid)
	{
		day = new Date();
		id = day.getTime();
		eval("rn_window = window.open('/qr/view-rn.cfm?uid=" + uid + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=600');");
	}
	
	function viewRN3(uid)
	{
		day = new Date();
		id = day.getTime();
		eval("rn_window = window.open('/qr/view-closed-rn.cfm?uid=" + uid + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=600');");
	}
	
function viewRN(uid)
	{
		day = new Date();
		id = day.getTime();
		eval("rn_window = window.open('../rejectnote/EditRejectNote.cfm?" + uid + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=1030,height=600');");
	}
	
	function viewRNHOME(uid,varPage)
	{
		day = new Date();
		id = day.getTime();
		if(varPage=='qr')	{
			eval("rn_window = window.open('../rejectnote/EditRejectNote.cfm?" + uid + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=1030,height=600');");
		}
		else	{
			eval("rn_window = window.open('rejectnote/EditRejectNote.cfm?" + uid + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=1030,height=600');");
		}
	}
	
function viewClosedRN(uid)
	{
		day = new Date();
		id = day.getTime();
		eval("rn_window = window.open('view-closed-rn.cfm?uid=" + uid + "', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=600');");
	}
