function externalLinks(){if(!document.getElementsByTagName){return }var C=document.getElementsByTagName("a");for(var B=0;B<C.length;B++){var A=C[B];if(A.getAttribute("href")&&A.getAttribute("rel")=="external"){A.target="_blank"}}}Event.observe(window,"load",function(){externalLinks()});
function jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if(restore){selObj.selectedIndex=0}};


function findPos(element){
	var getpos=curtop=0;
	if(element.offsetParent){
		getpos=element.offsetLeft;
		curtop=element.offsetTop;
		while(element=element.offsetParent){
			getpos+=element.offsetLeft;
			curtop+=element.offsetTop;
		}
	}
	return [getpos,curtop];
}

function generateBubble(source,content){
	bs = $(source);
	if (bs.href == undefined){
		bs=bs.parentNode;
	}
	var is_ie6 = (
		window.external &&
		typeof window.XMLHttpRequest == "undefined"
	);
	if(!is_ie6){
		var xpos=findPos(bs)[0]+5;
		var ypos=findPos(bs)[1]+17;
		var bub = document.createElement("div");
		document.getElementsByTagName("body")[0].appendChild(bub);
		bub.id = source + "_bubble";
		bub.style.width = "240px";
	
		bub.setAttribute("style","z-index: 999999; position: absolute; top: "+ypos+"px ; left: "+xpos+"px ; width: 240px; padding: 0; margin: 0;");
		
		var bubtop = document.createElement("div");
		$(bub.id).appendChild(bubtop);
	
		bubtop.setAttribute("style","background: url('i/layout/bubbletop.png') no-repeat; width: 240px; height: 30px;");
		
		var bubmid = document.createElement("div");
		$(bub.id).appendChild(bubmid);
	
		bubmid.id = source + "_bubblecontent";

		bubmid.setAttribute("style","background: url('i/layout/bubble.png') repeat-y; width: 240px;");
		
		var bubbot = document.createElement("div");
		$(bub.id).appendChild(bubbot);

		bubbot.setAttribute("style","background: url('i/layout/bubblebottom.png') no-repeat; width: 240px; height: 15px;");
		
		var bubcontent = document.createElement("div");
		bubmid.appendChild(bubcontent);
		
		bubcontent.className = "bubblecontent";
		bubcontent.style.width = "190px";
		bubcontent.style.marginLeft = "25px";
		bubcontent.style.paddingTop = "5px";
		bubcontent.style.paddingBottom = "5px";
		bubcontent.style.paddingRight = "10px";
		
		bubcontent.innerHTML = content;
	}
}

function destroyBubble(source){
	Element.remove(source + "_bubble");
}

function closeSearchBubble(){
	setTimeout('destroyBubble(\'searchinput\')',200);
}

function switchProfileTabs(id){
	$('user-about').style.display = 'none';
	$('user-renewable').style.display = 'none';
	$('user-tips').style.display = 'none';
	$(id).style.display = '';
}

function switchCompanyProfileTab(id){
	$('company-profile-tab').style.display = 'none';
	$('company-recommendations').style.display = 'none';
	$(id).style.display = '';
}

function switchCompanyTabs(id){
	$('company-description').style.display = 'none';
	$('company-wework').style.display = 'none';
	$('company-nittygritty').style.display = 'none';
	$(id).style.display = '';
}
