
////////////////////////////////////////////////////////////////////////
/* bookmark function for numeruos browsers  */

function bookmarkinit() {
var IE = navigator.appName.match(/(Microsoft Internet Explorer)/gi), 
    NS = navigator.appName.match(/(Netscape)/gi), 
    OP = navigator.appName.match(/(Opera)/gi), 
    BK = document.getElementById("bookmark");



    BK.onmouseout = function(){ 
       window.status = ''; 
       return true; 
    } 

    if(IE && document.uniqueID){ 
       BK.onclick = function(){ 
          window.external.AddFavorite(location.href,document.title); 
       } 
       BK.onmouseover = function(){ 
          window.status='Click to add this page to your '+RegExp.$1+' favorites'; 
          return true; 
       } 
    } 

    else if(OP || IE && !document.uniqueID){ 
       BK.onclick = function(){ 
          alert('Your '+RegExp.$1+' browser requires that you\nPress Ctrl & T to Bookmark this page.'); 
       } 
       BK.onmouseover = function(){ 
          window.status='Your '+RegExp.$1+' browser requires that you Press Ctrl & T to Bookmark this page.'; 
          return true; 
       } 
    } 

    else if(NS){ 
       BK.onclick = function(){ 
          alert('Your '+RegExp.$1+' browser requires that you\nPress Ctrl & D to Bookmark this page.'); 
       } 
       BK.onmouseover = function(){ 
          window.status='Your '+RegExp.$1+' browser requires that you press Ctrl & D to Bookmark this page.'; 
          return true; 
       } 
    } 

    else{ BK.innerHTML = '' }

}

///////////////////////////////////////////////////////////////////////////////////////////////

function addLoadEvent(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
                window.onload = func;
        }
        else {
                window.onload = function() {
                        oldonload();
                        func();
                }
        }
}


function PrinterFriendly(url) {
    var width = 700,
        height = 550;
    remote = window.open("http://" + getDomainName() + url, "opener", "menubar=0,scrollbars=1,resizable=0,toolbar=0,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height);

    if (remote.opener == null) remote.opener = window;
}
function SpreadTheWord(url) {
    var width = 650,
        height = 570;

    remote = window.open("http://" + getDomainName() + url, "opener", "scrollbars=1,resizable=1,toolbar=1,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height+", menubar=no, status=no, resizable=no, toolbar=no, scrollbars=no");

    if (remote.opener == null) remote.opener = window;
}

function sizeImg(obj, _width) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
    if (tmpImg.width > _width) { obj.width = _width; }
}

function getDomainName() {
	/*var url = window.location.href;
	var end = url.indexOf("/", 7);
	if (end == -1) { end = url.length; }
	return url.substring(7, end);*/
	return "www.policegrantshelp.com";
}

/* function that show tip on your status bar when you take mouse over print\email link */

function showText(obj) {
    obj.onmouseout = function() { window.status = ""; }
    window.status = obj.innerText;
}
