$(document).ready(function(){		
	$('input[type="text"]').addClass("idleField");
		$('input[type="text"]').focus(function() {
			$(this).removeClass("idleField").addClass("focusField");
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('input[type="text"]').blur(function() {
			$(this).removeClass("focusField").addClass("idleField");
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
		
		$('textarea').addClass("idleField");
		$("textarea").focus(function() {
		 $(this).removeClass("idleField").addClass("focusField");
				if (this.value == this.defaultValue){ 
					this.value = '';
				}
				if(this.value != this.defaultValue){
					this.select();
				}
			}
		)
		
		$('textarea').blur(function() {
			$(this).removeClass("focusField").addClass("idleField");
			if ($.trim(this.value) == ''){
				this.value = (this.defaultValue ? this.defaultValue : '');
			}
		});
		
		var i = 1;
		$("[class^=commentnumber]").each(function() {
			$(this).html(i);
			i++;
		});
		
		var i = 1;
		$("[id^=li-comment-]").each(function() {
			$(this).find('.commentnumber').html(i);
			i++;
		});
		
		$('input:checkbox:not([safari])').checkbox();
		$('input[safari]:checkbox').checkbox({cls:'jquery-safari-checkbox'});
		$('input:radio').checkbox();
});

displayForm = function (elementId)
{
	var content = [];
	$('#' + elementId + ' input').each(function(){
		var el = $(this);
		if ( (el.attr('type').toLowerCase() == 'radio'))
		{
			if ( this.checked )
				content.push([
					'"', el.attr('name'), '": ',
					'value="', ( this.value ), '"',
					( this.disabled ? ', disabled' : '' )
				].join(''));
		}
		else
			content.push([
				'"', el.attr('name'), '": ',
				( this.checked ? 'checked' : 'not checked' ), 
				( this.disabled ? ', disabled' : '' )
			].join(''));
	});
	alert(content.join('\n'));
}

changeStyle = function(skin)
{
	jQuery('#myform :checkbox').checkbox((skin ? {cls: skin} : {}));
}

$(document).ready(function(){
	//reset
	if($.browser.safari){
		$('.boxgrid').ready(function(){
			$(".datelink", this).hide();
		});
		
		//Full Caption Sliding (Hidden to Visible)
		$('.boxgrid').hover(function(){
			$(".datelink", this).show();
		}, function() {
			$(".datelink", this).hide();
		});
	} else {
		$('.boxgrid').ready(function(){
			$(".datelink", this).stop().animate({"opacity": 0}, "fast");
		});
		
		//Full Caption Sliding (Hidden to Visible)
		$('.boxgrid').hover(function(){
			$(".datelink", this).stop().animate({"opacity": 1}, "fast");
		}, function() {
			$(".datelink", this).stop().animate({"opacity": 0}, "fast");
		});
	}
	
	jQuery('span[class*=timeago]').timeago();
});
