// ----------------------------------------------------------------------------
// DOM READY
// ----------------------------------------------------------------------------

$(document).ready(function() {

	// BIND EVENTS FOR CLICKABLE ITEMS
	$('.clickable').bind('click', function() {
		var url = $(this).find('a[href]:first').attr('href');
		var target = $(this).find('a[href]:first').attr('target');
		if(url) {
			if($.data(document, 'notclickable') == false) {
				if(target == '_blank') {
					window.open(url);
				} else {
					window.location.href = url;
				}
			}
		}
	});

	// SET VARIABLE FOR NOT CLICKABLE ITEMS
	$('.clickable .notclickable').bind('mouseenter', function() {
		$.data(document, 'notclickable', true);
	}).bind('mouseleave', function() {
		$.data(document, 'notclickable', false);
	});
	$.data(document, 'notclickable', false);

	// BIND EVENTS FOR HOVERABLE ITEMS
	$('.hoverable').bind('mouseenter mouseleave', function() {
		$(this).toggleClass('hover');
	});

	// BIND EVENTS FOR FORMS
	$('.formline, .formarea, .formselect').bind('focus blur', function() {
		$(this).toggleClass('focus');
	});
	$('.formbut').bind('mouseenter mouseleave', function() {
		$(this).toggleClass('hover');
	});


	// ------------------------------------------------------------------------
	// LOAD EXTERNAL SCRIPTS / PLUGINS
	// ------------------------------------------------------------------------

	$.getScript(jquery_coreurl+'/include/jquery/easing.latest.js', function() {

		// EASING LOADED

	});


	// ------------------------------------------------------------------------
	// ONLOAD / LOAD COMPLETE
	// ------------------------------------------------------------------------

	$(window).load(function() {

		// PAGE LOADED

	});

});


// ----------------------------------------------------------------------------
// CUSTOM FUNCTIONS | CALLED BEFORE DOM READY FROM INSIDE TEMPLATE
// ----------------------------------------------------------------------------

/*function jquery_include_submenu() {

	// REMOVE EMPTY SUBMENU
	$('#tpl_submenu ul:empty').each(function() {
		$('#tpl_submenu').remove();
		$('#tpl_content').attr('id', 'tpl_content_wide');
	});

}*/
