// JavaScript Document
// Created by Raster Media
// www.rastermedia.com

function confirm_action ( message, action ) {
  input_box = confirm ( message );
  if ( input_box == true ) {
    window.location.href = action;
  }
 }

function new_window(url,wx,hx) {
    newwin = window.open(url,"win",'toolbar=0,location=0,directories=0,scrollbars=1,resizable=1,status=1,menubar=1,width='+wx+',height='+hx);
    newwin.focus();
}

// jump menu--------------------------------------------------
function jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=selObj.selectedIndex;
}

function getEditorValue( instanceName )
{
  // Get the editor instance that we want to interact with.
  var oEditor = FCKeditorAPI.GetInstance( instanceName ) ;

  // Get the editor contents as XHTML.
  return oEditor.GetXHTML( true ) ;  // "true" means you want it formatted.
}

function hide_all_divs()
{
  z = document.getElementsByWhatever('pop_up', 0);
  for(i=0; i<z.length; i++)
  {
    z[i].style.visibility='hidden';
  }
}


document.getElementsByWhatever = function(whatever,includeTextNodes) {
	if(!document.getElementsByTagName("*")) {
		// safari has no idea what that asterix means - return an array who's first index is -1
		// so the calling function will know that the browser cant handle this
		return new Array(-1);
	}
	// change "whatever" to lowercase if its not an int.
	if(!parseInt(whatever))whatever = whatever.toLowerCase();
	// this array will contain all of the object references.
	objArray = new Array();
	// loop over the document
	for(_i=0;_i<document.getElementsByTagName("*").length;_i++) {
		// this variable set to 1 when an object is added to objArray so we
		// dont double/triple up on object references if they meet more than one condition
		inArray = 0;
		// assign this object to a reference variable
		obj = document.getElementsByTagName("*")[_i];
		// check attributes and values for "whatever"
		if(obj.tagName != "!") { // IE freaks out over HTML comments - dont check for attributes if that's what this tag is.
			for(_w=0;_w<obj.attributes.length;_w++) {
				// IE will list all attributes, regardless of if they defined in the HTML, so check that they are defined.
				if(obj.attributes[_w].value) {
					// if the objects attribute name or its value equal "whatever", add it to objArray
					if(obj.attributes[_w].name.toLowerCase() == whatever || obj.attributes[_w].value.toLowerCase() == whatever) {
						objArray[objArray.length] = obj;
						inArray=1;
						break;
					}
				}
			}
		}
		// check tag names for "whatever"
		if(obj.tagName.toLowerCase() == whatever && !inArray) {
				objArray[objArray.length]=obj;
				inArray=1;
		}
		// check text nodes for "whatever".
		if(obj.childNodes.length && !inArray && includeTextNodes) {
			for(_w=0;_w<obj.childNodes.length;_w++) {
				if(obj.childNodes[_w].nodeType == 3 && obj.childNodes[_w].data) {
					cData = obj.childNodes[_w].data.toLowerCase();
					if(cData.indexOf(whatever)>-1) {
						objArray[objArray.length] = obj;
						inArray=1;
						break;
					}
				}
			}
		}
	}
	// send the object reference array back to the caller
	return objArray;
}