	function api_rotateImages(containerid,timeout,adFirst){
		//console.log('[api_rotateImages] Assign ad container as : ' + containerid);
		var widgetContainer = document.getElementById(containerid);
		var adContainers = widgetContainer.getElementsByTagName('div');
		//console.log('[api_rotateImages] Number of ads to loop trough : '+adContainers.length);
		if(adContainers.length == 1){
			adContainers[0].style.display = 'block';
		}else{
			for (i = 0; i < adContainers.length; i++) {
				//If any element but not last			
				if(adContainers[i].style.display == 'none' && adFirst==true){ 
					adFirst = false;
					adContainers[i].style.display = 'block';
					adContainers[adContainers.length-1].style.display = 'none';
					break;
				}
				if(adContainers[i].style.display == 'block' && i!=adContainers.length-1 && adFirst==false){ 
					adFirst = false;
					adContainers[i].style.display = 'none';
					adContainers[i+1].style.display = 'block';
					break;
				}
				if(adContainers[i].style.display == 'block' && i==adContainers.length-1 && adFirst==false){
					adFirst = false;
					adContainers[i].style.display = 'none';
					adContainers[0].style.display = 'block';
					break;
				}
			}
			//console.log('api_rotateImages("'+containerid+'","'+timeout+'","'+adFirst+'")');
			setTimeout("api_rotateImages('"+containerid+"',"+timeout+","+adFirst+")", timeout);
		}
		
		
	}
	function api_newContactForm(){
		
		var people = document.getElementsByName('people');
		var container = document.getElementById('people_container');		
		var html = '';
		var index = people.length+1;
		var newContainer = document.createElement('div');
		
		html += '<fieldset name="people" id=1 style="border:0; border-top:2px solid orange;margin-top:10px;">';
		html += '<legend style="width:100%;float:right;text-align:right;font-size:8pt;"><a href="#people" onClick="api_removeContactForm(this);">[delete]</a></legend>';
		html += '<div id="people" class="form-col">';
		html += '<label id="name_'+index+'">First name:<span class="required">Required field</span></label>';
		html += '<input type="text" value="" name="conf[extra][people]['+index+'][Name]" />';
		html += '<label id="email_'+index+'">Email:<span class="required">Required field</span></label>';
		html += '<input type="text" value="" name="conf[extra][people]['+index+'][Email]" />';
		html += '<label id="surname_'+index+'">Contact Number:<span class="required">Required field</span></label>';
		html += '<input type="text" value="" name="conf[extra][people]['+index+'][Contact Number]" />';
		html += '</div> <!-- end .form-col -->';
		html += '<div id="people" class="form-col">';
		html += '<label id="surname_'+index+'">Surname:<span class="required">Required field</span></label>';
		html += '<input type="text" value="" name="conf[extra][people]['+index+'][Surname]" />';
		html += '<label id="position_'+index+'">Position:<span class="required">Required field</span></label>';
		html += '<input type="text" value="" name="conf[extra][people]['+index+'][Position]" />';
		html += '<label id="display_'+index+'">Display in online listing:</label>';
		html += '<input type="checkbox" value="1" checked name="conf[extra][people]['+index+'][Display]" />';
		html += '</div> <!-- end .form-col -->';
		html += '</fieldset>';
		
		newContainer.innerHTML = html;
		container.appendChild(newContainer);
		
		return true;
	}
	function api_removeContactForm(element){
	 var container = element.parentNode.parentNode;
	 var parent = container.parentNode; 
	 
	
	 if(parent){
		 container.innerHTML = '';
		 parent.removeChild(container);
	 }
		
	}
	function api_removeParent(element){
	 var container = element.parentNode;
	 var parent = container.parentNode; 
	 
	 if(parent){
		 container.innerHTML = '';
		 parent.removeChild(container);
	 }
		
	}
	function addAttendee(fullname, email, tel, company, industry, country) {
		var f = document.getElementById("form-inner");
		var person = document.createElement("div");
		person.className = "formCol";

		person.innerHTML = "<label>Full Name <span class=\"required\">Required field</span></label>" +
		"<input value=\""+fullname+"\" id=\"attendee_name_"+attendeeCnt+"\" name=\"conf[full_name][]\" type=\"text\" />" +

		"<label>Attendee Email Address <span class=\"required\">Required field</span></label>" +
		"<input value=\""+email+"\" id=\"attendee_email_"+attendeeCnt+"\" name=\"conf[email][]\" type=\"text\" />" +

		"<label>Contact Number <span class=\"required\">Required field</span></label>" +
		"<input value=\""+tel+"\" id=\"attendee_tel_"+attendeeCnt+"\" name=\"conf[tel][]\" type=\"text\" />" +
		"<span style=\"font-size:10px;\">Please include your international dialing code</span>" +

		"<label>Company <span class=\"required\">Required field</span></label>" +
		"<input value=\""+company+"\" id=\"attendee_company_"+attendeeCnt+"\" name=\"conf[company][]\" type=\"text\" />" +

		"<label>Industry <span class=\"required\">Required field</span></label>"+industry+
		"<label>Country <span class=\"required\">Required field</span></label>" +country+

		"<label>Industries looking to network with</label>" +
		"<textarea id=\"attendee_network_"+attendeeCnt+"\" name=\"conf[network][]\"></textarea>" +

		"<label>Reveal contact data to other attendees "+
		"<a href=\"#\" onmouseover=\"return tooltip(\'One of the key benefits of this event is advance networking. All attendees who allow their contact details to be revealed will be able to check back and see who is attending this event, and contact each other directly\', \'\', \'fontsize:12\');\" onmouseout=\"return hideTip();\" onClick=\"return false;\">whats this?</a>" +
		"</label>" +
		"<input style=\"width:20px;\" value=\"1\" id=\"attendee_reveal_"+attendeeCnt+"\" name=\"conf[reveal][]\" type=\"checkbox\" />" +

		"<div class=\"line\"></div>";

		f.appendChild(person);

		if(industry) {
			document.getElementById("attendee_industry_"+attendeeCnt).value = industry;
		}
		if(!country) {
			country = 202; //south africa
		}
		document.getElementById("attendee_country_"+attendeeCnt).value = country;

		attendeeCnt++;

		//document.getElementById("submit").style.display = "inline";
	}	
	function checkSignupForm() {
					var one = false; //check if there is at least 1 valid attendee
					for(var i=0; i<attendeeCnt; i++) {
						//if any fields filled in, they must be validated
						if(document.getElementById("attendee_name_"+i).value || document.getElementById("attendee_email_"+i).value || document.getElementById("attendee_tel_"+i).value || document.getElementById("attendee_company_"+i).value) {
							if(!document.getElementById("attendee_name_"+i).value) {
								alert("Please capture all Attendee\'s Full Names");
								document.getElementById("attendee_name_"+i).focus();
								return false;
							}
							
							if(!is_valid_email(document.getElementById("attendee_email_"+i).value)) {
								alert("Please capture valid Email Addresses for all Attendee\'s");
								document.getElementById("attendee_email_"+i).focus();
								return false;
							}
							
							if(!document.getElementById("attendee_tel_"+i).value) {
								alert("Please capture all Attendee\'s Contact Numbers");
								document.getElementById("attendee_tel_"+i).focus();
								return false;
							}
							
							if(!document.getElementById("attendee_company_"+i).value) {
								alert("Please capture all Attendee\'s Company Names");
								document.getElementById("attendee_company_"+i).focus();
								return false;
							}

							if(!document.getElementById("attendee_industry_"+i).value) {
								alert("Please capture all Attendee\'s Current Industry");
								document.getElementById("attendee_industry_"+i).focus();
								return false;
							}

							if(!document.getElementById("attendee_country_"+i).value) {
								alert("Please capture all Attendee\'s Country Details");
								document.getElementById("attendee_country_"+i).focus();
								return false;
							}
							
							one = true; //yip, at least 1 person validated all details
						}
					}
					
					if(one) {
						return true;
					}else{
						alert("Please enter the details of at least 1 attendee.");
						return false;
					}
				}
