var stop=1;
function scroll_gallery_left2(id) {
	if(stop==1){
		var test = jQuery('#showcaseInfo ul').children().size();
		arrow=((-107)*(test-2))+'px';
		if (test % 1 == 0) {var test = test + 1;}
		stop=0;
		
		var left=$('#showcaseInfo ul').css('left');

	  $('#showcaseInfo ul').animate({
	    left: ((left=='0px')?'':'+=107')
	  }, 500, function() {
		  	if(left==arrow) $('.slidemic .next').attr('style','visibility:visible');
	 		 if(left=='-107px') $('.slidemic .prev').attr('style','visibility:hidden');
	  		stop=1;
	    // Animation complete.
	  });
	}


}
function scroll_gallery_right2(id) {
	if(stop==1){
		
		var test = jQuery('#showcaseInfo ul').children().size();
		test2=((-107)*(test-2))+'px';
		arrow=((-107)*(test-3))+'px';
		stop=0;

		var left=$('#showcaseInfo ul').css('left');
		  $('#showcaseInfo ul').animate({
	    left: ((left==test2)?'-=0':'-=107')
	 	 }, 500, function() {
	 		 if(left==arrow) $('.slidemic .next').attr('style','visibility:hidden');
	 		 if(left=='0px') $('.slidemic .prev').attr('style','visibility:visible');
	 	 	stop=1;
	 	   // Animation complete.
	 	 });
	}

}


function contact() {

	//eror
	var error='';


	// start
	// jQuery('.cbut1').addClass('loading');

	// info
	
	var nume = jQuery('#nume').val();
	var telefon = jQuery('#telefon').val();
	var mail = jQuery('#email').val();
	var mesaj = jQuery('#mesaj').val();

	// check
	if(nume.length==0 || nume==' ') error += 'Nu ati completat campul Numele dvs./Firma <br />';
	if(telefon.length==0 || telefon==' ') error += 'Nu ati completat campul Telefon <br />';
	if(mail.length==0 || mail==' ') error += 'Nu ati completat campul Email <br />';
	
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
		if(reg.test(mail) == false) error += 'Adresa de e-mail invalida <br />';
	

	if(mesaj.length==0 || mesaj==' ') error += 'Nu ati completat campul Mesajul dvs. <br />';

	if(error.length==0) {

		jQuery('.flerror2').slideUp('slow');

		// post
		jQuery.post('ajax.php?a=contact',
			{

				nume: nume,
				telefon: telefon,
				mail: mail,
			
				mesaj: mesaj

			},
				function(data)
					{

						// afisare ok
						jQuery('.flerror').fadeIn('fast');
						jQuery('#nume').val('');
						jQuery('#telefon').val('');
						jQuery('#email').val('');
						jQuery('#mesaj').val('');
						// stop
						// jQuery('.cbut2').removeClass('loading');

					}
		);

	} else {
		 // jQuery('.cbut2').removeClass('loading');
		jQuery('.flerror2 p').html(error);
		jQuery('.flerror2').slideDown('slow');
	}

}

function showh(id){
	$('.mapamica img').fadeOut('fast',function(){
		$('.mapmic a').removeClass('sel1');
	});
	$('#im'+id).fadeIn('fast',function(){
		$('#or'+id).addClass('sel1');
	});
}



