JavaScript isn't my strong suit... I've tried writing this line 4 different ways, always getting the same error. How can I rewrite all the URLs inside an iframe to call a JavaScript function with the URL as an argument instead of go to their original destination?

Code:
var clicks = [];

function markMeUp(arr) {
	
	clicks = arr;
	frame = document.getElementById('overlay_frame');
	
	var linkList;
	for (var i = 0; i < frame.contentDocument.links.length; i++) {
		link = frame.contentDocument.links[i];
		if (link.href.indexOf('#', 0) > 0) {
			link.href = link.href.substring(0, link.href.indexOf('#', 0));
		}
		iconify(frame, link);
	}
	
	for (var i = 0; i < frame.contentDocument.links.length; i++) {
		var tmp = frame.contentDocument.links[i].href;
		frame.contentDocument.links[i].href = "parent.overlay('" . escape(tmp) . "')";
	}

}
Code:
Error: missing name after . operator
Source File: http://localhost/js/overlay.js
Line: 19, Column: 75
Source Code:
frame.contentDocument.links[i].href = "parent.overlay('" . escape(tmp) . "')";