	// BEGIN scripts for search field

function textClear(input) {
	if (input.value == input.defaultValue) { input.value = ""; }
}

function textRestore(input) { 
	if (input.value == "") { input.value = input.defaultValue; }
}

// END scripts for search field


//footer position function
//o css do #footer deve ter o atributo position:relative para o ie;

function setPosition() {
	
	if ($.browser.mozilla) {
   		//alert("this is mozilla!") 
		$('#footer').css( { position:"fixed", width:"100%" });
	} 
	
	var ele = $(window).height() - ($("#container").height() + $("#footer").height());
	//alert(ele);
	if (ele >= 0) {		
			$("#footer").css("top",ele);
		}
	else {
			$("#footer").css("bottom",0)
	}
	
}

//Changes title with the first header
/*function changeTitle(title) {
	var ele = title;
	document.title = ele;
}*/
		
$(document).ready(function(){
	
	//sets footer position
	//setPosition();
	
	$("#tree1 li:first").addClass("open")

	// Tree menu start
	$("#tree1").treeview({
			animated: "fast",
			unique: true,
			persist: "cookie",
			collapsed: true
	});
	
	
	//Clear/Restore input text
	/*$("input").focus(function () {
		$(this).val("");
	}).blur(function() {
		if ($(this).val() == "") {
			$(this).val($(this)[0].defaultValue);
		}
	}); */
	

	//Changes title with the first header
	/*var str = $(":header:first").text();
	if (str) {
		changeTitle(str+" - Soinca");
	} else {
		changeTitle("Soinca");
	}*/
	
	//table stripes
	$(".related tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
	$(".related tr:even").addClass("alt");
	
	$(".categorysearch").animate({opacity: "show"}, "slow");

	//index fade items
	/*$('.slideshow').cycle({ 
		fx:     'fade', 
		timeout: 6000, 
		delay:  -2000,
		cleartype: 1 
	});*/
	
});	
