Cufon.replace('.geoRegular', { fontFamily: 'geoRegular'  });
Cufon.replace('.geoMedium', { fontFamily: 'geogrotesque-medium', hover:true });
Cufon.replace('.fbFont', { fontFamily: 'Lucida Grande', hover:true });

var fb_status = 0;

function is_ie6()
{
     return ((window.XMLHttpRequest == undefined) && (ActiveXObject != undefined));
}

$(document).ready(function(){
    
$('a.map-pos').click(function(){
   $('#contact #form-section .wrapper div').removeClass('active');   
   var addr2show = $(this).attr('id');
   if(addr2show=='wwa') $('.address div.fright').empty().append('Warszawa');
   if(addr2show=='wro') $('.address div.fright').empty().append('ul. Sokola 66, 53-136 Wrocław');
   if(addr2show=='ns') $('.address div.fright').empty().append('ul. Narutowicza 3, 33-300 Nowy Sącz');
   $(this).parent('div').addClass('active');
   Cufon.refresh();
   
    
});
						   
if(is_ie6()){
    $('#ie6_support').fadeIn();
}
var fb_content_height = $('#fb_content').css('height');
	$('.fb_show').click(function() {
		$('#fb_content').slideToggle(350);
		if(fb_status==0){
 		 $('#fb_bar').animate({top: '+='+fb_content_height}, 350, function() {});
		 $('.wrapper930 img#up_arrows').attr('src','images/up_arrows.png');
		 fb_status = 1;
		} else {
		 $('#fb_bar').animate({top: '-='+fb_content_height}, 350, function() {})
		 $('.wrapper930 img#up_arrows').attr('src','images/down_arrows.png');
		 fb_status = 0;
		}
	});
$('a.about_us').click(function() {
		$.scrollTo( { top:635, left:0}, 800, {});
		return false;
});
$('#about_us .section_desc strong').click(function() {
		$.scrollTo( { top:1960, left:0}, 800, {});
		return false;
});
$('a.services').click(function() {
		$.scrollTo( { top:970, left:0}, 800, {});
		return false;
});
$('a.clients').click(function() {
		$.scrollTo( { top:1430, left:0}, 800, {});
		return false;
});
$('a.contact').click(function() {
		$.scrollTo( { top:1960, left:0}, 800, {});
		return false;
});
$('#box_small').click(function() {
		$.scrollTo( { top:1960, left:0}, 800, {});
		return false;
});

$('#disclaimer #checkbox').click(function() {
	if($(this).hasClass('clearbox'))
	{
		$(this).removeClass('clearbox');
		$(this).addClass('checked');		
		$('#disclaimer #checkbox input#ACCEPT').val('yes');
	} else if($(this).hasClass('checked'))
	{
		$(this).removeClass('checked');
		$(this).addClass('clearbox');
		$('#disclaimer #checkbox input#ACCEPT').val('no');
	}	
});

	$('#contact-form input#SURNAME').focus(function(){
		$('#nameError').fadeOut();
	});
	$('#contact-form input#COMPANY').focus(function(){
		$('#companyError').fadeOut();
	});
	$('#contact-form input#EMAIL').focus(function(){
		$('#emailError').fadeOut();
	});
	$('#contact-form input#TELEPHONE').focus(function(){
		$('#phoneError').fadeOut();
	});
	$('#contact-form textarea#MESSAGE').focus(function(){
		$('#msgError').fadeOut();
	});
	
	



// ***************************************************
	
	 $("#contact-form").submit(function(event) {
			/* stop form from submitting normally */
		event.preventDefault(); 	
		validateForm();
		if(validationStatus) 
		{
			/* get some values from elements on the page: */
			var $form = $( this ),
				surname = $form.find( 'input[name="SURNAME"]' ).val(),
				company = $form.find( 'input[name="COMPANY"]' ).val(),
				email = $form.find( 'input[name="EMAIL"]' ).val(),
				telephone = $form.find( 'input[name="TELEPHONE"]' ).val(),
				message = $form.find( 'textarea[name="MESSAGE"]' ).val(),
				accept = $form.find( 'input[name="ACCEPT"]' ).val(),
				url = $form.attr( 'action' );		
			/* Send the data using post and put the results in a div */
			$.post( url, { SURNAME: surname, COMPANY: company, EMAIL: email, TELEPHONE: telephone, MESSAGE: message, ACCEPT: accept },
			  function( data ) {
				  if(data == 1) 
				  {
					  	$('form#contact-form').fadeOut(700);
						$('#thanksFormMsg').fadeIn(700);
				  }
				  else alert ('nie udalo sie');
			  }
			);
		}
	});
	// *******************************************************
	$('#contact #thanksFormMsg a#restoreForm').click(function(){
			$('#thanksFormMsg').fadeOut(700);													  
			$('form#contact-form').fadeIn(700);
			$("#contact-form").find( 'input[name="SURNAME"]' ).val('');
			$("#contact-form").find( 'input[name="COMPANY"]' ).val('');
			$("#contact-form").find( 'input[name="EMAIL"]' ).val('');
			$("#contact-form").find( 'input[name="TELEPHONE"]' ).val('');
			$("#contact-form").find( 'textarea[name="MESSAGE"]' ).val('');
			$('#disclaimer #checkbox').addClass('clearbox');
			$('#disclaimer #checkbox').removeClass('checked');
			$('#contact #disclaimer #checkbox input').val('no');
			validationStatus = false;
	});
	


						   

});

						   






