function submitContactForm() {
	
	var name = $( '#contact_name' ).attr( 'value' );
	var email = $( '#contact_email' ).attr( 'value' );
	var phone = $( '#contact_phone' ).attr( 'value' );
	var text = $( '#contact_text' ).attr( 'value' );
	
	var errors = false;
	
	if ( name.length == 0 ) {
		
		errors = true;
		$( '#contact_name_tr' ).addClass( 'error' );
		//$( '#contact_name_input' ).addClass( 'error' );
	} else {
		
		$( '#contact_name_tr' ).removeClass( 'error' );
		//$( '#contact_name_input' ).removeClass( 'error' );
	}
	
	// Tikrinamas telefonas
	var phone_exists = false;
	var phone_correct = false;
	
	// Jei ner nieko ivesta tai ignoruojam visai
	if ( phone.length == 0 ) {
		
		phone_exists = false;
		$( '#contact_phone_tr' ).removeClass( 'error' );
		$( '#contact_phone_input' ).removeClass( 'error' );
		
	} else {
		
		phone_exists = true;
		
		var reg = /^([0-9\+\s])+$/;
		
		// Jei ivesta tikrinimas teisingumas
		if ( reg.test( phone ) === false ) {
			
			phone_correct = false;
			
			errors = true;
			$( '#contact_phone_tr' ).addClass( 'error' );
			//$( '#contact_phone_input' ).addClass( 'error' );
			
		} else {
			
			phone_correct = true;
			
			$( '#contact_phone_tr' ).removeClass( 'error' );
			//$( '#contact_phone_input' ).removeClass( 'error' );
		}
	}
	
	// Tikrinamas emailas
	var email_exists = false;
	var email_correct = false;
	
	// Jei nieko neivesta, tai turi buti ivestas telefonas
	if ( email.length == 0 ) {
		
		email_exists = false;
		
		// Turi buti arba telefonas arba emailas
		if ( ( phone_exists == true ) && ( phone_correct == true ) ) {
			$( '#contact_email_tr' ).removeClass( 'error' );
			//$( '#contact_email_input' ).removeClass( 'error' );
		} else {
			errors = true;
			$( '#contact_email_tr' ).addClass( 'error' );
			//$( '#contact_email_input' ).addClass( 'error' );
		}
		
	} else {
		
		email_exists = true;
		
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   		
   		if ( reg.test( email ) === false ) {
			
			email_correct = false;
			errors = true;
			$( '#contact_email_tr' ).addClass( 'error' );
			//$( '#contact_email_input' ).addClass( 'error' );
			
   		} else {
			
			email_correct = true;
			$( '#contact_email_tr' ).removeClass( 'error' );
			//$( '#contact_email_input' ).removeClass( 'error' );
		}
	}
	
	if ( text.length == 0 ) {
		
		errors = true;
		$( '#contact_text_tr' ).addClass( 'error' );
		//$( '#contact_text_input' ).addClass( 'error' );
	} else {
		
		$( '#contact_text_tr' ).removeClass( 'error' );
		//$( '#contact_text_input' ).removeClass( 'error' );
	}
	
	if ( errors === true ) {
		
		$( '#div_error_text' ).show();
		
		return false;
	} else {
		
		$( '#div_error_text' ).hide();
		$( '#contact_form' ).submit();
		return true;
	}
	
	return false;
}

function makeTransparent() {
	
	$( 'img.trans' ).each( function() {
		
		var filter_img = "filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);";
		var filter_parent = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "')";
		
		var node_img = $( this );
		var img = new Image();
		
		img.onload = function () {

			dimm = 'width:' + this.width + 'px;height:' + this.height + 'px;'
			node_img.attr( 'style', filter_img + dimm );
			var display = '';
			
			if ( node_img.parent().css( 'display' ) != 'block' && node_img.parent().css( 'display' ) != 'none' ) {
				
				display = 'display:block;'
			}
			node_img.parent().attr( 'style', display + dimm + filter_parent );
		};
		img.src = this.src;
		
	} );
}

$( document ).ready( function() {
	
	langs = $( 'div.lang img' );
	$( 'div.lang img' ).mouseenter( function() {
		
		current = this;
		langs.each( function() {
			
			if( this != current ) {
				
				this.src = this.src.replace( '.gif', '_inactive.gif' );
			}
		} )
		
		$( this ).mouseleave( function(){
			
			langs.each( function() {
				
				this.src = this.src.replace( '_inactive', '' );
			} );
		} );
	} );
	
	if ( $.browser.msie && parseInt( $.browser.version ) < 7 ) {
		
		setTimeout( 'makeTransparent()', 1000);
	}
	
	$( 'div.imgs img ' ).wrap( '<div class="img"></div>' );
} );