function getSelect(id) {
	var sdiv = document.getElementById("sdatecontain"+id+"");
	var selectedval = document.getElementById("sloc"+id+"").value;
	if (selectedval == '' || selectedval == '0') {
		sdiv.style.display = "none";
	} else {
		sdiv.style.display = "";
		var sdate = document.getElementById("seminardate"+id+"");
		open_url("seminar_ajax.php?type=seminar&id="+selectedval+"&shopid="+id+"","sdatecontain"+id+"");
	} 

}

function attendSelect(obj) {
	var selval = obj.value;
	var arrcount = document.getElementById("partcount").value;
	
	// if only,do not show dropdown
	
		if (selval =='yes') {		
			if (arrcount <= 1) {
				var partval = document.getElementById("partval");				
				moveDetails(partval);				
			} else {
				document.getElementById("selectd").style.display = "block";
			}
			
		} else {
			if (arrcount <= 1) {
				clearParticipants();
			} else {
				clearParticipants();
				document.getElementById("selectd").style.display = "none";
			}
			
		} 
	
}

function moveDetails(obj) {
	var dropval = obj.value;
	var contactname = document.getElementById("Contact_Name").value;
	var occupation = document.getElementById("Occupation").value;
	var occupationtxt = document.getElementById("OccupationText").value;
	var email = document.getElementById("Email").value;
	var phone = document.getElementById("Phone").value;
	var mobile = document.getElementById("Mobile").value;
	
	if (dropval) {
		if (contactname) {
		document.getElementById("ParticipantName_"+dropval).value = contactname;
		}
		if (occupation) {
			if (occupation=='0') {
				document.getElementById("ParticipantOccupation_"+dropval).value = occupation;		
				document.getElementById("occupationcontainer"+dropval).style.display = 'block' ;			
				document.getElementById("ParticipantOccupationText_"+dropval).value = occupationtxt;		
			} else {
				document.getElementById("ParticipantOccupation_"+dropval).value = occupation;	
			}
		}
		
		if (email) {
		document.getElementById("ParticipantEmail_"+dropval).value = email;		
		}
		if (phone) {
		document.getElementById("ParticipantPhone_"+dropval).value = phone;		
		}	
		if (mobile) {
		document.getElementById("ParticipantMobile_"+dropval).value = mobile;		
		}		
	} else {
		clearParticipants();		
	}
}


function checkOccupation(occval,num){
	
	if (occval=='0') {
	document.getElementById("occupationcontainer"+num).style.display = 'block' ;		
	} else {
	document.getElementById("occupationcontainer"+num).style.display = 'none' ;			
	}

}
function clearParticipants() {
		oTextBoxes = new Array();
		oInputs = document.getElementsByTagName( 'input' );
		//loop through textboxes, create array
		for ( i = 0; i < oInputs.length; i++ ) { 
			if ( oInputs[i].name.slice(0,11) == 'Participant' ) {
				oTextBoxes.push( oInputs[i] ); 
			}
		}
		//loop through array, remove values from textboxes
		for ( i = 0; i < oTextBoxes.length; i++ ) {
			oTextBoxes[i].value = "";
		}
}
