var omgItemsArray=new Array();var g_CreatingMenu=false;var g_overIcon=false;var g_menuOn=false;var g_selectionTxt="";var g_Graphit=false;var g_ShowedAbout=false;if(typeof g_menuBKColor=='undefined')var g_menuBKColor="E4E4E4";if(typeof g_menuBorderColor=='undefined')var g_menuBorderColor="C0C0C0";if(typeof g_menuFontColor=='undefined')var g_menuFontColor="000000";if(typeof g_menuMouseoverColor=='undefined')var g_menuMouseoverColor="F4F4F4";function omgTrim(stringToTrim){return stringToTrim.replace(/^[\xa0\s]+|[\s\xa0]+$/g,"");}function omgToggleMenu(show){TBMenuObj=document.getElementById("omgTBMenu");if(TBMenuObj){if(show)TBMenuObj.style.visibility="visible";else{g_menuOn=false;TBMenuObj.style.visibility="hidden";}}}function omgToggleTBIcon(show,x,y){TBIconObj=document.getElementById("omgTBIcon");if(TBIconObj){if(show){TBIconObj.style.left=x+"px";TBIconObj.style.top=y+"px";TBIconObj.style.visibility="visible";}else{TBIconObj.style.visibility="hidden";}}}function omgHandleSelect(evnt){mouseY=0;mouseX=0;if(evnt){if(evnt.pageX&&evnt.pageY){mouseX=evnt.pageX;mouseY=evnt.pageY;}else{scrollOffset=omgGetScrollXY();mouseX=evnt.clientX+scrollOffset[0];mouseY=evnt.clientY+scrollOffset[1];}}if(document.selection){no_searchamabobFlag=false;if(evnt){if(evnt.srcElement){if(evnt.srcElement.id=='no_searchamabob'){no_searchamabobFlag=true;}}}if(document.selection.createRange().text&&!no_searchamabobFlag){g_selectionTxt=document.selection.createRange().text;omgToggleTBIcon(true,mouseX+18,mouseY-18);return;}}else{d=window.getSelection()+'';if(evnt){if(evnt.target){if(evnt.target.id=='no_searchamabob'){d=null;}}}if(d){if(d.length>0){g_selectionTxt=d;omgToggleTBIcon(true,mouseX+18,mouseY-18);return;}}}omgToggleTBIcon(false,0,0);omgToggleMenu(false);GraphObj=document.getElementById("omgGraphID");if(GraphObj&&!g_Graphit){document.body.removeChild(GraphObj);}g_Graphit=false;omgAboutObj=document.getElementById("omgAboutID");if(omgAboutObj&&!g_ShowedAbout){document.body.removeChild(omgAboutObj);}g_ShowedAbout=false;}function omgSearchGoogle(){var lsGURL="http://www.google.com/cse?cx=017732515938117786107%3Ao48vydu9gig&ie=UTF-8&q=";var strGoogleURL=lsGURL+encodeURI(g_selectionTxt);window.open(strGoogleURL);}function omgSearchCustom(strEngine){strEngine=strEngine.replace("<term>",encodeURI(g_selectionTxt));strEngine=strEngine.replace("[term]",encodeURI(g_selectionTxt));window.open(strEngine);}function omgSearchPredefined(strEngine){omgSearchCustom(strEngine)}function omgGraph(obj){g_Graphit=true;e=obj;var l=0;var t=0;while(e){l+=e.offsetLeft;t+=e.offsetTop;e=e.offsetParent;}searchString=omgLimitWords(g_selectionTxt,5);ifrm=document.createElement("IFRAME");ifrm.setAttribute("src",'http://www.omgili.com/graph.search?qa='+encodeURI(searchString)+'&d=1&graph=0&tf=2&width=375&height=337&formType=0');ifrm.setAttribute("frameborder","0");ifrm.setAttribute("scrolling","NO");ifrm.setAttribute("id","omgGraphID");ifrm.setAttribute("name","omgGraphID");ifrm.style.width=375+"px";ifrm.style.height=338+"px";ifrm.style.position="absolute";ifrm.style.top=t+"px";ifrm.style.left=l+"px";ifrm.style.border="1px solid black";document.body.appendChild(ifrm);}function omgLimitWords(searchString,count){selectionTxtArray=searchString.split(" ");tmpSearchString="";for(i=0;i<selectionTxtArray.length;i++){if(i>=count)break;tmpSearchString+=selectionTxtArray[i]+" ";}tmpSearchString=omgTrim(tmpSearchString);return tmpSearchString;}function omgSearchOmgili(){searchString=omgLimitWords(g_selectionTxt,10);window.open("http://www.omgili.com/omgili.search?q="+encodeURI(searchString)+"&searchamabob");}function omgShowAbout(){WinDim=omgGetWinSize();scrollOffset=omgGetScrollXY();strTxt='<div align=left style="margin:15px;font-size:16px;color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;">Searchamabob is a cool widget you can add to your site.<br><br>\
			 Just add one Javascript line to your HTML and your visitors can start using it.</div><br>\
			 <span style="color:#'+g_menuFontColor+';font-size:14px;">For more information visit:</span> <a href="http://www.omgili.com/searchamabob/" style="color:blue;font-size:14px;" onmousedown="window.location.href=\'http://www.omgili.com/searchamabob/\';">http://www.omgili.com/searchamabob/</a>';g_ShowedAbout=true;aboutObj=document.createElement("DIV");aboutObj.style.width=400+"px";aboutObj.style.height=300+"px";aboutObj.style.backgroundColor="#"+g_menuBKColor;aboutObj.style.border="1px solid #"+g_menuBorderColor;aboutObj.style.position="absolute";aboutObj.setAttribute("id","omgAboutID");aboutObj.setAttribute("name","omgAboutID");aboutObj.style.left=(WinDim[0]/2)+scrollOffset[0]-200+"px";aboutObj.style.top=(WinDim[1]/2)+scrollOffset[1]-150+"px";aboutObj.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3)";aboutObj.innerHTML="<center><span style='font-family: arial,helvetica,clean,sans-serif;font-size: 18px;color:#"+g_menuFontColor+";'><br><b>About Searchamabob &copy; v.1.4</b><br>"+strTxt+"</span></center>"
document.body.appendChild(aboutObj);}function omgCloseAddSearchWindow(){omgAddResourceObj=document.getElementById("omgAddResourceID");if(omgAddResourceObj)document.body.removeChild(omgAddResourceObj);}function omgCleanResource(strObj){strObj=strObj.replace(/\|/g," ");strObj=strObj.replace(/,/g," ");strObj=strObj.replace(/\"/g," ");strObj=strObj.replace(/\'/g," ");return strObj;}function omgAddEngines(){omgURLObj=document.getElementById("omgResURL");omgNameObj=document.getElementById("omgResName");if(omgURLObj&&omgNameObj){name=omgTrim(omgNameObj.value);name=name.substr(0,35);name=omgCleanResource(name);url=omgTrim(omgURLObj.value);url=omgCleanResource(url);if(name.length&&url.length){strEngines=omgGet_Cookie("Engines");if(!strEngines)strEngines="";strEngines+=name+"|"+url+",";omgSet_Cookie('Engines',strEngines,1000,'/','','');}else{alert("Please enter the search engine name and URL.");return;}}omgCloseAddSearchWindow();}function omgGetScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}return[scrOfX,scrOfY];}function omgGetWinSize(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}return[myWidth,myHeight];}function omgAddResource(){WinDim=omgGetWinSize();scrollOffset=omgGetScrollXY();Obj=document.createElement("DIV");Obj.style.width=500+"px";Obj.style.height=300+"px";Obj.style.backgroundColor="#"+g_menuBKColor;Obj.style.border="1px solid #"+g_menuBorderColor;Obj.style.position="absolute";Obj.setAttribute("id","omgAddResourceID");Obj.setAttribute("name","omgAddResourceID");Obj.style.left=(WinDim[0]/2)+scrollOffset[0]-200+"px";Obj.style.top=(WinDim[1]/2)+scrollOffset[1]-125+"px";Obj.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3)";Obj.innerHTML='<center><span style="color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;font-size: 18px;"><br><b>Add a search engine to the Searchamabob</b></span></center><br><table align=center cellpadding=5 style="color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;font-size: 14px;" ><tr><td nowrap align=left><b>Search Engine Name:</b></td>\
	<td align=left><input type=text id=omgResName name=omgResName style="width:40ex;" value="Yahoo!"></td>\
	</tr><tr>\
	<td  nowrap align=left><b>Search Engine URL:</b></td>\
	<td align=left><input type=text id=omgResURL name=omgResURL style="width:40ex;" value="http://search.yahoo.com/search?p=[term]"></td>\
	</tr>\
	<tr><td colspan=2><br><font size=-1>* The [term] token stands for the search term in the search engine address.</font></td></tr>\
	<tr>\
	<td colspan=2 align=center><br><span style="font-weight:bold;text-decoration:underline;cursor:pointer;" onclick="omgAddEngines()">Add</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight:bold;text-decoration:underline;cursor:pointer;" onclick="omgCloseAddSearchWindow()">Close</span></td>\
	</tr></table>';document.body.appendChild(Obj);}function omgDeleteEngine(evnt,engineName){evnt.cancelBubble=true;strEngines=omgGet_Cookie("Engines");tmpEngines="";if(strEngines){EnginesArray=strEngines.split(",");for(i=0;i<EnginesArray.length;i++){SavedItemsArray=EnginesArray[i].split("|");if(SavedItemsArray.length==2){name=omgTrim(SavedItemsArray[0]);url=omgTrim(SavedItemsArray[1]);if(name.length>0&&url.length>0){engineName=engineName.replace("Search","");engineName=omgTrim(engineName);name=omgTrim(name);if(name==engineName)continue;tmpEngines+=name+"|"+url+",";}}}}omgSet_Cookie('Engines',tmpEngines,1000,'/','','');omgHandleSelect(null);}function omgAddItem(pos){onClickStr=" onclick=";if(pos==omgItemsArray.length-1)onClickStr+='"omgShowAbout()"';else onClickStr+=omgItemsArray[pos][1];nameStr=omgItemsArray[pos][0];if(omgItemsArray[pos][1].indexOf("omgSearchCustom")!=-1){nameStr+='<span onmouseover="this.style.color=\'#ff0000\'" onmouseout="this.style.color=\'#'+g_menuFontColor+'\'" onclick="omgDeleteEngine(event,\''+omgItemsArray[pos][0]+'\');">&nbsp; [x]</span>';}itemCode='<div '+onClickStr+' style="border-bottom:1px solid #808080;padding:2px;padding-left:5px;cursor:pointer;font-family: arial,helvetica,clean,sans-serif;font-size:12px;text-align:left;line-height:16px;" onmouseover="this.style.backgroundColor=\'#'+g_menuMouseoverColor+'\'" onmouseout="this.style.backgroundColor=\'#'+g_menuBKColor+'\'">'+nameStr+'</div>';TBMenuObj.innerHTML+=itemCode;if(pos<omgItemsArray.length-1){nextPos=pos
funcStr="omgAddItem("+(++pos)+")";setTimeout(funcStr,25);}else{g_menuOn=true;g_CreatingMenu=false;}}function omgLoadMenu(){omgItemsArray=new Array();omgItemsArray[0]=new Array(" Google Search ","omgSearchGoogle()");omgItemsArray[1]=new Array(" Omgili Search ","omgSearchOmgili()");omgItemsArray[2]=new Array(" Omgili Buzz Graph ","omgGraph(this)");if(typeof g_customEngines!='undefined'){for(i=0;i<g_customEngines.length;i++){engineParts=g_customEngines[i].split(",");if(engineParts.length==2){omgItemsArray.push(new Array(engineParts[0],"\"omgSearchPredefined(\'"+engineParts[1]+"\')\""));}}}omgItemsArray.push(new Array(" + Add Engine...","omgAddResource()"));strEngines=omgGet_Cookie("Engines");if(strEngines){EnginesArray=strEngines.split(",");for(i=0;i<EnginesArray.length;i++){SavedItemsArray=EnginesArray[i].split("|");if(SavedItemsArray.length==2){name=omgTrim(SavedItemsArray[0]);url=omgTrim(SavedItemsArray[1]);if(name.length>0&&url.length>0){omgItemsArray.push(new Array(" Search "+name,"\"omgSearchCustom(\'"+url+"\')\""));}}}}omgItemsArray.push(new Array(" About Searchamabob...","omgShowAbout()"));}function omgCreateMenu(x,y){if(!g_CreatingMenu&&g_menuOn==false){g_CreatingMenu=true;TBMenuObj=document.getElementById("omgTBMenu");if(TBMenuObj){omgLoadMenu();TBMenuObj.innerHTML="";TBMenuObj.style.left=x+"px";TBMenuObj.style.top=y+"px";omgToggleMenu(true);omgAddItem(0);}}}function omgDoMouseOver(obj){if(!g_overIcon){TBIconObj=document.getElementById("omgTBIcon");if(TBIconObj){TBIconObj.style.backgroundColor="#"+g_menuMouseoverColor;e=obj;var l=0;var t=0;while(e){l+=e.offsetLeft;t+=e.offsetTop;e=e.offsetParent;}omgCreateMenu(l+19,t);}}}function omgDoMouseOut(obj){TBIconObj=document.getElementById("omgTBIcon");if(TBIconObj)TBIconObj.style.backgroundColor="#"+g_menuBKColor;}function omgGet_Cookie(name){var start=document.cookie.indexOf(name+"=");var len=start+name.length+1;if((!start)&&(name!=document.cookie.substring(0,name.length))){return null;}if(start==-1)return null;var end=document.cookie.indexOf(";",len);if(end==-1)end=document.cookie.length;return unescape(document.cookie.substring(len,end));}function omgSet_Cookie(name,value,expires,path,domain,secure){var today=new Date();today.setTime(today.getTime());if(expires){expires=expires*1000*60*60*24;}var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+((expires)?";expires="+expires_date.toGMTString():"")+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+((secure)?";secure":"");}function omgChangeOpacity(obj,opc){if(opc){if(obj.style.MozOpacity!=null){obj.style.MozOpacity=1;}else obj.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3) alpha(opacity=100)";}else{if(obj.style.MozOpacity!=null){obj.style.MozOpacity=0.8;}else obj.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3) alpha(opacity=80)";}}function omgOnLoadSearchamabob(){TBIcon='<div align="center" name="omgTBIcon" id="omgTBIcon" style="visibility:hidden;width:18px;position: absolute;border: 1px solid #245EDC;z-index: 100;height: 18px;cursor:pointer;background-color: #'+g_menuBKColor+';font-size: 12px;color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;line-height:16px;" onMouseOver="omgDoMouseOver(this)" onMouseOut="omgDoMouseOut(this)"><b>i</b></div>';TBMenu='<div ID="omgTBMenu" onmouseover="omgChangeOpacity(this,1)" onmouseout="omgChangeOpacity(this,0)" name="omgTBMenu" style="visibility:hidden;position:absolute;z-index: 100;font-weight:bold;color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;font-size: smaller;width:200px;background-color:#'+g_menuBKColor+';border:1px solid #'+g_menuBorderColor+';"></div>';Obj=document.createElement("SPAN");Obj.setAttribute("id","omgSearchamabobID");Obj.setAttribute("name","omgSearchamabobID");Obj.innerHTML=TBIcon+TBMenu;document.body.appendChild(Obj);TBMenuObj=document.getElementById("omgTBMenu");if(TBMenuObj.style.MozOpacity!=null){TBMenuObj.style.MozOpacity=0.8;}else TBMenuObj.style.filter="progid:DXImageTransform.Microsoft.Shadow(color=#CACACA,direction=135,strength=3) alpha(opacity=80)";if(typeof window.addEventListener!='undefined'){window.addEventListener("click",omgHandleSelect,false);window.addEventListener("mouseup",omgHandleSelect,false);}else if(typeof document.addEventListener!='undefined'){document.addEventListener("click",omgHandleSelect,false);document.addEventListener("mouseup",omgHandleSelect,false);}else if(typeof window.attachEvent!='undefined'){document.body.attachEvent("onclick",omgHandleSelect);document.body.attachEvent("ondblclick",omgHandleSelect);}}(function(){var ie=!!(window.attachEvent&&!window.opera);var wk=/webkit\/(\d+)/i.test(navigator.userAgent)&&(RegExp.$1<525);var fn=[];var run=function(){for(var i=0;i<fn.length;i++)fn[i]();};var d=document;d.ready=function(f){if(!ie&&!wk&&d.addEventListener)return d.addEventListener('DOMContentLoaded',f,false);if(fn.push(f)>1)return;if(ie)(function(){try{d.documentElement.doScroll('left');run();}catch(err){setTimeout(arguments.callee,0);}})();else if(wk)var t=setInterval(function(){if(/^(loaded|complete)$/.test(d.readyState))clearInterval(t),run();},0);};})();document.ready(function(){omgOnLoadSearchamabob()});