// bookmark functionality
function bookmark(url, title){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
		window.external.AddFavorite(url, title);
	} else if (navigator.appName == "Netscape") {
		window.sidebar.addPanel(title, url, "");
	} else {
	    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}

//  this shows and hides the language selector
function showLanguage(obj) {
    var d = document.getElementsByTagName('div');
    for(i=0;i<d.length;i++) {
        var a = d[i].className;
        if(a == 'divLanguages') {
            var l = d[i].getElementsByTagName('ul');
            for(x=0;x<l.length;x++) {
                var c = l[x].className;
                if(c == 'ulLanguages') {
                    l[x].className = 'openLanguage';
                    //  create new list item and link then append to list
                    var n = document.createElement('li');
                    n.setAttribute('id','closeLink');
                    var na = document.createElement('a');
                    na.setAttribute('href','javascript:showLanguage();');
                    na.innerHTML = 'Close';
                    n.appendChild(na);
                    l[x].appendChild(n);
                } else {
                    l[x].className = 'ulLanguages';
                    var e = l[x].lastChild;
                    l[x].removeChild(e);
                }
            }
        }
    }
}

function headerAdjust() {
	if($('td#col03 img').length > 0) {
		$('td#col03').attr({
			width: $('td#col03 img')[0].width
		});
	}
	
	if($('td#col04 img').length > 0) {
		$('td#col04').attr({
			width: $('td#col04 img')[0].width
		});
	}
}

$(document).ready(function () {
	headerAdjust();
	
	if($('a.aCallNow').length == 0) {
		$('div.callInfo').css('display','none');
	}
});

// this is a multiple window onload function - in the case new functions are added in the future
function addOnloadEvent(fnc){
  if ( typeof window.addEventListener != "undefined" )
    window.addEventListener( "load", fnc, false );
  else if ( typeof window.attachEvent != "undefined" ) {
    window.attachEvent( "onload", fnc );
  }
  else {
    if ( window.onload != null ) {
      var oldOnload = window.onload;
      window.onload = function ( e ) {
        oldOnload( e );
        window[fnc]();
      };
    }
    else
      window.onload = fnc;
  }
}

//addOnloadEvent(showLanguage);