function JAVAS_vConfirmation(form,message) {
  if (confirm(message))
  {
    form.submit();
  }  
}

function JAVAS_vRemoveRow(thistable, thisrow) {
	document.getElementById(thistable).deleteRow(thisrow);
}

function JAVAS_vRemoveRowByID(thistable, thisrow) {
	var theTable = document.getElementById(thistable); 
	var tableRows = theTable.rows; 
	for(i=0;i<tableRows.length;i++) 
	{
		if (tableRows[i].id == thisrow) {
			theTable.deleteRow(i);
			return;
		}		
	}
}

function JAVAS_vOnEnterSubmit(e) {
	// e is event object passed from function invocation
	var characterCode; // literal character code will be stored in this
	// variable

	// if which property of event object is supported (NN4)
	if (e && e.which) {
		e = e;
		characterCode = e.which; // character code is contained in NN4's
		// which property
	} else {
		e = event;
		characterCode = e.keyCode; // character code is contained in IE's
		// keyCode property
	}

	if (characterCode == 13) {
		return true;
	} else {
		return false;
	}
}

function JAVAS_vClearValue(element) {
	try {
		document.getElementById(element).value = '';
	} catch (e) {
		document.getElementById(element).innerHTML = '';
	}
}

function JAVAS_vClearText(element) {
	document.getElementById(element).innerHTML = '';
}

function JAVAS_vClearParent(element) {
	window.parent.document.getElementById(element).innerHTML = '';
}

function JAVAS_vSetFocus(element) {
	document.getElementById(element).focus;
}

function JAVAS_vShowBusy(element) {
	var pic = document.getElementsByName(element);

	for ( var i = 0; i < pic.length; i++) {
		pic[i].src = "images/searching.gif";
	}
}

function JAVAS_vLoadImage(element, file) {
	var pic = document.getElementById(element);
	pic.src = file;
}

function JAVAS_vDelayImage(element, file, millis) {
	window.setTimeout('JAVAS_vLoadImage("' + element + '","' + file + '")',
			millis);
}

function JAVAS_vDelaySetfocus(element, millis) {
	window.setTimeout('JAVAS_vSetFocus("' + element + '")', millis);
}

function JAVAS_vHide(id) {
	// safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'hidden';
	} else {
		if (document.layers) { // Netscape 4
			document.id.className = 'hidden';
		} else { // IE 4
			document.all.id.className = 'hidden';
		}
	}
}

function JAVAS_vShow(id) {
	// safe function to show an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'visible';
	} else {
		if (document.layers) { // Netscape 4
			document.id.className = 'visible';
		} else { // IE 4
			document.all.id.className = 'visible';
		}
	}
}

function JAVAS_vHideAndShow(id) {
    if ( typeof JAVAS_vHideAndShow.HiddenID != 'undefined' ) 
    {
    	JAVAS_vHide(JAVAS_vHideAndShow.HiddenID);
    }
	JAVAS_vHideAndShow.HiddenID = id;
	// safe function to show an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).className = 'visible';
	} else {
		if (document.layers) { // Netscape 4
			document.id.className = 'visible';
		} else { // IE 4
			document.all.id.className = 'visible';
		}
	}
}

function JAVAS_vPreviewLocalImage(localimage) {
	var content;
	var PreviewImage = new Image();
	localimage = 'file:///' + localimage;
	localimage = localimage.replace(/\\/, '/');
	PreviewImage.src = localimage;
	content = "<font class='size14bold color4'>This is a preview of the image that you want to upload.</font><br><br>";
	content += "<img oncontextmenu='return false;' src='" + String(localimage)
			+ "' border=\"2\" height=\"" + PreviewImage.height + "\" width=\""
			+ PreviewImage.width + "\"><br>";
	content += "<font class='color4'>Dimensions detected: "
			+ PreviewImage.width + "w x " + PreviewImage.height
			+ "h</font><br>";
	content += "<font class='color8'>If the image does not appear you can still upload it or you could try and fix the problem by changing your IE settings.</font><br>";
	content += "<font class='color8'>To fix, add this site to the list of trusted sites under the Tools->Internet options->Security tab.</font><br><br>";
	try {
		document.getElementById("preview").innerHTML = content;
	} catch (e) {
		document.getElementById("preview").value = content;
	}
	document.all.preview.style.visibility = 'visible';
}