// TOUR HOME LINKS - FULL SCREEN PLAYER
// -------------------------------------------------------------------
var prevpos = Array();
//prevpos['frame_'] = 0;
//prevpos['frameb_'] = 0;
function cyclediv(name, elements, direction){
  if(prevpos[name] == null){
    prevpos[name] = 0;
  }
//alert(name+prevpos[name]);
  currdiv = document.getElementById(name+prevpos[name]);
  currdiv.style.display = "none";
  if(direction != 1){
    //neg mov
    prevpos[name] = prevpos[name]-1;
    if(prevpos[name] < 0){
      prevpos[name] = elements-1;
    }
  }else{
    //pos mov
    prevpos[name] = prevpos[name]+1;
    if(prevpos[name] > elements-1){
      prevpos[name] = 0;
    }
  }
  nextdiv = document.getElementById(name+prevpos[name]);
  nextdiv.style.display = "";//block
}

function fixVideoLinks(){
  $('.videoLinks').each(function(n){
    //if($(this).attr('class') == 'videoLinks-fixed' ){
    //}else{
	  var textArray = $(this).text().split(',');
      var vid = textArray[0];
      var title = $(this).attr('title');
      var type =  $(this).attr('alt');
      var fsize = "";
      var dsize = "";
      switch(type){
        case 'h.264_1800_normal':
           var fsize = "wh1800";
           var dsize = "-1800";
           break;
        case 'h.264_1800_wide':
           var fsize = "wh1800ws2";
           var dsize = "-1800";
           break;
        case 'h.264_1800_wide_HD':
           var fsize = "wh1800ws2hd";
           var dsize = "-1800";
           break;
        default: 
           break;      
      }
      $(this).text('');
      $(this).removeAttr('title');
      $(this).removeAttr('alt');
      if(fsize != ""){
        switch(textArray[1]){
          case 'home':
            $(this).append('<a href="/tour/play.php?type=flv&path=' + vid + '/1800/'+fsize+'?TB_iframe=true&height=600&width=1100" title="'+title+'" class="thickbox">Stream Video</a>');
            break;
          case 'section':
            $(this).append('<a href="/tour/play.php?type=flv&path=' + vid + '/1800/'+fsize+'&TB_iframe=true&height=600&width=1100" title="'+title+'" class="thickbox"><img src="/images/flashplay_tb.png" border=0 alt="'+title+'" title="'+title+'"></a>');
            break;
          case 'gallery':
            $(this).append('<a href="/tour/play.php?type=flv&path=' + vid + '/1800/'+fsize+'&TB_iframe=true&height=600&width=1100" title="'+title+'" class="thickbox"><img src="/images/flashplay_tb.png" border=0 alt="'+title+'" title="'+title+'"></a>');
            break;
          default:
            $(this).append('<a href="/tour/play.php?type=flv&path=' + vid + '/1800/'+fsize+'?TB_iframe=true&height=600&width=1100" title="'+title+'" class="thickbox">Stream Video</a>');
            break;
        }
      }else{
      
      }
	  $(this).attr('class','videoLinks-fixed');
    //}
  });  
}






function openSub() 
{
	
	wWidth = 800; wHeight = 600;
	
	wHPos = (screen.width / 2) - (wWidth / 2);
	wVPos = (screen.height / 2) - (wHeight / 2) - 50;
	
	if (document.all) {
	oWin = self.open("/subscribe/","nvSMP","width="+wWidth+",height="+wHeight+",location=no,top="+wVPos+",left="+wHPos+",personalbar=no,menubar=no,scrollbars=no,status=no,toolbar=no")
	oWin.focus()
	} else {
		oWin = self.open("/subscribe/","nvSMP","width="+wWidth+",height="+wHeight+",location=no,screenY="+wVPos+",screenX="+wHPos+",personalbar=no,menubar=no,scrollbars=no,status=no,toolbar=no")
		oWin.focus()
	}
	
}


function openApp() 
{
	
	wWidth = 800; wHeight = 600;
	
	wHPos = (screen.width / 2) - (wWidth / 2);
	wVPos = (screen.height / 2) - (wHeight / 2) - 50;
	
	if (document.all) {
	oWin = self.open("/feedback/","nvSMP","width="+wWidth+",height="+wHeight+",location=no,top="+wVPos+",left="+wHPos+",personalbar=no,menubar=no,scrollbars=yes,status=no,toolbar=no")
	oWin.focus()
	} else {
		oWin = self.open("/feedback/","nvSMP","width="+wWidth+",height="+wHeight+",location=no,screenY="+wVPos+",screenX="+wHPos+",personalbar=no,menubar=no,scrollbars=yes,status=no,toolbar=no")
		oWin.focus()
	}
	
}

function openChat() 
{
	
	wWidth = 800; wHeight = 515;
	
	wHPos = (screen.width / 2) - (wWidth / 2);
	wVPos = (screen.height / 2) - (wHeight / 2) - 50;
	
	if (document.all) {
	oWin = self.open("cams/","nvSMP","width="+wWidth+",height="+wHeight+",location=no,top="+wVPos+",left="+wHPos+",personalbar=no,menubar=no,scrollbars=no,status=no,toolbar=no")
	oWin.focus()
	} else {
		oWin = self.open("cams/","nvSMP","width="+wWidth+",height="+wHeight+",location=no,screenY="+wVPos+",screenX="+wHPos+",personalbar=no,menubar=no,scrollbars=no,status=no,toolbar=no")
		oWin.focus()
	}
	
}



