document.write('<script id="__init_script" defer="true" src="//[]"><\/script>');

function registerInit(callback) {
    /* for Mozilla */
	
    if (document.addEventListener) {
        document.addEventListener("DOMContentLoaded", callback, false);
    }

    /* for Internet Explorer */

    if (document.getElementById) {
    	
        var deferScript = document.getElementById('__init_script');
        if (deferScript) {
        	
            deferScript.onreadystatechange = function() {
                if (this.readyState == 'complete') {
                    callback();
                }
            };

            /* check whether script has already completed */
            deferScript.onreadystatechange();

            /* clear reference to prevent leaks in IE */
            deferScript = null;
        }
    }
    /* for other browsers */
    window.onload = callback;
}

/* ################### ################# ######################### */

function initLinks() {
 	if (!document.getElementsByTagName) return; 
	var alinks=document.getElementsByTagName("a");
 	//alert(alinks.length); 
 	for (var i=0; i<alinks.length; i++) { 
   		if (alinks[i].getAttribute("href") && alinks[i].getAttribute("rel") == "external")  {
			alinks[i].target = "_blank";
		
   		} else if (alinks[i].getAttribute("href") && alinks[i].getAttribute("rel") == "popup_client")  {
   			//alinks[i].setAttribute("href", '#');
			alinks[i].onclick = function () {
				window.open(this.getAttribute("href"), 'Client', 'width=1050,height=700,scrollbars=no');
				return false;
			}
		}else if (alinks[i].getAttribute("href") && alinks[i].getAttribute("rel") == "popup")  {
			alinks[i].onclick = function () {
				window.open(this.getAttribute("href"), 'Popup', 'width=780,height=570,scrollbars=yes');
				return false;
			}
		}
	} 
}



function initApp() { 
	initLinks();
}

registerInit(initApp);
