(function(){
	var t = (pshark_pop_type) ? pshark_pop_type : "overview";
	var a = "<a href=\"#\" onclick=\"psharkPopup(this,{'w':'"+pshark_pop_width+"','h':'"+pshark_pop_height+"','p':'"+pshark_pop_propkey+"','t':'"+t+"','tabs':'"+pshark_pop_tabs+"'});return false;\">";
	document.write(a+"<img src=\"http://propertyshark.com/api/pop.gif\" width=\"12\" height=\"12\" border=\"0\" /></a>")
	if (pshark_pop_title) {
		document.write(" "+ a + pshark_pop_title + "</a>");
	}

 
	addDOMLoadEvent = (function(){
	    // create event function stack
	    var load_events = [], load_timer, script, done, exec, old_onload,
	        init = function () {
	            done = true;
	
	            // kill the timer
	            clearInterval(load_timer);
	
	            // execute each function in the stack in the order they were added
	            while (exec = load_events.shift())
	                exec();
	
	            if (script) script.onreadystatechange = '';
	        };
	
	    return function (func) {
	        // if the init function was already ran, just run this function now and stop
	        if (done) return func();
	
	        if (!load_events[0]) {
	            // for Mozilla/Opera9/new versions of Safari
	            if (document.addEventListener){
	                document.addEventListener("DOMContentLoaded", init, false);
				}else{
	
		            // for Internet Explorer
		            /*@cc_on @*/
		            /*@if (@_win32)
		                document.write("<script id=__ie_onload_pshark defer src=//0><\/scr"+"ipt>");
		                script = document.getElementById("__ie_onload_pshark");
		                script.onreadystatechange = function() {
		                    if (this.readyState == "complete")
		                        init(); // call the onload handler
		                };
		            /*@end @*/
		
		            // for Safari
		            if (/WebKit/i.test(navigator.userAgent)) { // sniff
		                load_timer = setInterval(function() {
		                    if (/loaded|complete/.test(document.readyState))
		                        init(); // call the onload handler
		                }, 10);
		            }
		
		            // for other browsers set the window.onload, but also execute the old window.onload
		            old_onload = window.onload;
		            window.onload = function() {
		                init();
		                if (old_onload) old_onload();
		            };
				}
	        }
	
	        load_events.push(func);
	    }
	})();
	
	
	addDOMLoadEvent(function() {
		psharkInclJS("psharkPopupJS",'http://propertyshark.com/api/popExtended.js');
		psharkInclCSS("psharkPopupCSS",'http://propertyshark.com/api/pop.css');
	});
})();

function psharkPopup(p,o){
	if (psharkPopupShow) {
		psharkPopupShow(p,o);
	}
}

function psharkInclJS(id,f){
	for(var i=0; (js = document.getElementsByTagName("script")[i]); i++) {
		if (js.id == id) {
			return;
		}
	}
	var html_head = document.getElementsByTagName('head').item(0);     
	var js = document.createElement('script');
	js.setAttribute('type','text/javascript');
	js.id = id;
	js.setAttribute('src', f);
	html_head.appendChild(js);
}

function psharkInclCSS(id,f,media) {
	if (!document.getElementById(id)){
		var html_head = document.getElementsByTagName('head').item(0);
		var css = document.createElement('link');
		css.setAttribute('rel', 'stylesheet');
		css.setAttribute('type', 'text/css');
		css.setAttribute('id', id);
		css.setAttribute('href', f);
		if (media) css.setAttribute('media', media);
		html_head.appendChild(css);
	}
}
