function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

function validateMemberDelete(memberName){
	var agree = confirm("Are you sure you want to delete "+memberName+". This will also delete the videos.");
	if (agree){
		return true ;
	}else{
		return false ;
	}
}

function validateVideoDelete(memberName, videoTitle){
	var agree = confirm("Are you sure you want to delete "+memberName+"'s video '"+videoTitle+"'");
	if (agree){
		return true ;
	}else{
		return false ;
	}
}

// fieldname, warningname, remainingname, maxchars
function CheckFieldLength(fn,wn,rn,mc) {
  var len = fn.value.length;
  if (len > mc) {
    fn.value = fn.value.substring(0,mc);
    len = mc;
  }
  document.getElementById(wn).innerHTML = len;
  document.getElementById(rn).innerHTML = mc - len;
}

//Display the video upload bar
function displayLoading(){
	document.getElementById('loading').style.visibility='visible';
	return true;
}


//Count Up for video upload
var up,down;
var min1,sec1;
var cmin1,csec1,cmin2,csec2;


function CountUp() {
	timer = '10:00';
	cmin1=0;
	csec1=0;
	min1=0+Minutes(timer);
	sec1=0+Seconds(timer);
	CountUpRepeat();
}

function CountUpRepeat() {
	csec1++;
	if(csec1==60) { csec1=0; cmin1++; }
	document.getElementById('counter').innerHTML = Display(cmin1,csec1);
	if((cmin1==min1)&&(csec1==sec1))
		alert("Video Upload Stopped! Please contact the director at: director@actingontheweb.com");
	else
		up=setTimeout("CountUpRepeat()",1000);
}

function CountDown() {
	timer = '10:00';
	cmin2=1*Minutes(timer);
	csec2=0+Seconds(timer);
	CountDownRepeat();
}

function CountDownRepeat() {
	csec2--;
	if(csec2==-1) { csec2=59; cmin2--; }
	document.getElementById('counter').innerHTML = Display(cmin2,csec2);
	if((cmin2==0)&&(csec2==0))
		alert("Timer-CountDown Stopped");
	else
		down=setTimeout("CountDownRepeat()",1000);
}

function Minutes(data) {
	for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==":") break;
	return(data.substring(0,i));
}

function Seconds(data) {
	for(var i=0;i<data.length;i++) if(data.substring(i,i+1)==":") break;
	return(data.substring(i+1,data.length));
}

function Display(min,sec) {
	var disp;
	if(min<=9) disp=" 0";
	else disp=" ";
	disp+=min+":";
	if(sec<=9) disp+="0"+sec;
	else disp+=sec;
	return(disp);
}
