function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } function find_object(n, d) { //v3.0 // H O O K: Updated for IE and Mozilla var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p); } if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i < // /_/ \_\\__//_/ \_\/_/\_\ // //--------------------------------------------------------------------------------------------------------- // The following script (as commonly seen in other AJAX javascripts) is used to detect which browser the client is using. // If the browser is Internet Explorer we make the object with ActiveX. // (note that ActiveX must be enabled for it to work in IE) //function makeObject() { // var x; // var browser = navigator.appName; // // if ( browser == "Microsoft Internet Explorer" ) { // x = new ActiveXObject("Microsoft.XMLHTTP"); // } else { // x = new XMLHttpRequest(); // } // // return x; //} function makeObject() { var httpRequest; if (window.XMLHttpRequest) { // Mozilla, Safari, ... httpRequest = new XMLHttpRequest(); if (httpRequest.overrideMimeType) { httpRequest.overrideMimeType('text/xml'); // Or else you get 'object required' error in IE and it doesn't work } } else if (window.ActiveXObject) { // IE try { // httpRequest = new ActiveXObject("Msxml2.XMLHTTP"); httpRequest = new ActiveXObject("MicrosoftXMLDOM"); } catch (e) { try { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } return httpRequest; } // The javascript variable 'request' now holds our request object. // Without this, there's no need to continue reading because it won't work ;) var request = makeObject(); function ajaxDo(qryString, boxid) { //alert(qryString+', '+boxid); rezBox = boxid; // Make global so parseInfo can get it // The function open() is used to open a connection. Parameters are 'method' and 'url'. For this tutorial we use GET. request.open('get', qryString); // This tells the script to call parseInfo() when the ready state is changed request.onreadystatechange = parseInfo; // This sends whatever we need to send. Unless you're using POST as method, the parameter is to remain empty. request.send(''); } function parseInfo() { // Loading if ( request.readyState == 1 ) { document.getElementById(rezBox).innerHTML = 'Loading...'; } // Finished if ( request.readyState == 4 ) { var answer = request.responseText; document.getElementById(rezBox).innerHTML = answer; } } //--------------------------------------------------------------------------------------------------- // _____ _ _ _ // / ____| | | | | | | // | | __ ___ _ __ ___ _ __ __ _ | | | | | | ___ ___ // | | |_ | / _ \| '_ \ / _ \| '__|/ _` || | | | | |/ __| / _ \ // | |__| || __/| | | || __/| | | (_| || | | |__| |\__ \| __/ // \_____| \___||_| |_| \___||_| \__,_||_| \____/ |___/ \___| // //--------------------------------------------------------------------------------------------------- // Flips single element on/off based on current state // Accepts: ID of target element, whether to use visibility or display style (optional, 'display' by default) function toggleid(targetid, fliphow) { if ( fliphow == "visibility" ) { var isnow = document.getElementById(targetid).style.visibility; if ( isnow == 'visible' ) { document.getElementById(targetid).style.visibility='hidden'; return true; } else { document.getElementById(targetid).style.visibility='visible'; return true; } } else { var isnow = document.getElementById(targetid).style.display; if ( isnow == 'block' ) { document.getElementById(targetid).style.display='none'; return true; } else { document.getElementById(targetid).style.display='block'; return true; } } } // End toggleid() function // For places that call for a bit more exacting control vs. toggleid function hideid(thingid) { document.getElementById(thingid).style.display = 'none'; } function showit(thingid) { document.getElementById(thingid).style.display = 'block'; } function showid(thingid) { document.getElementById(thingid).style.display = 'block'; } // Especially handy for flipping bg color of table rows onmouseover, turning one tab on and others off onclick, etc. function setClass(thingid, new_classname) { document.getElementById(thingid).className = new_classname; } // Checks/unchecks a form checkbox field // Optional: Pass true/false as second checkuncheck arg function toggle_checkbox(targetid, checkuncheck) { if ( checkuncheck == "check" ) { // Set: CHECK document.getElementById(targetid).checked = true; return true; } else if ( checkuncheck == "uncheck" ) { // Set: UNCHECK document.getElementById(targetid).checked = false; return true; } else { // TOGGLE: Set to opposite of whatever it is now var isnow = document.getElementById(targetid).checked; if ( isnow == true ) { document.getElementById(targetid).checked = false; return true; } else { document.getElementById(targetid).checked = true; return true; } } } // Use for "other (specify)" options in drop-downs and such function ifShow(fieldid, chkvalue, boxid) { if ( $(fieldid).value == chkvalue ) { showid(boxid); } else { hideid(boxid); } } // Used originally for "if box is checked fadein else fadeout" in add/edit admin user > plugin features function ifChecked_setClass(fieldid, boxid, onclass, offclass) { var isnow = $(fieldid).checked; if ( isnow == true ) { setClass(boxid, onclass); } else { setClass(boxid, offclass); } } // Loops through radio button group and returns value of checked radio // Use: When you want to pass the radio value via js when changed but can't // use onchange b/c you're allowing them to click the text next to the radio as well as the radio itself function radiovalue(formname, radiogroup) { var max = eval('document.'+formname+'.'+radiogroup+'.length'); // Faster defined up here...doesn't have to recaculate every loop iteration for ( i=0; i < max; i++ ) { if ( eval('document.'+formname+'.'+radiogroup+'[i].checked') == true ) { return eval('document.'+formname+'.'+radiogroup+'[i].value'); } } } //--------------------------------------------- // Shortcut for document.getElementById :) //--------------------------------------------- function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; if (typeof element == 'string') element = document.getElementById(element); if (arguments.length == 1) return element; elements.push(element); } return elements; } // Workaround for IE's infinite z-index issue // Hide all dropdown boxes // OPTIONAL: Pass an ids to exclude function hide_dropdowns(exclude) { dropdowns = document.getElementsByTagName("select"); if ( exclude != "" ) { // Test for excluded id for ( i = 0; i < dropdowns.length; i++ ) { if ( dropdowns[i].id != exclude ) { dropdowns[i].style.display = 'none'; } } } else { // Hide all dropdowns, don't check for exception for ( i = 0; i < dropdowns.length; i++ ) { dropdowns[i].style.display = 'none'; } } } // Show all dropdown boxes function show_dropdowns() { dropdowns = document.getElementsByTagName("select"); for ( i = 0; i < dropdowns.length; i++ ) { dropdowns[i].style.display = 'inline'; } } /* Written by Jonathan Snook, http://www.snook.ca/jonathan Add-ons by Robert Nyman, http://www.robertnyman.com */ function getElementsByClassName(oElm, strTagName, oClassNames){ var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); var arrRegExpClassNames = new Array(); if(typeof oClassNames == "object"){ for(var i=0; i