// validate a ticket price was selected for event on event detail page
function validRadio(field){		
	var radio_group = field;
	// one radio	
	if (!radio_group.length){
		if (radio_group.checked){
			return true;
		}
	}else{
	// multiple radios
    for( r=0; r < radio_group.length; r++ ) {    	
		   if( radio_group[r].checked) {    
       	return true;
       }
		}
  }
	return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  over = window.open(theURL,winName,features);
  over.focus()
}

function validAcct(){
	// first Name
	if (document.Form.acctFirstName.value=="") {
			document.Form.acctFirstName.focus();
    	alert('Please provide your first name.');
      return false; 
	}
	// last Name
	if (document.Form.acctLastName.value=="") {
			document.Form.acctLastName.focus();
    	alert('Please provide your last name.');
      return false; 
	}
	// state
	if (document.Form.acctState.value=="") {
			document.Form.acctState.focus();
    	alert('Please provide the state in which you reside.');
      return false; 
	}
	// zipcode
	if (document.Form.acctZipcode.value=="") {
			document.Form.acctZipcode.focus();
    	alert('Please provide your zip code.');
      return false; 
	}
	// email
	if (document.Form.acctEmail.value=="") {
			document.Form.acctEmail.focus();
    	alert('Please provide your email address.\nThis will also be your login.');
      return false; 
	}
	// password fields
	if (document.Form.pass1.value=="" || document.Form.pass2.value=="") {
    	alert('Please supply a password, and validate that password in the applicable text fields.');
      return false; 
	}	
	// validate passowrds match
	if (document.Form.pass1.value != document.Form.pass2.value) {
    	alert('The passwords you supplied do not match.');
      return false; 
	}
	// gender
	if (!validRadio(document.Form.acctGender)) {
    	alert('Please provide your gender.');
      return false; 
	}
	// age
	if (!validRadio(document.Form.acctAge)){
    	alert('Please provide your age.');
      return false; 
	}
	
	// acccept terms
	if (!document.Form.accept.checked){
		alert('You must agree to the terms and conditions before your account can be created');
		return false;
	}
	
	return true;
	
}

// view Acct terms
function viewAcctTerms(){
	win = window.open('docs/next_hit_show_survey_sweepstakes_rules.pdf', 'term', 'resizable,scrollbars=yes,width=600,height=480,left=25,top=25')
}

// view Acct terms
function viewImg(file){
	win = window.open('view/dspimg.cfm?file=' + file, 'img', 'resizable,width=420,height=420,left=25,top=25');
	win.focus();
}

// view Acct terms
	function change_source(mypic){
		var tempStr;
		var tempArr = new Array();
		tempStr = mypic;
		tempArr = tempStr.split('/');
		return tempArr[(tempArr.length)-1]; } 

	function viewImgg(file){
		win = window.open('view/dspimg.cfm?file=' + file, 'img', 'resizable,width=420,height=420,left=25,top=25');
		win.focus();
}

function validateSurvey(list){	
	qArray = list.split(",");		
	for (i = 0 ; i < qArray.length ; i++) {		
		if (!validRadio(document.Form["q_" + qArray[i]]))	{
			alert("Please answer all of the survey's questions.");
			return false;					
		}			
	}
	// otherwise submit form
	document.Form.submit();
}

function launchVideo(clip){
	win = window.open('http://video.nexthitshow.com/videoWin.asp?clip=' + clip, 'img', 'resizable,width=340,height=275,left=25,top=25');
	win.focus();
}


function validateCom(){
	// email
	if (document.Form.comment.value=="") {
			document.Form.comment.focus();
    	alert('Please provide a comment.');
      return false; 
	}
	// acccept terms
	if (!document.Form.accept.checked){
		alert('You must agree to the terms and conditions before your comments can be submitted');
		return false;
	}
	
	return true;
}




