$(document).ready( function() {

	autowidthinputfields() ;
    
});

function autowidthinputfields () {
	$(".fieldform input[type!=submit][type!=hidden]").each( function (i) {
		
		b = $(this).parent("div").innerWidth() ;
		pl = $(this).css("padding-left") ;
		pr = $(this).css("padding-right") ;
		pol = $(this).parent("div").css("padding-left") ;
		por = $(this).parent("div").css("padding-right") ;
		nb = b - parseInt( pl ) - parseInt( pr ) - parseInt( pol ) - parseInt( por ) - 8 ;
		nb = nb + "px" ;
		$(this).css("width", nb ) ;
    });
	
	$(".fieldform select").each( function (i) {
		
		b = $(this).parent("div").innerWidth() ;
		pl = $(this).css("padding-left") ;
		pr = $(this).css("padding-right") ;
		pol = $(this).parent("div").css("padding-left") ;
		por = $(this).parent("div").css("padding-right") ;
		nb = b - parseInt( pl ) - parseInt( pr ) - parseInt( pol ) - parseInt( por ) - 2 ;
		nb = nb + "px" ;
		$(this).css("width", nb ) ;
    });
    
	$(".fieldform textarea[class!='textext']").each( function (i) {
		
		b = $(this).parent("div").innerWidth() ;
		pl = $(this).css("padding-left") ;
		pr = $(this).css("padding-right") ;
		pol = $(this).parent("div").css("padding-left") ;
		por = $(this).parent("div").css("padding-right") ;
		nb = b - parseInt( pl ) - parseInt( pr ) - parseInt( pol ) - parseInt( por ) - 8 ;
		nb = nb + "px" ;
		$(this).css("width", nb ) ;
    });
}
