/* ************************************************************** +document ready ************************************************************* */
$(document).ready(
	function(){
		if(notSupMaxPropert()) { //ie6
			//flashMinMsieProperties();
		}
		
		rels();	
		infoShow();
		disable();
		over();
		txtFocus()
	}
);
/* ************************************************************** end document ready ************************************************************ */


/* *************************************************************** +window resize *************************************************************** */
/*
$(window).ready(
	function(){
		if(notSupMaxPropert()) {
			flashMinMsieProperties();
		}
	}
);
*/
/* *************************************************************** end window resize ************************************************************ */


/* *********************************************************** +document ready functions ********************************************************* */
function rels() {
	$("a[rel*=external]").attr("target", "_blank");
}

function infoShow() {
	$(".info-pic").slideToggle("slow");
}

function disable() {
	$(".disable").css({opacity:0.2});
}

function over() { 
	$(".over").hover(function(){
		$(this).stop().animate({opacity:0.6}, 300 );
	},function(){
	    $(this).stop().animate({opacity:1.0}, 300 );
	});

}

function txtFocus() {
$('.txtFocus').focus(function(e) {
		var elm = $(e.target);
		if (elm.val() == elm.attr("title")) {
			elm.val('');
		}
	}).blur(function(e) {
		var elm = $(e.target);
		if (elm.val() == "") {
			elm.val(elm.attr("title"));
		}
	});
}



/* *********************************************************** input file customizer ********************************************************* */


var W3CDOM = (document.createElement && document.getElementsByTagName);

function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('div');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='pix/button_select.gif';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs') continue;
		x[i].className = 'file hidden';
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
	}
}

/* *********************************************************** end input file customizer ********************************************************* */

/* *********************************************************** end document ready functions ********************************************************* */


/* ******************************************************************* +ie hacks ******************************************************************* */
function notSupMaxPropert() { // não suporta CSS max properties
	if (typeof document.body.style.maxHeight === "undefined") return true;
	else return false;
}
/* ***************************************************************** end ie hacks ****************************************************************** */
