use window.parent.document; use document.location.hostname; fix regexp