$(document).ready(function(){
	$('input[type=file]').each(function(){
  
		var uploadbuttonlabeltext = $(this).attr('title'); //get title attribut for languagesettings
		if(uploadbuttonlabeltext == ''){
			var uploadbuttonlabeltext = '';
		}
  
		var uploadbutton = '<input type="button" class="button_button" value="'+uploadbuttonlabeltext+'" />';
		$(this).wrap('<div class="fileinputs"></div>');
			$(this).addClass('file').css('opacity', 0); //set to invisible
			$(this).parent().append($('<div class="fakefile" />').append($('<input type="text" value="Billede" class="gardenform-image" />').attr('id',$(this).attr('id')+'__fake')).append(uploadbutton));
 
		$(this).bind('change', function() {
			$('#'+$(this).attr('id')+'__fake').val($(this).val());;
		});
		$(this).bind('mouseout', function() {
			$('#'+$(this).attr('id')+'__fake').val($(this).val());;
		});
	});
	$('.searchfield').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strSearch;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#b6b6b6';
			}
		});
	});
	
	$('#name').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strName;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#address').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strAddress;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#address2').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strAddress2;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#zipcode').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strZipcode;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#city').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strCity;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#phone').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strPhone;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#email').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strEmail;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#youtube').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strYoutube;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#formtitle').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strTitle;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#formdescription').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strDescription;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#gardentip-inputfield').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strGardentipsearch;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#373535';
			}
		});
	});
	$('#commentname').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strCommentname;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#686868';
			}
		});
	});
	$('#commentemail').each(function() {
		var default_value = this.value;

		$(this).focus(function() {
			if(this.value == default_value) {
				this.value = strCommentemail;
				this.style.color = '#000000';
			}
		});
		$(this).blur(function() {
			if(this.value == '') {
				this.value = default_value;
				this.style.color = '#686868';
			}
		});
	});

	$('#product_id').selectbox();

	$('#scroller').simplyScroll({
		className: 'vert',
		horizontal: false,
		frameRate: 20,
		speed: 10
	});
});
