function Loc(URL){document.location(URL)}
function GetObj(id){return document.getElementById(id)}
function QA_Link(val){Loc("http://www.manta.com"+val+"?tab=companyqa")}
function wr(txt){document.write(txt)}

myTimeEvt=""
function Quote(QAobj,id,timeout){
	if(myTimeEvt != ""){clearTimeout(myTimeEvt)}
	arrID="QA_"+id //1,2,3
	arr=eval(arrID)
	QA_link=arr[0];QA_subj=arr[1];
	newLINK=GetObj('QUOTE_LINK');
	newSUBJ=GetObj('QUOTE_SUBJECT');
	QA_tab="?tab=companyqa"
	newSUBJ.href=QA_link+QA_tab;
	newLINK.href=QA_link+QA_tab;
	newSUBJ.innerHTML=QA_subj;
	if(timeout){
		RollObjName='QUOTE'
		myTimeEvt=setTimeout("HidePopUp(RollObjName)",750); // sets this one to hide soon
	}
	var bubble = GetObj('QUOTE')
	bubble.style.display = "block";
	ht=bubble.offsetHeight
	// get DIV abs pos or mouse pos
	r=getAbsolutePosition(QAobj)
	LT=r.x;TP=r.y;
	if(isNaN(LT)){
		var coords = findCoords(event);
		bubble.style.top = coords[1] - ht + "px";
		bubble.style.left = coords[0] - 75 + "px"
	} else {
		bubble.style.top = TP - ht +20+ "px";
		bubble.style.left = LT - 55 + "px"
	}
	//alert('LT:'+LT+' TP:'+TP)
}
function KillTimeout(){if(myTimeEvt != ""){clearTimeout(myTimeEvt)}}
function HidePopUp(ID,timeout){
	if(timeout){
		KillTimeout()
		RollObjName='QUOTE'
		myTimeEvt=setTimeout("HidePopUp(RollObjName)",750);
	}else{
		obj=GetObj(ID);obj.style.display="none"
	}
}
function getAbsolutePosition(element) {
	var r = { x: element.offsetLeft, y: element.offsetTop };
	if (element.offsetParent) {
		var tmp = getAbsolutePosition(element.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
	return r;
};

function QA_CheckboxOnClick(){
	if (document.getElementById('refine_company_qa_1').checked)
	{document.getElementById('refine_company_qa_1').checked = false;}
	else // No checked.
	{document.getElementById('refine_company_qa_1').checked = true;}
	showUberCriteria();
	autoUberRefine();
}
function show_popup_details(e,el){
	el.style.backgroundImage= el.style.backgroundImage.replace('_u.gif', '_r.gif');
	//ecnext.byId(el.id+'-p').style.display='';
}
function hide_popup_details(el){
	el.style.backgroundImage= el.style.backgroundImage.replace('_r.gif', '_u.gif');
	//ecnext.byId(el.id+'-p').style.display='none';
}
function hover(id){
ecnext.byId('fladl'+id).style.backgroundImage="url(/manta/images/featured_listings/ad/ad-left-border-hover.gif)";
ecnext.byId('fladr'+id).style.backgroundImage="url(/manta/images/featured_listings/ad/ad-right-border-hover.gif)";
}
function unhover(id){
ecnext.byId('fladl'+id).style.backgroundImage="url(/manta/images/featured_listings/ad/ad-left-border.gif)";
ecnext.byId('fladr'+id).style.backgroundImage="url(/manta/images/featured_listings/ad/ad-right-border.gif)";
}

function wr(txt){document.write(txt)}

function WriteBubbleHTML(IE6){
	ext='png'
	if (IE6){ext='gif'}
	wr("<div id=\"QUOTE\" class=\"BubbleCont_"+ext+"\" onMouseOver=\"KillTimeout()\" ");
	wr("onMouseOut=\"HidePopUp('QUOTE',1)\"><table id=\"Bubble\" width=390 cellspacing=\"0\" cellpadding=\"0\" border=\"0\">");
	wr("<tr><td id=\"TopLeft_"+ext+"\" width=20></td><td id=\"TopMiddle_"+ext+"\" width=350></td><td id=\"TopRight_"+ext+"\" width=20></td></tr>");
	wr("<tr><td id=\"MiddleLeft_"+ext+"\" width=20>&nbsp;</td>");
	wr("<td id=\"MiddleText\" width=350>");
	wr("<div class=\"QuestionText\">Most recent question:</div>");
	wr("<div class=\"QuestionLinkContainer\"><a class=\"QuestionLink\" href=\"\" id=\"QUOTE_SUBJECT\"></a></div>");
	wr("<a ID=\"QUOTE_LINK\" class=\"contentLabelLink\" href=\"\">View All Questions and Answers for this Company</a>");
	wr("</td>");
	wr("<td id=\"MiddleRight_"+ext+"\" width=20>&nbsp;</td>");
	wr("</tr>");
	wr("<tr><td id=\"BottomLeft_"+ext+"\" width=20 height=46 valign=top><img src=\"/manta/images/dot_clear.gif\" width=20 height=46 /></td>");
	wr("<td id=\"BottomMiddle_"+ext+"\" width=350 height=46></td><td valign=top id=\"BottomRight_"+ext+"\" width=20 height=46><img src=\"/manta/images/dot_clear.gif\" width=20 height=46 /></td></tr>");
	wr("</table></div>");
}
axn=""
function MB_search(F){
	if(axn==""){orig_search_action=axn=F.action}
	F.action=orig_search_action
	sw=GetObj('search_within');
	sw_false=0
	if(sw){if (sw.checked==false){sw_false=1;F.action=GetObj('searchBoxSelection').action}}
	if( F.search.value != '' && (F.search.value != F.search.defaultValue || sw_false==1) ){
		F.submit()
	}else{
		alert('Please enter a company name, category or location.')
	}
	return false;
}

/*MB_search replaces these two functions*/
axn=""
function ChkAction(F){
	if(axn==""){orig_search_action=axn=F.action}
	F.action=orig_search_action
	if(GetObj('search_within').checked==false){F.action=GetObj('searchBoxSelection').action} // "/mb"
}
function MBsearch(mb_search_form){
	var search_types= document.getElementsByName('search_type');
	var base_action= document.getElementById('searchBoxSelection').action;
	var val= '';
	if(search_types[0].type == 'radio')
	{
		for(var i=0; i<search_types.length; i++)
		{
			if(search_types[i].checked)
			{
				val= search_types[i].value;
			}
		}
		if(val == 'all')
		{
			mb_search_form.action=base_action;
		}
	}
	return true;
}
