/***************************************************************************
 Jupiter Portal @ Jupiterportal.com
 Copyright (C) 2006 Cosmin Flavius (highstrike@gmail.com)

 Attribution-NonCommercial-ShareAlike 2.5 of Creative Commons
 (http://creativecommons.org)

 You are free:

    * to copy, distribute, display, and perform the work
    * to make derivative works

 Under the following conditions:

 Attribution - You must attribute the work in the manner specified
 by the author or licensor.

 Noncommercial - You may not use this work for commercial purposes.

 Share Alike - If you alter, transform, or build upon this work, you may
 distribute the resulting work only under a license identical to this one.

    * For any reuse or distribution, you must make
	  clear to others the license terms of this work.
    * Any of these conditions can be waived if you get
      permission from the copyright holder.

 Your fair use and other rights are in no way affected by the above.

 This is a human-readable summary of the Legal Code (the full license).
 (http://creativecommons.org/licenses/by-nc-sa/2.5/legalcode)

****************************************************************************/

////////////////////////////////////////////////////////
// Function:         update_preview
// Description: updates the preview in emoticons.php

function update_preview(image,field)
{
	document.getElementById(image).src = "images/emoticons/" + field;
}

////////////////////////////////////////////////////////
// Function:         select_box
// Description: selects/unselects all check box's

function select_box(form, select, check)
{
    var selectObject = document.forms[form].elements[select];
    var selectCount  = selectObject.length;

    for (var i = 0; i < selectCount; i++) {
        selectObject.options[i].selected = check;
    }

    return true;
}
/**
* (un)checks all items in a permission group
* @param DOMobject obj : The checkbox at the top of the group
* @return void
*/
function ug_checkem(obj)
{
	// whether or not to check all the permissions in the group
	var checkem = obj.checked;
					
	// init vars
	var objs, len, id = obj.id;
					
	// if the div exists
	if( (obj = document.getElementById("div_"+ id)) )
	{
		// fetch all inputs from the div, and set len to the number of checkbxoes
		len = (objs = obj.getElementsByTagName("input")).length;
						
		// for all the checkboxes
		for( var i=0; i<len; i++ )
		{
			// check or uncheck
			objs[i].checked = checkem;
		}
	}
}
