/*

*/
		  
var bb_pathToImage = "/images/bluebird_flying_145.gif";

//on page load call bb_init
JQ(document).ready(function(){   
	bb_init('a.busybox, area.busybox, input.busybox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = bb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function bb_init(domChunk){
  if( JQ(domChunk) ) {
  	JQ(domChunk).click(function(){
    	var t = this.title || this.name || null;
    	var a = this.href || this.alt;
    	var g = this.rel || false;
    	bb_show(t,a,g);
    	this.blur();
    	return true;
	  });
	}
}

function bb_show(caption, url, imageGroup)  {

		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			JQ("body","html").css({height: "100%", width: "100%"});
			JQ("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				JQ("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				//JQ("#TB_overlay").click(bb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				JQ("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				JQ("#TB_overlay").show();
			}
		}
	
		if(tb_detectMacXFF()){
      // JQ("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
			JQ("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}else{
			JQ("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
	
		if(caption===null){caption="";}
		JQ("body").append("<div id='TB_load' style='text-align:center'><img src='"+imgLoader.src+"' /><br/><span style='color:#BBB;font-size:16pt'>Investigating.<br/>Please be patient.  This can take a while for accounts with a lot of followers.</span><div id='status'></div></div>");//add loader to the page
		JQ('#TB_load').show();//show loader
		
}	

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}
