//obsługa galerii barek
function moveToPrevious()
{
	if(moved_scroll > 0){
		new Effect.Move('imageBoxInside', { x: scroll_step, y: 0, transition: Effect.Transitions.sinoidal });
		moved_scroll = moved_scroll - scroll_step;
		
	}
	check_gallery_arrows();
} 

//obsługa galerii barek
function moveToNext()
{

	if( (moved_scroll+(6*scroll_step)) < (counted_images_p*scroll_step) ){
		new Effect.Move('imageBoxInside', { x: -scroll_step, y: 0, transition: Effect.Transitions.sinoidal });
		moved_scroll = moved_scroll + scroll_step;
	}		
	check_gallery_arrows();
}

//wyswietlanie strzalek w galerii
function check_gallery_arrows(){

	if( moved_scroll == 0 ){
		$('lga').style.display='none';
		$('rga').style.display='block';
	}else{
		$('lga').style.display='block';
	}
	
	if( (moved_scroll/scroll_step) == (counted_images_p-6) ){
		$('rga').style.display='none';
		$('lga').style.display='block';
	}else{
		$('rga').style.display='block';		
	}
}

//kasuje zawartosc elementu
function clear_value(id, phrase){

	var input_element = eval(document.getElementById(id));

	if( input_element.value == phrase ){
		input_element.value = '';
	}
}

function insert_values_search(id){

	var perscount = eval(document.getElementById(id));	
	var defperscount = "_e-mail";
	if(perscount.value == ''){
		perscount.value = defperscount;
	}

}

//funkcja do wysylki newslettera
function send_new_newsletter_mail(){
	
	document.new_newsletter_subscriber.submit();
}

function hide_show_element(el_id){
	Effect.toggle(document.getElementById(el_id),'blind',{duration:0.5});
} 

function hide_show_question(el_id){

	for(var i=1 ; i <= count_questions ; i++){
		if(el_id == 'faq_'+i){
			Effect.toggle(document.getElementById(el_id),'blind', { duration: 0.2 });
		}else{
			Effect.BlindUp('faq_'+i, { duration: 0.2 });
		}
	}
	
} 

function clear_form_elements(){
	
	var elem = document.getElementById('frmMain').elements;
	for(var i = 0; i < elem.length; i++){
		if( elem[i].type == 'text' || elem[i].type == 'textarea'){
			elem[i].value = '';
		}
	} 
}

function check_send_form(){
	
	var elem = document.getElementById('frmMain').elements;
	var form_send = true;
	for(var i = 0; i < elem.length; i++){
		if( elem[i].value == '' && ( (i >= 0 && i < 6) || (i > 7 && i < 11) ) ){
			elem[i].style.backgroundColor = '#ffe4e4';
			form_send = false;
		}else{
			elem[i].style.backgroundColor = 'white';
		}
	} 

	if(form_send == false){
		alert('Proszę wypełnić wymagane pola formularza.');
	}
	
	return form_send;
}

function submit_static_form(){
	document.static_page_form.submit();
	return true;
}

function display_movie_flv(url){
	window.open(url, 'Video', 'menubar=no,location=no,resizable=no,scrollbars=yes,status=no, width=460, height=355');
}


function CreateBookmarkLink() {
	 title = "Barki turystyczne. Czartery na rzekach i kanałach Europy."; 
	 url = "http://barki.pl";
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}


function select_price_page(id){
	
	var splitted = buttons_to_split.split(",");
	
	var l = document.getElementById('lb_'+id);
	var c = document.getElementById('cb_'+id);
	var r = document.getElementById('rb_'+id);
	
	for(var i = 0 ; i <= splitted.length ; i++){
		if(splitted[i] > 0){
			if(splitted[i] == id){
				l.className = 'corner_left';
				c.className = 'ptt_content';
				r.className = 'corner_right';
				
				document.getElementById('prices_layout').innerHTML = '';
				document.getElementById('prices_layout').innerHTML = document.getElementById('price_content_'+id).innerHTML;
				
			}else{
				document.getElementById('lb_'+splitted[i]).className = 'corner_left__notselected';
				document.getElementById('cb_'+splitted[i]).className = 'ptt_content__notselected';
				document.getElementById('rb_'+splitted[i]).className = 'corner_right__notselected';
			}
		}
	}
	
}

