jQuery.noConflict();

jQuery(function($) {
	
	/* FIXING Z-INDEX FOR IE6 & IE7 */
	$(function() {
		var zIndexNumber = 100;
		$('.fixZindex').each(function() {
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 1;
		});
	});
	
	/* INPUT DEFAULT VALUE HANDLER */
	
	$('input.hintValue').each(function(i) {
		$(this).data('hint', $(this).attr('value'));
	});
	
	$('input.hintValue').focus(function() {
		var hint = $(this).data('hint');
		var value = $(this).attr('value');
		if (value == hint) {
			$(this).attr('value', '');
		}
	});
	$('input.hintValue').blur(function() {
		var hint = $(this).data('hint');
		var value = $(this).attr('value');
		if (value == '') {
			$(this).attr('value', hint);
			$(this).removeClass('inUse');
		} else {
			$(this).addClass('inUse');
		}
	});
	
	
	/* DESIGN SELECT */
	
	$('div.select').click(function() {
		var selectControl = $(this);
		if (selectControl.hasClass('opened')) {
			selectControl.find('.options').fadeOut(100, function(){
				selectControl.removeClass('opened');
			});
		} else {
			selectControl.find('.options').fadeIn(100, function(){
				selectControl.addClass('opened');
			});
		}
	});
	$('div.select').mouseleave(function() {
		var selectControl = $(this);
		if (selectControl.hasClass('opened')) {
			selectControl.find('.options').fadeOut(100, function(){
				selectControl.removeClass('opened');
			});
		}
	});
	$('div.select ul.options li').click(function() {
		var label = $(this).html();
		var value = $(this).attr('val');
		
		var selectControl = $(this).parents('div.select');
		
		selectControl.find('.label').html(label);
		selectControl.attr('title', label);
		selectControl.find('.value').val(value);
		selectControl.addClass('selected');
	});
	
	
});



