<!--
// start jquery
$(document).ready(function() {
	// image rollovers
	$('.mouseover').hover(function(){
		this.src = this.src.replace('_off', '_on');
	}, function(){
		this.src = this.src.replace('_on', '_off');
	});

	//$('[class^=cp_menu_group]').hide();
/*	$('[class^=cp_menu_group]').click(function() {
		var $this = $(this);
		var x = $this.attr('id');
		$('#' + x).toggleClass('cp_menu_group_active');
		$('#' + x + '_sub').toggle('slow');
		if ($('#' + x).hasClass('cp_menu_group_active')) {
			$.cookie(x, 'active');
		} else {
			$.cookie(x, null);
		}
		return false;
	});*/
});


// @function	core_setEleValue
// @call		$().core_setEleValue($ele, $val);
// @action		change the value of a DOM element
// ------------------------------------------------------------------------- //
// $ele (str)		= any jQuery selector, selects the element
// $val (str)		= any value
// ------------------------------------------------------------------------- //
jQuery.fn.core_setEleValue = function($ele, $val) {
	$($ele).val($val);
};

// @function	core_setAttrValue
// @call		$().core_setAttrValue($ele, $attr, $val);
// @action		change the value of a DOM element's attribute
// ------------------------------------------------------------------------- //
// $ele (str)		= any jQuery selector, selects the element
// $attr (str)		= any applicable attribute name of the element
// $val (str)		= any value
// ------------------------------------------------------------------------- //
jQuery.fn.core_setAttrValue = function($ele, $attr, $val) {
	$($ele).attr($attr, $val);
};

// @function	core_setEleSubmit
// @call		$().core_setEleSubmit($ele, $val, $form);
// @action		change the value of a DOM element then submit a form
// ------------------------------------------------------------------------- //
// $ele (str)		= any jQuery selector, selects the element
// $val (str)		= any value
// $form (str)		= any jQuery selector, selects the form
// ------------------------------------------------------------------------- //
jQuery.fn.core_setEleSubmit = function($ele, $val, $form) {
	$($ele).val($val);
	$($form).submit();
};

// @function	core_setAttrSubmit
// @call		$().core_setAttrSubmit($ele, $attr, $val, $form);
// @action		change the value of a DOM element's attribute then submit a form
// ------------------------------------------------------------------------- //
// $ele (str)		= any jQuery selector, selects the element
// $attr (str)		= any applicable attribute name of the element
// $val (str)		= any value
// $form (str)		= any jQuery selector, selects the form
// ------------------------------------------------------------------------- //
jQuery.fn.core_setAttrSubmit = function($ele, $attr, $val, $form) {
	$($ele).attr($attr, $val);
	$($form).submit();
};

// @function	core_setFormSubmit
// @call		$().core_setFormSubmit($ele, $val, $attr, $attrval, $form);
// @action		change the value of a DOM element's value then change form attribute then submit form
// ------------------------------------------------------------------------- //
// $ele (str)		= any jQuery selector, selects the element
// $val (str)		= any value
// $attr (str)		= any applicable attribute name of the element
// $attrval (str)	= any value
// $form (str)		= any jQuery selector, selects the form
// ------------------------------------------------------------------------- //
jQuery.fn.core_setFormSubmit = function($ele, $val, $attr, $attrval, $form) {
	$($ele).val($val);
	$($form).attr($attr, $attrval);
	$($form).submit();
};

// @function	core_setFormSubmitConfirm
// @call		$().core_setFormSubmitConfirm($action, $item, $ele, $val, $attr, $attrval, $form);
// @action		after confirmation, change the value of a DOM element's value then change form attribute then submit form
// ------------------------------------------------------------------------- //
// $action (str)	= the action being confirmed
// $item (str)		= item the action applies to
// $ele (str)		= any jQuery selector, selects the element
// $val (str)		= any value
// $attr (str)		= any applicable attribute name of the element
// $attrval (str)	= any value
// $form (str)		= any jQuery selector, selects the form
// ------------------------------------------------------------------------- //
jQuery.fn.core_setFormSubmitConfirm = function($action, $item, $ele, $val, $attr, $attrval, $form) {
	if (confirm("Are you sure you want to " + $action + " " + $item + "?")) {
		$($ele).val($val);
		$($form).attr($attr, $attrval);
		$($form).submit();
	}
};

// @function	core_setLocation
// @call		$().core_setLocation($url);
// @action		change the page location
// ------------------------------------------------------------------------- //
// $url (str)		= any url
// ------------------------------------------------------------------------- //
jQuery.fn.core_setLocation = function($url) {
	document.location = $url;
};

// @function	core_setConfirmLocation
// @call		$().core_setConfirmLocation($url, $action, $type);
// @action		change the page location after confirmation
// ------------------------------------------------------------------------- //
// $url (str)		= the url you want to go to after confirmation
// $action (str)	= the action being confirmed
// $type (str)		= the type of item the action applies to
// ------------------------------------------------------------------------- //
jQuery.fn.core_setConfirmLocation = function($url, $action, $type) {
	if (confirm("Are you sure you want to " + $action + " this " + $type + "?")) {
		document.location = $url;
	}
};

// @function	core_checkBoxes
// @call		$().core_checkBoxes($name);
// @action		check an array of checkboxes
// ------------------------------------------------------------------------- //
// $name (str)		= any jQuery selector, selects the checkbox group's name array
// ------------------------------------------------------------------------- //
jQuery.fn.core_checkBoxes = function($name) {
	$('input[name^="' + $name + '"]:checkbox').attr('checked', 'checked');
};

// @function	core_uncheckBoxes
// @call		$().core_uncheckBoxes($name);
// @action		uncheck an array of checkboxes
// ------------------------------------------------------------------------- //
// $name (str)		= any jQuery selector, selects the checkbox group's name array
// ------------------------------------------------------------------------- //
jQuery.fn.core_uncheckBoxes = function($name) {
	$('input[name^="' + $name + '"]:checkbox').removeAttr('checked');
};

// @function	core_showItem
// @call		$().core_showItem($grp, $name, $item);
// @action		hide items in group and show called item
// ------------------------------------------------------------------------- //
// $grp (str)		= div container group name, selects the group
// $name (str)		= any jQuery selector, selects the item
// $item (str)		= any jQuery selector, selects the item
// ------------------------------------------------------------------------- //
jQuery.fn.core_showItem = function($grp, $name, $item) {
	$('div[name^="' + $grp + '"]').hide();
	$('span[id^="item_"]').removeClass('item_active');
	$($item).addClass('item_active');
	$($name).show();
};

// core_removeEleConf
// remove an element from the DOM after confirmation
// ------------------------------------------------------------------------- //
// $ele (str)			= any jQuery selector
// ------------------------------------------------------------------------- //
jQuery.fn.core_removeEleConf = function($ele) {
	if (confirm("Are you sure you want to remove this item?")) {
		$($ele).remove();
	}
};

// core_toggleMenuGroup
// get DOM element and change attribute value
// ------------------------------------------------------------------------- //
// $ele (str)			= any jQuery selector
// $attr (str)			= any HTML attribute name
// $val (str)			= any value
// ------------------------------------------------------------------------- //
jQuery.fn.core_toggleMenuGroup = function($id) {
	$('#cp_menu_group' + $id).toggleClass('cp_menu_group_active');
	$('#cp_menu_group' + $id + '_sub').toggle('slide',0,500);
};
//-->
