// == UserScript ==
// Author: omgili
// Modified by Csineneo 967
// QQ 6202551
// == /UserScript ==
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 = "ffffff";
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 = $("omgTBMenu");
  if (TBMenuObj) {
    if (show) TBMenuObj.style.visibility = "visible";
    else {
      g_menuOn = false;
      TBMenuObj.style.visibility = "hidden";
    }
  }
}
function omgToggleTBIcon(show, x, y) {
  TBIconObj = $("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) {
  $('omgTBIcon').innerHTML = '<b>+</b>';
  //alert('1');
  //$('omgTBMessage').style.visibility = 'hidden';
  //$("DayooFloatingPaneNews").style.opacity='0';

  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;
          //omgShowTipBox(0);
        }
      }
    }
    if (document.selection.createRange().text && !no_searchamabobFlag) {
      g_selectionTxt = document.selection.createRange().text;
      omgToggleTBIcon(true, mouseX + 5, mouseY - 16);
      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;
          
        //if(/[^\u4e00-\u9fa5]/.test(g_selectionTxt)) alert("这是汉字" );
        //if(/[^\u3040-\u309F]/.test(g_selectionTxt)) alert("这是平假名" );
        //if(/[^\u30A0-\u30FF]/.test(g_selectionTxt)) alert("这是汉字" ); 
        omgToggleTBIcon(true, mouseX + 18, mouseY - 18);
        return;
      }
    }
  }
  omgToggleTBIcon(false, 0, 0);
  omgToggleMenu(false);
  GraphObj = $("omgGraphID");
  if (GraphObj && !g_Graphit) {
    document.body.removeChild(GraphObj);
  }
  g_Graphit = false;
/*   omgAboutObj = $("omgAboutID");
  if (omgAboutObj && !g_ShowedAbout) {
    document.body.removeChild(omgAboutObj);
  }
  g_ShowedAbout = false; */
}
function omgSearchGoogle(){
  var lsGURL = "http://www.baidu.com/s?ie=utf-8&tn=cnopera_dg&wd=";
  var strGoogleURL = lsGURL + encodeURI(g_selectionTxt);
  window.open(strGoogleURL);
}

function omgAbout(){
  var strAboutURL = "http://www.ribenyu.cn/space-1-do-blog-id-1611.html";
  window.open(strAboutURL);
}
//翻译
function omgTraslate(l){
	//alert(encodeURI(g_selectionTxt));
	//$("DayooFloatingPane").innerHTML='0000000000';

	omgDoShowBox('omgTBMessage');
	$("omgTBMessage").innerHTML = '<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>正在翻译 <b>"'+ g_selectionTxt +'"</b> <img src="image/dict_loading.gif" /> ';
	var post = 'post='+g_selectionTxt;
	var x = new Ajax();
	x.post('translate.php?ac=yahoo&type='+ l,post, function(s){
	if(s){
		$('omgTBMessage').innerHTML = '<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>翻译结果：<span id="omgTBMessage_tip"></span><hr  />'+s;autoSave(s);
	}else{
		//$('omgTBMessage').innerHTML = '没有翻译结果呀，可能超时，请重新试试……<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>';
		}
	});
}
function omgHiragana(l){
	omgDoShowBox('omgTBMessage');
	$("omgTBMessage").innerHTML = '<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>正在标注 <b>"'+ g_selectionTxt +'"</b> <img src="image/dict_loading.gif" />';
	var post = 'post='+g_selectionTxt;
	var x = new Ajax();
	x.post('hiragana.php?ac=ajax',post, function(s){if(s){s = s.replace(/\?/g,'');s = s.replace(/RUBY/g,'p');s = s.replace(/<RB>/g,'');s = s.replace(/<\/RB>/g,'');s = s.replace(/<RP>/g,'');s = s.replace(/<\/RP>/g,'');s = s.replace(/<RT>/g,'');s = s.replace(/<\/RT>/g,'');$('omgTBMessage').innerHTML = '标注结果：<span id="omgTBMessage_tip"></span><hr  />'+s;autoSave(s);}else{$('omgTBMessage').innerHTML = '没有标注结果呀，可能超时，请重新试试……<span id="omgTBMessage_tip"></span><strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>';}})
}
function omgDoShowBox(obj) {
	var box = $(obj);
	var menu = $('omgTBMenu');
	box.style.top = menu.style.top;
	box.style.left = menu.style.left;
	box.style.width = '200px';
	box.style.height = 'auto';
	box.style.visibility = 'visible';
	//alert(box.style.visibility + box.style.top + box.style.left);
}
function closeMessageBox(){
	var box = $('omgTBMessage');
	box.style.visibility = 'hidden';
}
//自动复制
function autoSave(meintext)
{
   if (window.clipboardData){
   window.clipboardData.setData("Text", meintext);
   }
   else if (window.netscape){
   try {       
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");       
          } catch (e) {
               //alert("你使用FF浏览器，无法自动复制！\n请在浏览器地址栏输入'about:config'并回车\n然后将 'signed.applets.codebase_principal_support'设置为'true'");
          };
   var clip = Components.classes['@mozilla.org/widget/clipboard;1'].
   createInstance(Components.interfaces.nsIClipboard);
   if (!clip) return;
   var trans = Components.classes['@mozilla.org/widget/transferable;1'].
   createInstance(Components.interfaces.nsITransferable);
   if (!trans) return;
   trans.addDataFlavor('text/unicode');
   var str = new Object();
   var len = new Object();
   var str = Components.classes["@mozilla.org/supports-string;1"].
   createInstance(Components.interfaces.nsISupportsString);
   var copytext=meintext;
   copytext = copytext.replace(/<p>/g,"");
   copytext = copytext.replace(/<\/p>/g,"\r\n")
   str.data=copytext;
   trans.setTransferData("text/unicode",str,copytext.length*2);
   var clipid=Components.interfaces.nsIClipboard;
   if (!clip) return false;
   clip.setData(trans,null,clipid.kGlobalClipboard);
   }
   $('omgTBMessage_tip').innerHTML += '（结果已自动复制）&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;">X</strong>';
   return false;
}
//添加到生词薄 
function omgAddWord()
{
	var strAboutURL = "words.php?ac=index&word="+encodeURI(g_selectionTxt);
	//alert(strAboutURL);
	window.open(strAboutURL);  
/* 	omgDoShowBox('omgTBMessage');
	$("omgTBMessage").innerHTML = '<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>正在将 <b>"'+ g_selectionTxt +'"</b> 添加到生词本&nbsp;&nbsp;&nbsp;<img src="image/dict_loading.gif" />';
	var post = 'post='+g_selectionTxt;
	//alert(post);
	var x = new Ajax();
	x.post('words.php?ac=ajax',post, function(s){if(s){$('omgTBMessage').innerHTML = '<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>提示：<span id="omgTBMessage_tip"></span>'+s;}else{$('omgTBMessage').innerHTML = '<strong onclick="closeMessageBox()" title="关闭" style="cursor:pointer;float:right;">X</strong>添加出错了，请稍后再试';}}) */
}

function omgSearchCustom(strEngine) {
  strEngine = strEngine.replace("<term>", encodeURI(g_selectionTxt));
  window.open(strEngine);
}
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.baidu.com/baidu?tn=cnopera_dg&ie=utf-8&ct=2097152&si=operachina.com&wd=" + encodeURI(searchString));
}
function omgCloseAddSearchWindow() {
  omgAddResourceObj = $("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 = $("omgResURL");
  omgNameObj = $("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.innerHTML='<center><span style="color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;font-size: 18px;"><br><b>自定义搜索引擎</b></span></center><br><table align=center cellpadding=5 style="margin-left:30px;color:#'+g_menuFontColor+';font-family: arial,helvetica,clean,sans-serif;font-size: 14px;" ><tr><td><b>搜索引擎：</b></td>\
	<td><input type=text id=omgResName name=omgResName style="width:40ex;" value="OperaChina 站内搜索"></td>\
	</tr><tr>\
	<td><b>搜索引擎 URL：</b></td>\
	<td><input type=text id=omgResURL name=omgResURL style="width:40ex;" value="http://www.baidu.com/baidu?wd=<term>&tn=cnopera_dg&ie=utf-8&ct=2097152&si=operachina.com"></td>\
	</tr>\
	<tr><td colspan=2><br><font size=-1>* &lt;term&gt; 代表搜索关键词</font></td></tr>\
	<tr>\
	<td colspan=2 align=center><br><span style="font-weight:bold;text-decoration:underline;cursor:pointer;" onclick="omgAddEngines()">添加</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-weight:bold;text-decoration:underline;cursor:pointer;" onclick="omgCloseAddSearchWindow()">关闭</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("搜索", "");
          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=";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 #C0C0C0;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(" 日译中 ", "omgTraslate('ja_zh')");
  omgItemsArray[1] = new Array(" 中译日 ", "omgTraslate('zh_ja')");
  omgItemsArray[2] = new Array(" 假名标注 ", "omgHiragana('ja_zh')");
  omgItemsArray[3] = new Array(" 添加到我的生词本 ", "omgAddWord()");
  /*omgItemsArray[4] = new Array(" 关于划词功能说明 ", "omgAbout()");
  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(" + 自定义功能...", "omgAddResource()"));*/
  omgItemsArray.push(new Array(" 关于日本语家园...", "omgAbout()"));
  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(" 搜索 " + name, "\"omgSearchCustom(\'" + url + "\')\""));
        }
      }
    }
  }
}
function omgCreateMenu(x, y) {
  if (!g_CreatingMenu && g_menuOn == false) {
    g_CreatingMenu = true;
    TBMenuObj = $("omgTBMenu");
    if (TBMenuObj) {
      omgLoadMenu();
      TBMenuObj.innerHTML = "";
      TBMenuObj.style.left = x + "px";
      TBMenuObj.style.top = y + "px";
      omgToggleMenu(true);
      omgAddItem(0);
    }
  }
}
function omgDoMouseOver(obj) {
  $(obj.id).innerHTML = '<b">X</b>';
  if (!g_overIcon) {
    TBIconObj = $("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 + 20, t);
    }
  }
}
function omgDoMouseOut(obj) {
  TBIconObj = $("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:19px;position: absolute;border: 1px solid #C0C0C0;z-index: 100;height: 20px;cursor:pointer;background-color: #' + g_menuBKColor + ';font-size: 12px;color:#' + g_menuFontColor + ';font-family: arial,helvetica,clean,sans-serif;line-height:19px;" onMouseOver="omgDoMouseOver(this)" onMouseOut="omgDoMouseOut(this)"><b>+</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:160px;background-color:#' + g_menuBKColor + ';border:1px solid #' + g_menuBorderColor + ';"></div>';
  TBMessage = '<div ID="omgTBMessage" onmouseover="omgChangeOpacity(this,1)" onmouseout="omgChangeOpacity(this,0)" name="omgTBMessage" style="visibility:hidden;position:absolute;z-index: 100;font-weight:normal;color:#' + g_menuFontColor + ';font-family: arial,helvetica,clean,sans-serif;font-size: 12px;padding:3px 5px;width:160px;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 + TBMessage;
  document.body.appendChild(Obj);
  //TBMenuObj 弹出菜单列表
  TBMenuObj = $("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() {
	//if(omgGet_Cookie("Cookie_dict")=='false')	
	omgOnLoadSearchamabob();
}
 );