function refresh_select(){
	$("select").selectBox('destroy');
	$(".selectBox-options").remove();
	$("select").selectBox();
	
}
function refresh_input(){
	custominp.create($("input[type='text'], input[type='password'], textarea"));
}
jQuery(document).ready(function($) {
	//$(".print-submenu").parent("div").css('width',190);
	//$(".print-submenu").parent("div").css('float','left');
	$("select").selectBox();
	custominp.create($("input[type='text'], input[type='password'], textarea"));
	custominp.create($("#log-in input[type='text'],#log-in input[type='password']"),{width:250,height:25});
	
	$("div.hatch").each(function(){
			$(this).css("visibility", "visible");
			$(this).hide();
		});
		
	$(".project_thumbs .imgbord img").each(function(){
	  var img = $(this);
	  var cont = img.parent().parent();
	  if(img.width()==0){
		img.load(function(){
		 $(this).parent().width( img.width()<25?25:img.width());
			if (cont.children().length>1) {
		 		cont.width(cont.width() + img.parent().width() + 16);
			}
			else {
				cont.width(img.parent().width() + 12);
			}
		});
	  }
	  else{
		$(this).parent().width( img.width()<25?25:img.width());
			if (cont.children().length>1) {
		 		cont.width(cont.width() + img.parent().width() + 16);
			}
			else {
				cont.width(img.parent().width() + 12);
			}
	  }
		
	 });
	
		
	 $(".tipses").each(function(){
	  var IE6 = (($.browser.msie) && ($.browser.version == '6.0'))?true:false;
	  if(IE6) $(this).addClass("ie6");
	  var bord = '<div class="bord t"><div class="l"></div><div class="r"></div></div>\
		  <div class="bord b"><div class="l"></div><div class="r"></div></div>\
		  <div class="bord l"></div><div class="bord r"></div><div class="tip"></div>';
	  $(this).html('<div class="cont">'+$(this).html()+'</div>');
	  $(this).children(".cont").children(".tipses_close").prependTo($(this));
	  $(this).prepend(bord);
	  $(this).css({position:"absolute", visibility:"hidden", display: "block"});
	  var height = $(this).outerHeight();
	  $(this).css({position: "", visibility:"", display: ""});
	  $(this).children(".bord.l, .bord.r").height(height - 20);
	  $(this).children(".tip").css("height", height);
//	  var top = parseInt($(this).parent().css("padding-top") - Math.round(height/2));
	  $(this).css("top", parseInt($(this).parent().css("padding-top")) - parseInt(Math.round(height/2)));
	 })
});

var custominp = {
 create: function(selector, data){
	var data = data || {};
	var IE6 = (($.browser.msie) && ($.browser.version == '6.0'))?true:false;
	selector.each(function(){
		if($(this).parent(".custom-inp").length==0) {
			var width = data.width==undefined?$(this).width():data.width;
			var height = data.height==undefined?$(this).height():data.height;
			if (height!=0 && width!=0){
	//			alert(" width = "+width+" height = "+height);
				var bord = '<div class="bordtl"></div><div class="bordtr"></div>\
				 <div class="bordbl"></div><div class="bordbr"></div>\
				 <div class="bordl"></div><div class="bordr"></div>\
				 <div class="bordb"></div><div class="bordt"></div>';
				$(this).after('<div class="custom-inp">'+bord+'</div>');
				$(this).appendTo($(this).next());
				$(this).parent().css({width:width, height:height});
				$(this).css({width:width-5, height:$(this)[0].tagName=="INPUT"?height:height-4});
				if(IE6 && $(this)[0].tagName=="INPUT"){
				 $(this).parent().children(".bordbl, .bordbr, .bordb").addClass("ie6");
				}
			}
		}
	})
 }
}
	

/*
jQuery(document).ready(function($) {

	$("input[type=text]").each(function(){
	 var name =$(this).attr("name");
	 var id =$(this).attr("id");
	 var value =$(this).attr("value");
	 var val =$(this).val();
	 var cls = $(this).attr("class");
//	 alert(name);
//	 alert(id);
//	 alert(val);
//	 
	 var top = "<div style=\"float:left\"><div class=\"input_l\"></div><div class=\"input_b\">";
	 var bot = "</div><div class=\"input_r\"></div></div>";
	 if (cls !="inputtext hatch_quantity" && cls!="inputtext hatch_quantity fixed_quantity"){
		$(this).parent().append(top+"<input type='text' name='"+name+"' class='"+cls+"' value='"+value+"' id='"+id+"'/>"+bot);
		$(this).remove();
	 }
//	 $(this).addClass("input_cool");
	});
	
	$("input[type=password]").each(function(){
	 var name =$(this).attr("name");
	 var id =$(this).attr("id");
	 var value =$(this).attr("value");
	 var val =$(this).val();
	 var cls = $(this).attr("class");
//	 alert(name);
//	 alert(id);
//	 alert(val);
	 var top = "<div style=\"float:left\"><div class=\"input_l\"></div><div class=\"input_b\">";
	 var bot = "</div><div class=\"input_r\"></div></div>";
	 $(this).parent().append(top+"<input type='password' name='"+name+"' class='"+cls+"' value='"+value+"' id='"+id+"'/>"+bot);
	 $(this).remove();
//	$(this).addClass("input_cool");
	});
	
		
	});	*/
	

