function selectbyvalue(id, v){ 
	var cbo=document.getElementById(id); 

	for(var i=0; i<cbo.length; i++) { 
		if(cbo.options[i].value==v) { 
			cbo.selectedIndex=i; 
			return; 
		} 
	} 
	
}
function selectedbyvalue(cbo, v){ 
	for(var i=0; i<cbo.length; i++) { 
		if(cbo.options[i].value==v) { 
			cbo.selectedIndex=i; 
			return; 
		} 
	} 
	
}

function checkedbyvalue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}
function vldall(theForm) {
	for(z=0; z<theForm.length;z++){
		if(theForm[z].name == 'initial_name') continue;
		if(theForm[z].name == 'website') continue;
		if(theForm[z].name.substring(0,7) == 'sponsor') continue;

		if((theForm[z].value == '')&&(theForm[z].type=='text')){ 
			alert('please fill '+theForm[z].name.replace('_',' ').toUpperCase());
			theForm[z].focus();
			return false;
		}
		if((theForm[z].value == '')&&(theForm[z].type=='textarea')){ 
			alert('please fill '+theForm[z].name.replace('_',' ').toUpperCase());
			theForm[z].focus();
			return false;
		}

	}
	return true;
}
function vldcredit(frm){
	if(frm.conference_name_on_card.value=='') {alert ('Please fill in Credit Card information');frm.conference_name_on_card.focus();return false; }
	if(frm.conference_card_number.value.length<16) {alert ('Please fill in Credit Card Number');frm.conference_card_number.focus();return false; }
	if(frm.conference_card_expire.value=='') {alert ('Please fill in Credit Card information');frm.conference_card_expire.focus(); return false; }
	if(frm.conference_card_cvs.value=='') {alert ('Please fill in Credit Card information');frm.conference_card_cvs.focus(); return false; }
	return true;
}
function randomPassword(length){
  chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
  pass = "";
  for(x=0;x<length;x++) {
    i = Math.floor(Math.random() * 62);
    pass += chars.charAt(i);
  }
  return pass;
}

