﻿var sfoc = false;

window.onload = function() {
    document.getElementById("mwform").onkeydown = function() {
        if(event.keyCode==13) { if(sfoc == true){document.getElementById('MW_Header_ibtn').click();} return false;}
    }
} 

//IE 6 Menu
mwHover = function() {     
    var mwME = document.getElementById("MWMenu").getElementsByTagName("li");     
    for (var i=0; i<mwME.length; i++) {         
        mwME[i].onmouseover=function() {this.className+=" over";}         
        mwME[i].onmouseout=function() {this.className=this.className.replace(new RegExp(" over\\b"), "");}     
    } 
} 

if(window.attachEvent) window.attachEvent("onload", mwHover);

function mSelect(n) {
    if(n == "videos" || n == "news") {
        n = "more"
    }
    document.getElementById(n).className = "select"
}

function checkSearch() {
    var b = document.getElementById("MW_Header_isearch")
    if(b.value == "" || b.value == "Ask Me Anything...") return false
    else return true;
}

function focSBox() {
    var b = document.getElementById("MW_Header_isearch")
    sfoc = true;
    if(b.value == "Ask Me Anything...") {
        b.className = "isearch"
        b.value = ""
    }
}

function efocSBox() {
    var b = document.getElementById("MW_Header_isearch")
    sfoc = false;
    
    try{b.onkeypress = null;}catch(e){}
    
    if(b.value == "") {
        b.className = "isearch_empty"
        b.value = "Ask Me Anything..."
    }
}

function opener(url, target) {
    if(target == "buyit") window.open(url,'buyit');
    else window.location.href = url;
}

function ra(str,from,to) {var idx = str.indexOf(from); var dup = 0; while ( idx > -1 ) {if(dup+1 == idx) {str = str.replace(from,"");}else{str = str.replace(from,to);}dup = idx;idx = str.indexOf(from);}return str;}

function doIAd(l,u,w,h){
    document.write("<div align=\"center\" style=\"text-align:center;padding:5px;\"><table callpadding=\"0\" cellspacing=\"0\" align=\"center\"><tr><td style=\"border:solid 1px #c1c1c1;\">");
    document.write("<a target=\"_blank\" href=\"" + l + "\">");
    document.write("<img src=\"" + u + "\" border=\"0\" width=\""+w+"\" height=\""+h+"\" />")
    document.write("</a></td></tr><tr><td><div style=\"float:right;font-size:8pt;color:gray;\">Advertisement</div></td></tr></table>");
    document.write("</div>");
}

function doFAd(id,u,w,h,v){

    var mp_swver = 0;
    var mp_pos = 0;
    var mp_html = "";
    if( navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin ) {
      if( navigator.plugins && navigator.plugins["Shockwave Flash"] ) {
        mp_pos = navigator.plugins["Shockwave Flash"].description.indexOf("Shockwave Flash");
        mp_swver = navigator.plugins["Shockwave Flash"].description.substr(mp_pos+16,1);
      }
    } else if ( navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && ( navigator.userAgent.indexOf("Windows") >= 0 ) ) {
      document.write("<SCR"+"IPT LANGUAGE=VBScript>\n");
      document.write("on error resume next\n");
      document.write("For mp_i=11 To 6 Step -1\n");
      document.write("If Not IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & mp_i)) Then\n");
      document.write("Else\n");
      document.write("  mp_swver=mp_i\n");
      document.write("  Exit For\n");
      document.write("End If\n");
      document.write("Next\n");
      document.write("</SCR"+"IPT> \n");
    }
    

    document.write("<div align=\"center\" style=\"text-align:center;padding:5px;\"><table align=\"center\"><tr><td>");
    
    if( mp_swver >= 6 ) {
      mp_html =  "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"\" id=\""+id+"\" name=\""+id+"\" width=\""+w+"\" height=\""+h+"\">";
      
      if( mp_swver > 5 ) {
        mp_html += "<param name=\"FlashVars\" value=\""+v+"\">";
        mp_html += "<param name=\"movie\" value=\""+u+"\">";
      } else {
        mp_html += "<param name=\"movie\" value=\""+u+"?"+v+"\">";
      }
      
      mp_html += "<param name=\"wmode\" value=\"opaque\">";
      
      if( mp_swver > 5 ) {
        mp_html += "<embed wmode=\"opaque\" name=\""+id+"\" src=\""+u+"\" FlashVars=\""+v+"\"";
      } else {
        mp_html += "<embed wmode=\"opaque\" name=\""+id+"\" src=\""+u+"?"+v+"\"";
      }
      
      mp_html += " swLiveConnect=\"FALSE\" width=\""+w+"\" height=\""+h+"\" type=\"application/x-shockwave-flash\" pluginspage=\"\">";
      mp_html += "</embed>";
      mp_html += "</object>";
      
      if( window.DocumentWrite) DocumentWrite(mp_html);
      else document.write(mp_html);
        
    } else if(!(navigator.appName && navigator.appName.indexOf("Netscape") >= 0 && navigator.appVersion.indexOf("2.") >= 0)) {}

    document.write("</td></tr><tr><td><div style=\"float:right;font-size:8pt;color:gray;\">Advertisement</div></td></tr></table>");
    document.write("</div>");
}


