// JavaScript Document

function toggle( operation ){
  var i;
  for( i = 1; i <= jQuery('#tracks > *').size(); i = i + 1){
    idHide = '#BOXSC00' + i;
    play = '#play' + i;
    jQuery(idHide).hide();
    jQuery(play).css("background-image","url(m58template/dolomititours/images/toggleOff.png)");
    jQuery(play).css("background-position","left");
    jQuery(play).css("background-repeat","no-repeat");
    jQuery(play).text('');
    jQuery('#next').css("background-image","url(m58template/dolomititours/images/toggleSucc.gif)");
    jQuery('#next').css("background-position","left");
    jQuery('#next').css("background-repeat","no-repeat");
    jQuery('#next').text('');
    jQuery('#previous').css("background-image","url(m58template/dolomititours/images/togglePrev.gif)");
    jQuery('#previous').css("background-position","left");
    jQuery('#previous').css("background-repeat","no-repeat");
    jQuery('#previous').text('');
    //jQuery(play).css("background-color","red");
    if( (operation == 'first') && (i == 1) ){
      //jQuery(idHide).show();
      jQuery(idHide).css("display","block");
       jQuery('#controls').css("display","block");
      succ = 2;
      prev = jQuery('#tracks > *').size();
      jQuery('#play1').css("background-image","url(m58template/dolomititours/images/toggleOn.png)");


    }else if(operation != 'first'){
      if( operation == 'previous' ){
        operation = prev;      
      }else if( operation == 'next' ){
        operation = succ;
      }
      
      idHide = '#BOXSC00' + operation;
      
      //jQuery(idHide).show();
      jQuery(idHide).css("display","block");

      jQuery('#play' + operation).css("background-image","url(m58template/dolomititours/images/toggleOn.png)");
      succ = operation + 1;
      if( succ == jQuery('#tracks > *').size() + 1 )
        succ = 1;
      prev = operation - 1;
      if( prev == 0 )
        prev = jQuery('#tracks > *').size();
    }
  } 
}

function formLogin(){
	if(jQuery('#loginForm').is(":hidden")) {
		jQuery('#loginForm').slideDown();
	}
	else {
		jQuery('#loginForm').slideUp();
	}
}

