Cufon.replace('h1');
Cufon.replace('h2');
Cufon.replace('h3');
Cufon.replace('h4');
Cufon.replace('h5');
Cufon.replace('.cufon');



$(document).ready(function(){
	$("#visskjema").click(function () {
    		$("#bestillskjema").fadeIn("slow");  		
	});
	$("#bestillskjema .tilbake_skjema a").click(function () {
    		$("#bestillskjema").fadeOut("slow");
  	});

	$('#gallery').galleryView({
		nav_theme:'light',
		panel_width: 590,
		panel_height: 315,
		frame_width: 44,
		frame_height: 44,
		transition_speed: 550,
		easing: 'easeInOutQuad',
		transition_interval: 0
        });
        

     $('#logoImg').clone().prependTo('#bestillskjema');
     $('#bestillskjema #field-1').closest("li").attr("id", 'type');
     $('[name=forminput[1]]').val($('#baatnavn').html());
     $('#bestillskjema #field-4').closest("li").attr("id", 'postnr');     
     $('#bestillskjema #field-5').closest("li").attr("id", 'sted');
     

       
       //båtbygger for 27 offshore
       $('#form-11518 #field-48').closest("li").attr("id", 'postnr');
       $('#form-11518 #field-49').closest("li").attr("id", 'sted');
       
       //båtbygger for 27 pro
       $('#form-11536 #field-22').closest("li").attr("id", 'postnr');
       $('#form-11536 #field-23').closest("li").attr("id", 'sted');
       
        //båtbygger for 820
      $('#form-11557 #field-29').closest("li").attr("id", 'postnr');
       $('#form-11557 #field-30').closest("li").attr("id", 'sted');
       
       //båtbygger for 820 combi
       $('#form-11437 #field-31').closest("li").attr("id", 'postnr');
       $('#form-11437 #field-32').closest("li").attr("id", 'sted');
       
        //båtbygger for 870
       $('#form-11524 #field-28').closest("li").attr("id", 'postnr');
       $('#form-11524 #field-29').closest("li").attr("id", 'sted');
       
        //båtbygger for 870 Fly
       $('#form-11530 #field-27').closest("li").attr("id", 'postnr');
       $('#form-11530 #field-28').closest("li").attr("id", 'sted');
       
        //båtbygger for 34
       $('#form-11542 #field-32').closest("li").attr("id", 'postnr');
       $('#form-11542 #field-33').closest("li").attr("id", 'sted');
       
        //båtbygger for 34 Fly
       $('#form-11548 #field-31').closest("li").attr("id", 'postnr');
       $('#form-11548 #field-32').closest("li").attr("id", 'sted');
       
        //båtbygger for 38 Fly
       $('#form-11554 #field-27').closest("li").attr("id", 'postnr');
       $('#form-11554 #field-28').closest("li").attr("id", 'sted');
       
       

	if($('.error').length){
		$("#bestillskjema").show();
	};

 	var orgheight1 = $("#byggteknisk").height(); 	
	var orgheight2 = $("#byggbaat").height(); 	
	
	if(orgheight1>orgheight2){
		var newheight = orgheight1; 	
		}
	if(orgheight1<=orgheight2){
		var newheight = orgheight2; 
		}
		
	var orgheight3 = $(".content").height(); 	
	var orgheight4 = $(".contentRight").height(); 	
	
	if(orgheight3>orgheight4){
		var newheight2 = orgheight3; 	
		}
	if(orgheight3<=orgheight4){
		var newheight2 = orgheight4; 
		}
	var orgheight5 = $("#forhandlerLeft").height(); 	
	var orgheight6 = $("#forhandlerRight").height(); 	
	
	if(orgheight5>orgheight6){
		var newheight3 = orgheight5; 	
		}
	if(orgheight5<=orgheight6){
		var newheight3 = orgheight6; 
		}
		
		
	function heightPush(heightElement, heightElement2, newheight) {
	
		$(heightElement).height(Math.ceil(newheight));
		$(heightElement2).height(Math.ceil(newheight));
			
	};
	function heightPush2(heightElement, heightElement2, newheight) {
	
		$(heightElement).height(Math.ceil(newheight));
		$(heightElement2).height(Math.ceil(newheight-10));
			
	};
	function heightPush3(heightElement, heightElement2, newheight) {
	
		$(heightElement).height(Math.ceil(newheight));
		$(heightElement2).height(Math.ceil(newheight));
			
	};
	
	heightPush("#byggteknisk", "#byggbaat", newheight);
	heightPush2(".content", ".contentRight", newheight2); 
	heightPush3("#forhandlerLeft", "#forhandlerRight", newheight3);        
	

$('#nett_venstremeny').height(Math.ceil($('#nett_innhold').height()-113));

var InputTextReplacer = function(args)
{
	if($(args.inputs).length > 0)
	{
		this.init(args);
	}
}

InputTextReplacer.prototype = {
	init: function(args)
	{
		var self = this;
		this.inputs = $(args.inputs).filter(':text, textarea, :password');
		
		$(this.inputs).each(function(i, elem)
		{
			var label = $('label[for="' + $(this).attr('id') + '"]');
			if(args.hideLabels)
				$(label).hide();
			var labelText = $(label).text();
		
			$(this)
				.val(labelText)
				.focus(function()
				{
					if($(this).val() == labelText)
					{
						$(this).val('');
					}
				})
				.blur(function()
				{
					if(($(this).val() != labelText) && ($(this).val() == ''))
					{
						$(this).val(labelText);
					}
				});
		});
	}
};

$(function()
{
	var NBMARINEInputTextReplacer = new InputTextReplacer(
	{
		inputs: 'form#nbexloginform input.nbexfield_username, form#nbexloginform input.nbexfield_password',
		hideLabels: true
	});
});	
        
});


	

