
function pp_orderLink(pId, pDesc, linkText, linkClass) {
	// Fourth parameter is CSS class name for generated links. 
	// If defined (even empty), full HREF code will be generated. 
	// If not defined, onClick code will be generated. 
	// First two parameters are required (there is no error checking, though).
	// CONFIGURATION:
	height = 450 
	width = 360 // should be consistent with the style sheet, i.e. fields widths
	wLeft = 130 // (screen.availWidth - width) / 2; 
	wTop = 80 // (screen.availHeight - height) / 2; 
	lTextDefault = "[default link text]" // if no third parameter, this text will be shown.
	// CONFIGURATION ENDS.
	var reApos = new RegExp("\'", "g")
	pId = pId.replace(reApos,'%27') // '
	pId = encodeURIComponent(pId)
	pDesc = pDesc.replace(reApos,'%27') // '
	pDesc = encodeURIComponent(pDesc)
	if( typeof(linkClass) == 'string') { // javascript generated link:
		resString = '<a href="javascript:'
		resString += "window.open('popup.php?"
		resString += "pId=" + pId
		resString += "&amp;"
		resString += "pDesc=" + pDesc
		resString += "', 'oppw', 'width=' + width + ', height=' + height + ', left=' + wLeft + ', top=' + wTop + ', resizable, dependant'"
		resString += ').focus();"' // window.open.
		if( linkClass.length > 0 ) resString += ' class="' + linkClass + '"'
		resString += '>'
		if( !(typeof(linkText) == 'string') || (linkText.length == 0) ) linkText = lTextDefault
		resString += linkText
		resString += '</a>'
		document.write( resString )
	} else { // onClick invoked:
		window.open('popup.php?pId=' + pId + '&pDesc=' + pDesc, 'oppw', 'width=' + width + ', height=' + height + ', left=' + wLeft + ', top=' + wTop + ', resizable, dependant').focus()
	}
	return false
}

