function doClear(theText) {
	if (theText.value == theText.defaultValue) { theText.value = "" };
}

function undoClear(theText) {
	if (theText.value == "") { theText.value = theText.defaultValue };
}

var $jq = jQuery.noConflict();

$jq(document).ready(function(){
	/*$jq('#slideshow1').hover(
		function(){
			$jq(this).cycle({
				fx:			'fade',
				timeout:	'2000',
				speed:		'500',
				fit:		1
			});
		},
		function(){
			$jq(this).cycle(0).cycle('stop');
		}
	);*/
	$jq('#slideshow1').cycle({
		timeout:	10000,
		fit: 		1,
		pause:		1,
		delay:		-2000
	});
	$jq('#slideshow2').cycle({
		timeout:	10000,
		fit: 		1,
		pause:		1,
		delay:		0
	});
	$jq('#slideshow3').cycle({
		timeout:	10000,
		fit: 		1,
		pause:		1,
		delay:		2000
	});
});

$jq(function(){
	function filterPath(string) {
		return string
				.replace(/^\//,'')
				.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
				.replace(/\/$/,'');
	}

	var locationPath = filterPath(location.pathname);
	
	var scrollElement = 'html, body';
	$jq('html, body').each(function () {
		var initScrollTop = $jq(this).attr('scrollTop');
		$jq(this).attr('scrollTop', initScrollTop + 1);
		if ($jq(this).attr('scrollTop') == initScrollTop + 1) {
			scrollElement = this.nodeName.toLowerCase();
			$jq(this).attr('scrollTop', initScrollTop);
			return false;
		}    
	});
	
	$jq('a[href*=#]').each(function() {
		var thisPath = filterPath(this.pathname) || locationPath;
		if  (   locationPath == thisPath
				&& (location.hostname == this.hostname || !this.hostname)
				&& this.hash.replace(/#/, '')
			) {
				if ($jq(this.hash).length) {
					$jq(this).click(function(event) {
						var targetOffset = $jq(this.hash).offset().top;
						var target = this.hash;
						event.preventDefault();
						$jq(scrollElement).animate(
							{scrollTop: targetOffset},
							500,
							function() {
								location.hash = target;
						});
					});
				}
		}
	});
});

/*$jq(document).ready(function(){
	var postid = $jq('div.post').attr('id');
	$jq('#wrapper:has(a):has(img)').each(function() {
		$jq(this).find('a:has(img)').each(function() {
			$jq(this).addClass('cboxelement').attr('rel', 'lightbox['+postid+']').attr('title',' ');
		});
	});						 
});*/