<!--
//this popup function is used for the gallery
function popUp(address,W,H,Name) {
eval("page" + Name + " = window.open(address, '" + Name + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+W+',height='+H+',left = 100,top = 100');");
eval("page" + Name + ".focus();");
}

function copyToClipboard(cval) {
	if (window.clipboardData) {
		clipboardData.setData('Text', cval);
		alert('copied to clipboard:\n' + cval);
	}
}

function copyToClipboardButton(cval) {
	if (window.clipboardData) {
		document.write('<strong><a href="javascript:copyToClipboard(\'' + cval + '\');"><img src="/administrator/elements/images/copy_to_clipboard.gif" alt="Copy to Clipboard" border="0" /></a></strong>');
	}
}

function MM_checkBrowser() {
	var version = '';
	var userAgentStr = navigator.userAgent;

	if (userAgentStr.indexOf('Netscape') != -1) {
		//alert('Nestscape')
		version = 'Netscape';
	} else if (userAgentStr.indexOf('MSIE') != -1) {
		version = 'MSIE';
	} 
  	return version;
}

function isIE() {
	var userAgentStr = navigator.userAgent;
	if (userAgentStr.indexOf('MSIE') != -1)
		return true;
	else 
		return false;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  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<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// PopUp Script
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function dumpProps(obj, parent) {
   // Go through all the properties of the passed-in object
   for (var i in obj) {
	  // if a parent (2nd parameter) was passed in, then use that to
	  // build the message. Message includes i (the object's property name)
	  // then the object's property value on a new line
	  if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
	  // Display the message. If the user clicks "OK", then continue. If they
	  // click "CANCEL" then quit this level of recursion
	  if (!confirm(msg)) { return; }
	  // If this property (i) is an object, then recursively process the object
	  if (typeof obj[i] == "object") {
		 if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
	  }
   }
}	

/*
	FUNCTION: listProps() 
	DESCRIPTION: Helpful when degugging javascript.  Displays an alert containing a
				 list of all the properties of an object.
	PARAMETERS: 
		obj
			TYPE: Object. 
			DESCRIPTION: Object whose properties to display.
*/

function listProps(obj) {
   // Go through all the properties of the passed-in object
   var msg = '';
   var j = 0;
   for (var i in obj) {
		if (typeof obj[i] != 'object'){
			msg = msg + i + ' = ' + obj[i];
			if (++j % 3 == 0){
				//msg = msg + "<br />";
				msg = msg + "\n";
			} else {
				msg = msg + ",  ";
			}
		}
	}
	alert(msg);
	//document.write(msg);
}

function submitDoc(formName) { 
  var obj;
	if (obj=findObj(formName)!=null) 
		findObj(formName).submit();
	else 
		alert('The form you are attempting to submit called ' + formName + ' couldn\'t be found. Please make sure the submitDoc function has the correct id and name.');
}

/*
	FUNCTION: findObj() 
	DESCRIPTION: Browser-independent location, within the DOM, of a supplied object. 
				 Returns the object, if found.
	PARAMETERS: 
		n
			TYPE: String. 
			DESCRIPTION: Object whose property will supply the new value.
		d
			TYPE: String
			DESCRIPTION: Name of document within which to locate the object.

*/

function findObj(n, d) { 
	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<d.forms.length;i++) 
		x=d.forms[n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=findObj(n,d.layers.document);
	if(!x && d.getElementById) 
		x=d.getElementById(n); 
	return x;
}

/*
	FUNCTION: swapProp() 
	DESCRIPTION: Changes the value of a property of one object to 
				 the value of a property of a second object.  
	PARAMETERS: 
		sourceObjId
			TYPE: Object. 
			DESCRIPTION: Object whose property will supply the new value.
		sourcePropName
			TYPE: String
			DESCRIPTION: Name of property that will supply the new value.
		targetObjId
			TYPE: Object. 
			DESCRIPTION: Object whose property's value will be changed.
		targetPropName
			TYPE: String
			DESCRIPTION: Name of property whose value will be changed.		
*/

function swapProp(targetObjId,targetPropName,sourceObjId,sourcePropName){
	targetObj = findObj(targetObjId);
	sourceObj = findObj(sourceObjId);
	targetObj.setAttribute(targetPropName,sourceObj.value);
	return;
}

/*
	FUNCTION: setProp() 
	DESCRIPTION: Sets the property of an object to a supplied value.  
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose visibility property to toggle.
		propName
			TYPE: String
			DESCRIPTION: Name of property whose value will be set.
		newValue
			TYPE: String.
			DESCRIPTION: New value to set propName to.

*/

function setProp(objId,propName,newValue){
	targetObj = findObj(objId);
	targetObj.setAttribute(propName,newValue);
}

/*
	FUNCTION: toggleVisibility() 
	DESCRIPTION: Changes the visibility property of an object to hidden if it is visible,
				 and vice versa.  
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose visibility property to toggle.
*/

function toggleVisibility (objId) {
	var targetObj = document.getElementById(objId);
	if (targetObj.style.visibility == 'visible')
		targetObj.style.visibility = 'hidden';
	else 
		targetObj.style.visibility = 'visible';
}

/*
	FUNCTION: visibleOff() 
	DESCRIPTION: Changes the visibility property of an object to hidden.  
				 Effectively, it hides the visible object.  I use this mostly to 
				 show select drop downs because, in IE (or is it Firefox?), 
				 a select does not automatically inherit the display setting of it's container.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose visibility property to change.
*/

function visibleOff (objId) {
	var targetObj = document.getElementById(objId);
	targetObj.style.visibility = 'hidden';
}

/*
	FUNCTION: visibleOn() 
	DESCRIPTION: Changes the visibility property of an object to visible.  
				 Effectively, it shows the hidden object.  I use this mostly to 
				 hide select drop downs because, in IE (or is it Firefox?), 
				 a select does not automatically inherit the display setting of it's container.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose visibility property to change.
*/

function visibleOn (objId) {
	var targetObj = document.getElementById(objId);
	targetObj.style.visibility = 'visible';
}

/*
	FUNCTION: toggleDisplay() 
	DESCRIPTION: Toggles the display property of an object back and forth between none 
				 and either inline or table-row-group, depending on if the client browser 
				 is IE or not.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose display property to toggle.
*/

function toggleDisplay (objId) {
	
	var targetObj = document.getElementById(objId);
	var browserIsIE = isIE();
	if (browserIsIE){
		if (targetObj.style.display == 'inline'){
			targetObj.style.display = 'none';
		} else { 
			targetObj.style.display = 'inline';
		}
	} else {
		if (targetObj.style.display == 'none')
			targetObj.style.display = 'table-row-group';	
		else 
			targetObj.style.display = 'none';	
	}
}

/*
	FUNCTION: displayOff() 
	DESCRIPTION: Changes the display property of an object to none.  Effectively, 
				 it hides the object.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose display property to change.
*/

function displayOff (objId) {
	var targetObj = document.getElementById(objId);
	targetObj.style.display = 'none';
}

/*
	FUNCTION: displayOn() 
	DESCRIPTION: Changes the display property of an object to inline or table-row-group,
				 depending on if the client browser is IE or not.  Effectively, it shows
				 the hidden object.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose display property to change.
*/

function displayOn (objId) {
	
	var targetObj = document.getElementById(objId);
	var browserIsIE = isIE();

	if (browserIsIE){
		targetObj.style.display = 'inline';
	} else {
		targetObj.style.display = 'table-row-group';	
	}
}

/*
	FUNCTION: isDisplayed() 
	DESCRIPTION: Checks to see if an object's display property is NOT set to none.
				 Returns a Boolean value: true if the object's display property is NOT none,
				 false if it is none.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object to be checked.
*/

function isDisplayed (objId) {
	var targetObj = document.getElementById(objId);
	if (targetObj.style.display == 'none')
		return false;
	else 
		return true;
}

/*
	FUNCTION: isVisible() 
	DESCRIPTION: Checks to see if an object is visible.  
				 Returns a Boolean value: true if the object is visible, false if hidden.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object to be checked.
*/

function isVisible (objId) {
	var targetObj = document.getElementById(objId);
	if (targetObj.style.visibility == 'hidden')
		return false;
	else 
		return true;
}

/*
	FUNCTION: listReplace() 
	DESCRIPTION: Searches a list for an item and, if found, replaces it 
				 with a new value.  Returns a string containing the list.
	PARAMETERS: 
		list
			TYPE: String. 
			DESCRIPTION: List to be searched.
		oldItem
			TYPE: String. 
			DESCRIPTION: Item to search for within list.
		newItem	
			TYPE: String. 
			DESCRIPTION: Item to replace oldItem with if oldItem is found in list.
		delimStr
			TYPE: String. 
			DESCRIPTION: List delimiter. 
*/

function listReplace(list,oldItem,newItem,delimStr){
	var searchPattern = '[' + oldItem + '][' + delimStr + ']';
	var reg = new RegExp(searchPattern,'gi');
	if (list.match(reg)){
		newList = list.replace(reg, newItem);	
	} 
	return(list);
}

/*
	FUNCTION: listFind() 
	DESCRIPTION: Searches a list for a list item using a supplied delimiter.
				 Returns a Boolean value: true if a match is found, false if not.
	PARAMETERS: 
		list
			TYPE: String. 
			DESCRIPTION: List to be searched.
		listItem
			TYPE: String. 
			DESCRIPTION: List item to be searched for.
		delimStr	
			TYPE: String. 
			DESCRIPTION: List delimiter.
*/

function listFind(list,listItem,delimStr){
	var searchPattern = '[' + listItem + '][' + delimStr + ']';
	var reg = new RegExp(searchPattern,'gi');
	return (list.match(reg));
}

/*
	FUNCTION: newLocation() 
	DESCRIPTION: Reloads the browser with a new location.
				 I use this mostly to get the window to scroll the 
				 loaded document using named anchors.
	PARAMETERS: 
		loc
			TYPE: String. 
			DESCRIPTION: New location.
*/

function  newLocation(loc){
	window.location = loc;	
}

/*
	FUNCTION: checkProp() 
	DESCRIPTION: Compares the value of a property of an object to another value.
				 Returns a Boolean value: true if a match is found, false if not.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose property will be tested.
		propName
			TYPE: String. 
			DESCRIPTION: Name of property (belonging to objId) to test.
		propVal	
			TYPE: String. 
			DESCRIPTION: Value to which to compare prop to.
		delimStr
			TYPE: String. 
			DESCRIPTION: List delimiter, if the value of prop is in list. 
*/

function checkProp(objId,propName,propVal,delimStr){
	var targetObj = findObj(objId);
	//alert('propVal = ' + propVal);
	if (listFind(targetObj.getAttribute(propName),propVal,delimStr))
		return true;
	else 
		return false;
}

/*
	FUNCTION: toggleProp() 
	DESCRIPTION: Compares the value of a property of an object with a second value.
				 If the two values are equal, the value of the property is set to a third,
				 supplied value. Does not return a value.
	PARAMETERS: 
		objId
			TYPE: String. 
			DESCRIPTION: Id of object whose property will be tested.
		propName
			TYPE: String. 
			DESCRIPTION: Name of property (belonging to objId) to test.
		propVal1	
			TYPE: String. 
			DESCRIPTION: Value to which to compare the value of propName.
		propVal2
			TYPE: String. 
			DESCRIPTION: Value to which propName is set if propName's 
			original value matched propVal1. 
*/

function toggleProp(objId,propName,propVal1,propVal2){		
	var targetObj = findObj(objId);
	if (targetObj.getAttribute(propName).indexOf(propVal2)>=0){
		setProp(objId,propName,propVal1);
	} else {
		setProp(objId,propName,propVal2);
	} 
}

/*

// BUGGY - when rewriting the inline style of an object, there is no guarantee the DOM
   will translate the string representing the new style to the appropriate properties 
   and values within the DOM.
   
function toggleStyle(objId,propName,propVal1,propVal2){		
	
	//alert('propVal1 = ' + propVal1);
	//alert('propVal2 = ' + propVal2);
	//alert('forcePropVal = ' + forcePropVal);
	
	var delimStr = ';';
	var targetObj = findObj(objId);
	var styleStr = 	targetObj.style.cssText;
	
	//alert('styleStr = ' + styleStr);
	
	var searchPattern1 = '[' + delimStr + '| ]';
	var reg1 = new RegExp(searchPattern1,'g');
	
	//alert('reg1 = ' +  reg1);
	//alert(' = ' +  );
	
	propVal1 = propVal1.replace(/[ ]/g,'');
	var propVal1searchPattern = '(' + propName + ')' + '[ ]*[:][ ]*' + '(' + propVal1 + ')[;]?' ;
	var propVal1Reg = new RegExp(propVal1searchPattern,'i');

	//alert('propVal1 = ' + propVal1);
	//alert('propVal1Reg = ' + propVal1Reg);

	propVal2 = propVal2.replace(/[ ]/g,'');
	var propVal2searchPattern = '(' + propName + ')' + '[ ]*[:][ ]*' + '(' + propVal2 + ')[;]?' ;
	var propVal2Reg = new RegExp(propVal2searchPattern,'i');

	//alert('propVal2 = ' + propVal2);
	//alert('propVal2Reg = ' + propVal2Reg);
	
	var propVal1Found = styleStr.match(propVal1Reg);
	var propVal2Found = styleStr.match(propVal2Reg);
	
	//alert('propVal1Found = ' + propVal1Found);
	//alert('propVal2Found = ' + propVal2Found);
	
	//alert('forcePropVal = ' + forcePropVal);
	if (propVal1Found){
		//alert(styleStr + '::::' + propVal1searchPattern);
		targetObj.style.cssText = styleStr.replace(propVal1Reg, propName + ':' + propVal2 + ';');	
		//alert('targetObj.style.cssText = ' + targetObj.style.cssText);	
	} else if (propVal2Found){
		//alert(styleStr + '::::' + propVal1searchPattern);
		targetObj.style.cssText = styleStr.replace(propVal2Reg, propName + ':' + propVal1 + ';');	
		//alert('targetObj.style.cssText = ' + targetObj.style.cssText);	
	} else {
			
	}
	//alert('styleStr = ' + styleStr);
	return targetObj.style.cssText = styleStr;	
}
*/
//-->



