/**
 * Nucleo (X)HTML/CSS Framework
 *
 * Supporting scripts for makeup
 *
 * Don't make any changes in this file!
 *
 * @copyright       Copyright (c) 2008, Sergey Gogolev
 * @link            http://css.softprojects.ru/
 * @license    		CC-A-SA 3.0 (http://creativecommons.org/licenses/by-sa/3.0/)
 * @version         0.1.2
 */

jQuery(document).ready(function () {
  	setOpacity();
	setToggleInputs ();
});

/**
 * Set opacity style for elements, which have style like 'opacity-15'
 * 
 * @return bool
 */

function setOpacity () {
	
	jQuery("[class*='opacity']").each(function (i) {
		var opacityValue = this.className.substr(this.className.indexOf('opacity-') + 'opacity-'.length, 2);
		jQuery(this).css('opacity','.' + opacityValue);
		jQuery(this).css('filter','Alpha(opacity=' + opacityValue+')');
	});
	
	return true;
}

/**
 * Toggle inputs default values 
 * 
 * @return bool
 */

function setToggleInputs () {
	
	jQuery("[class*='toggle-inputs']").each(function (i) {
		var defaultValue = jQuery(this).val(); 
		jQuery(this).bind("click", function(){
			if (jQuery(this).val() == defaultValue) {
				jQuery(this).val('');
			}
		});

		jQuery(this).bind("focus", function(){
			if (jQuery(this).val() == defaultValue) {
				jQuery(this).val('');
			}
		});

		jQuery(this).bind("blur", function(){
			if (jQuery(this).val() == '') {
				jQuery(this).val(defaultValue);
			}
		});

	});
	
	return true;
}