


function checkOther(formObj)
{
	if(formObj.value == "Other"){
		$('howFoundOther').style.display = 'block';
	}else{
		$('howFoundOther').style.display = 'none';	
	}
}
function checkOther2(formObj)
{
	if(formObj.value == "Other"){
		$('interestOther').style.display = 'block';
	}else{
		$('interestOther').style.display = 'none';	
	}
}


function cdivOn(id)
{

	// <![CDATA[
	var ajax;
	var d = new Date()
	var t = d.getTime() 
		
		ajax =  new Ajax.Updater(
			 'tn_'+id,        		// DIV id must be declared before the method was called
			 'ajax_tertiaryMenu.php?id='+id+'&date='+t+'&ndate='+t,{method:'get',asynchronous:true});
		if(document.getElementById('tn_'+id)){	
			document.getElementById('tn_'+id).style.display = 'block';	
		}

	// ]]>
}
function cdivOn2(id, id2)
{
	// <![CDATA[
		
	var ajax;
	var d = new Date()
	var t = d.getTime() 
	
	ajax =  new Ajax.Updater(
		 'tn_'+id,        		// DIV id must be declared before the method was called
		 'ajax_tertiaryMenu.php?id='+id+'&date='+t+'&id2='+id2,{method:'get',asynchronous:true});
		
	if(document.getElementById('tn_'+id)){
		document.getElementById('tn_'+id).style.display = 'block';	
	}

	// ]]>
}




	function changeEvent(fObj, sDate)
	{
		// <![CDATA[
		//Effect.FadeIn('bookRight');
		var d = new Date()
		var t = d.getTime() 
		cat1Select = $('category1').options[$('category1').selectedIndex].value;
		cat2Select = $('category2').options[$('category2').selectedIndex].value;
		var ajax;
		
		ajax =  new Ajax.Updater(
			 'eventResults',        		// DIV id must be declared before the method was called
			 'ajax_eventResults.php?catid1='+cat1Select+'&catid2='+cat2Select+'&catid3='+fObj.value+'&sDate='+sDate,    // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		
		// ]]>
		
	}
	
	
	function changeCal(fObj, year, month)
	{
		// <![CDATA[
		//Effect.FadeIn('bookRight');
		
	
		var ajax;
		
		ajax =  new Ajax.Updater(
			 'cal',        		// DIV id must be declared before the method was called
			 'calendar_ajax.php?mainCat='+fObj.value+'&yearID='+year+'&monthID='+month,    // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		
		// ]]>
		
	}
	
	function changeCalAll(year, month)
	{
		// <![CDATA[
		//Effect.FadeIn('bookRight');
		
	
		var ajax;
		
		ajax =  new Ajax.Updater(
			 'cal',        		// DIV id must be declared before the method was called
			 'calendar_ajax.php?mainCat=&yearID='+year+'&monthID='+month,    // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		
		// ]]>
		
	}


function changeCat2(fObj, sectionId, sDate, mainCat)
	{
		// <![CDATA[
		//Effect.FadeIn('bookRight');
		var d = new Date()
		var t = d.getTime() 
		new Effect.Appear('cat2');
		var ajax, ajax2;
	 	ajax =  new Ajax.Updater(
			 'cat2',        		// DIV id must be declared before the method was called
			 'ajax_categories.php?catid1='+fObj.value+'&section='+sectionId+'&date='+t+'&sDate='+sDate+'&mainCat='+mainCat,    // URL
			 {method:'get', asynchronous:'true'});
		
		ajax2 =  new Ajax.Updater(
			 'eventResults',        		// DIV id must be declared before the method was called
			 'ajax_eventResults.php?catid1='+fObj.value+'&section='+sectionId+'&sDate='+sDate+'&mainCat='+mainCat+'&date='+t,    // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		
	
		new Effect.Fade('category3');
		// ]]>
		
		
	}
	
	function changeCat3(fObj, sectionId, sDate, mainCat)
	{
		// <![CDATA[
		//Effect.FadeIn('bookRight');
		
		cat1Select = $('category1').options[$('category1').selectedIndex].value;
		var ajax, ajax2;
		var d = new Date()
		var t = d.getTime() 
	 	ajax =  new Ajax.Updater(
			 'cat3',        		// DIV id must be declared before the method was called
			 'ajax_categories.php?catid1='+cat1Select+'&catid2='+fObj.value+'&section='+sectionId+'&date='+t+'&sDate='+sDate+'&mainCat='+mainCat,    // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		
		ajax2 =  new Ajax.Updater(
			 'eventResults',        		// DIV id must be declared before the method was called
			 'ajax_eventResults.php?catid1='+cat1Select+'&catid2='+fObj.value+'&section='+sectionId+'&sDate='+sDate+'&mainCat='+mainCat+'&date='+t,    // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		new Effect.Appear('cat3');
		// ]]>
		
	}
	
	function redirectPage(fObj){
		document.location.href='page.php?section=616&mId='+fObj.value;
	}
	
	
	
	function checkFeedback(theform)
	{
		fields = "";
		valid = true;
	
		
		
		if(theform.feedback_name.value == ""){
			fields += "You must enter your name.\n";
			valid = false;
		}
		if(theform.feedback_enquiry.value == ""){
			fields += "You must type an enquiry.\n";
			valid = false;
		}
		if(theform.feedback_email.value == ""){
			fields += "You must provide us with an email address.\n";
			valid = false;
		}
		
		if(theform.feedback_email.value.indexOf("@") == -1 || theform.feedback_email.value.indexOf(".") == -1){
			fields += "You must provide us with a valid email address.\n";
			valid = false;
		}
	
		if(theform.checkNumber.value == ""){
			fields += "You must enter the Check Number.\n";
			valid = false;
		}
		
			if(valid == false){
			message = "Please address the following issues\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			// <![CDATA[
		
			var ajax, ajax2;
			var d = new Date();
			var t = d.getTime(); 
			var validation = "false";
			new Ajax.Request('ajax_checkValidation.php?val='+theform.checkNumber.value+'&date='+t, {
			  method: 'get',evalScripts: true, asynchronous:'true',
			  onSuccess: function(transport) {
				var valErrror = $('validationError');
				if (transport.responseText != ''){
					//alert('incorrect');
				  validation = "false";		
				  valErrror.update('Validation incorrent. Please try again');
				}else{
					//alert('correct');
				  validation = "true";
				  theform.submit();
				  valErrror.update('<span style=\"color:#0A8326;\">Correct... please wait.</span>');
				}
			  }
			});
			// ]]>
			}
		return(false);
	}


	function checkContact(theform)
	{
		fields = "";
		valid = true;
	
		
		
		if(theform.feedback_name.value == ""){
			fields += "You must enter your name.\n";
			valid = false;
		}
		if(theform.feedback_message.value == ""){
			fields += "You must type a message.\n";
			valid = false;
		}
		if(theform.feedback_email.value == ""){
			fields += "You must provide us with an email address.\n";
			valid = false;
		}
		
		if(theform.feedback_email.value.indexOf("@") == -1 || theform.feedback_email.value.indexOf(".") == -1){
			fields += "You must provide us with a valid email address.\n";
			valid = false;
		}
	
		if(theform.checkNumber.value == ""){
			fields += "You must enter the Check Number.\n";
			valid = false;
		}
		
			if(valid == false){
			message = "Please address the following issues\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			// <![CDATA[
		
			var ajax, ajax2;
			var d = new Date();
			var t = d.getTime(); 
			var validation = "false";
			new Ajax.Request('ajax_checkValidation.php?val='+theform.checkNumber.value+'&date='+t, {
			  method: 'get',evalScripts: true, asynchronous:'true',
			  onSuccess: function(transport) {
				var valErrror = $('validationError');
				if (transport.responseText != ''){
					//alert('incorrect');
				  validation = "false";		
				  valErrror.update('Validation incorrent. Please try again');
				}else{
					//alert('correct');
				  validation = "true";
				  theform.submit();
				  valErrror.update('<span style=\"color:#0A8326;\">Correct... please wait.</span>');
				}
			  }
			});
			// ]]>
			}
		return(false);
	}

function checkOldScholar(theform)
	{
		fields = "";
		valid = true;
	
		
		
		if(theform.title.value == ""){
			fields += "You must enter your title.\n";
			valid = false;
		}
		if(theform.surname.value == ""){
			fields += "You must type a surname.\n";
			valid = false;
		}
		if(theform.firstname.value == ""){
			fields += "You must type a first name.\n";
			valid = false;
		}
		if(theform.currentAddress.value == ""){
			fields += "You must type a current address.\n";
			valid = false;
		}
		if(theform.mobile.value == ""){
			fields += "You must type a mobile.\n";
			valid = false;
		}
		if(theform.homePhone.value == ""){
			fields += "You must type a home phone.\n";
			valid = false;
		}
		if(theform.workPhone.value == ""){
			fields += "You must type a work phone.\n";
			valid = false;
		}
	
		if(theform.finalYear.value == ""){
			fields += "You must type a final year.\n";
			valid = false;
		}
		if(theform.newsPermission.value == ""){
			fields += "You must type a news permissions.\n";
			valid = false;
		}
		
		if(theform.email.value == ""){
			fields += "You must provide us with an email address.\n";
			valid = false;
		}
		
		if(theform.email.value.indexOf("@") == -1 || theform.email.value.indexOf(".") == -1){
			fields += "You must provide us with a valid email address.\n";
			valid = false;
		}
	
		if(theform.checkNumber.value == ""){
			fields += "You must enter the Check Number.\n";
			valid = false;
		}
		
			if(valid == false){
			message = "Please address the following issues\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			// <![CDATA[
		
			var ajax, ajax2;
			var d = new Date();
			var t = d.getTime(); 
			var validation = "false";
			new Ajax.Request('ajax_checkValidation.php?val='+theform.checkNumber.value+'&date='+t, {
			  method: 'get',evalScripts: true, asynchronous:'true',
			  onSuccess: function(transport) {
				var valErrror = $('validationError');
				if (transport.responseText != ''){
					//alert('incorrect');
				  validation = "false";		
				  valErrror.update('Validation incorrent. Please try again');
				}else{
					//alert('correct');
				  validation = "true";
				  theform.submit();
				  valErrror.update('<span style=\"color:#0A8326;\">Correct... please wait.</span>');
				}
			  }
			});
			// ]]>
			}
		return(false);
	}
	
	
	function checkTours(theform)
	{
		fields = "";
		valid = true;
	
		
		
		if(theform.title.value == ""){
			fields += "You must enter your title.\n";
			valid = false;
		}
		if(theform.surname.value == ""){
			fields += "You must enter a surname.\n";
			valid = false;
		}
		if(theform.firstname.value == ""){
			fields += "You must enter a first name.\n";
			valid = false;
		}
		if(theform.street.value == ""){
			fields += "You must enter a current address.\n";
			valid = false;
		}
		if(theform.suburb.value == ""){
			fields += "You must enter a current address.\n";
			valid = false;
		}
		if(theform.city.value == ""){
			fields += "You must enter a current address.\n";
			valid = false;
		}
		if(theform.state.value == ""){
			fields += "You must enter a current address.\n";
			valid = false;
		}
		if(theform.postcode.value == ""){
			fields += "You must enter a current address.\n";
			valid = false;
		}
		if(theform.country.value == ""){
			fields += "You must enter a current address.\n";
			valid = false;
		}
		
	
		if(theform.email.value == ""){
			fields += "You must provide us with an email address.\n";
			valid = false;
		}
		
		if(theform.email.value.indexOf("@") == -1 || theform.email.value.indexOf(".") == -1){
			fields += "You must provide us with a valid email address.\n";
			valid = false;
		}
	
		if(theform.checkNumber.value == ""){
			fields += "You must enter the Check Number.\n";
			valid = false;
		}
		
			if(valid == false){
			message = "Please address the following issues\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			// <![CDATA[
		
			var ajax, ajax2;
			var d = new Date();
			var t = d.getTime(); 
			var validation = "false";
			new Ajax.Request('ajax_checkValidation.php?val='+theform.checkNumber.value+'&date='+t, {
			  method: 'get',evalScripts: true, asynchronous:'true',
			  onSuccess: function(transport) {
				var valErrror = $('validationError');
				if (transport.responseText != ''){
					//alert('incorrect');
				  validation = "false";		
				  valErrror.update('Validation incorrent. Please try again');
				}else{
					//alert('correct');
				  validation = "true";
				  theform.submit();
				  valErrror.update('<span style=\"color:#0A8326;\">Correct... please wait.</span>');
				}
			  }
			});
			// ]]>
			}
		return(false);
	}



function checkEvents(theform)
{

		fields = "";
		valid = true;

		if(theform.ORGANISATION.value == ""){
			fields += "Oragnisation\n";
			valid = false;
		}
		if(theform.ABN.value == ""){
			fields += "ABN\n";
			valid = false;
		}
		if(theform.PERSON.value == ""){
			fields += "Person\n";
			valid = false;
		}
		if(theform.ADDRESS.value == ""){
			fields += "Address\n";
			valid = false;
		}
		if(theform.SUBURB.value == ""){
			fields += "Suburb\n";
			valid = false;
		}
		if(theform.STATE.value == ""){
			fields += "State\n";
			valid = false;
		}
		if(theform.POSTCODE.value == ""){
			fields += "Postcode\n";
			valid = false;
		}
		if(theform.PHONE.value == ""){
			fields += "Phone\n";
			valid = false;
		}
		if(theform.EMAIL.value == ""){
			fields += "Email\n";
			valid = false;
		}
		if(theform.CATEGORY.value == ""){
			fields += "Category\n";
			valid = false;
		}
		if(theform.checkNumber.value == ""){
			fields += "Check Number\n";
			valid = false;
		}

		if(valid == false){
			message = "Please fill in the following fields\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			return(true);
		}


}


function checkIndComp(theform)
{
		fields = "";
		valid = true;
		if(theform.SALUTATION.value == ""){
			fields += "First Name\n";
			valid = false;
		}
		if(theform.FIRSTNAME.value == ""){
			fields += "First Name\n";
			valid = false;
		}
		if(theform.SURNAME.value == ""){
			fields += "Surname\n";
			valid = false;
		}
		if(theform.ADDRESS.value == ""){
			fields += "Address\n";
			valid = false;
		}
		if(theform.SUBURB.value == ""){
			fields += "Suburb\n";
			valid = false;
		}
		if(theform.STATE.value == ""){
			fields += "State\n";
			valid = false;
		}
		if(theform.POSTCODE.value == ""){
			fields += "Postcode\n";
			valid = false;
		}
		if(theform.PHONE.value == ""){
			fields += "Phone\n";
			valid = false;
		}

		if(theform.EMAIL.value == ""){
			fields += "Email\n";
			valid = false;
		}
		if(theform.GIVEAWAY.value == ""){
			fields += "Giveaway Selection\n";
			valid = false;
		}
		if(theform.AGEBRACKET.value == ""){
			fields += "Age Bracket\n";
			valid = false;
		}
		if(theform.BOOKCLUB.value == ""){
			fields += "Book Club\n";
			valid = false;
		}
		if(theform.checkNumber.value == ""){
			fields += "Type Characters\n";
			valid = false;
		}

		if(valid == false){
			message = "Please fill in the following fields\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			return(true);
		}

}



function checkClubComp(theform)
{
		fields = "";
		valid = true;

		if(theform.CLUBNAME.value == ""){
			fields += "Club Name\n";
			valid = false;
		}
		if(theform.SALUTATION1.value == ""){
			fields += "Contact Person 1 Title\n";
			valid = false;
		}
		if(theform.FIRSTNAME1.value == ""){
			fields += "Contact Person 1 First Name\n";
			valid = false;
		}
		if(theform.SURNAME1.value == ""){
			fields += "Contact Person 1 Surname\n";
			valid = false;
		}
		if(theform.EMAIL1.value == ""){
			fields += "Contact Person 1 Email\n";
			valid = false;
		}

		if(theform.ADDRESS.value == ""){
			fields += "Address\n";
			valid = false;
		}
		if(theform.SUBURB.value == ""){
			fields += "Suburb\n";
			valid = false;
		}
		if(theform.STATE.value == ""){
			fields += "State\n";
			valid = false;
		}
		if(theform.POSTCODE.value == ""){
			fields += "Postcode\n";
			valid = false;
		}
		if(theform.PHONE.value == ""){
			fields += "Phone\n";
			valid = false;
		}
		if(theform.MEMBERS.value == ""){
			fields += "No of Members\n";
			valid = false;
		}
		if(theform.FREQUENCY.value == ""){
			fields += "Frequency of Meetings\n";
			valid = false;
		}
		if(theform.DAY.value == ""){
			fields += "Day of Meetings\n";
			valid = false;
		}
		if(theform.TIME.value == ""){
			fields += "Time of Meetings\n";
			valid = false;
		}
		if(theform.checkNumber.value == ""){
			fields += "Type Characters\n";
			valid = false;
		}


		if(valid == false){
			message = "Please fill in the following fields\n";
			message += "--------------------------------------\n";
			message += fields;
			alert(message);
			return(false);
		}else{
			return(true);
		}

}

    var imheight;	
	function periodicalUpdate() {
		
		Slideshow();
		
		new PeriodicalExecuter(fadeout, 9);
		//new PeriodicalExecuter(bookSlideshow, 10);
	}

	function fadeout(){
		// <![CDATA[
		//$('gallery').style.height = imHeight + 'px;'; 
		 new Effect.Fade('galleryInner', {duration: 1, fps: 50, afterFinish:Slideshow} );
		// ]]>
	}
	
	function Slideshow() {
		// <![CDATA[
		//Effect.FadeIn('bookRight');
		//$('gallery').style.height = '200px;';
		
		var ajax;
	 	ajax =  new Ajax.Updater(
			 'galleryInner',        // DIV id must be declared before the method was called
			 'ajax_gallery.php',    // URL
			 {method:'get', onSuccess:fadeIn});
		
		// ]]>
		//if($('galleryInner').innerHTML == 'none' || $('galleryInner').innerHTML == ''){
			//hideGallery();	
		//}
	}

	function hideGallery()
	{
		$('outerPhotoGallery').style.display = 'none';	
	}
	function fadeIn(){
		//alert($('galleryInner').innerHTML);
		
		 // <![CDATA[
	    timerID = setTimeout("getImageHeight()",100);				 
		Effect.Appear('galleryInner');
		
	}
	
	
	function getImageHeight()
	{	
		if(!$('galleryImage')){
			hideGallery();	
		}
		try{
			imheight = $('galleryImage').height;	 
			resizeGallery();
	
		}catch(err){
		}
	}
	
	function changeImage(src){
		document.getElementById('galleryImage').src = src;	
	}
	
	function resizeGallery(){
		// add the height for the comments under the photo.
		imheight = imheight + 37;
		d=document;
		n=navigator;
		nav=n.appVersion;
		nan=n.appName;
		nua=n.userAgent;
		
		if(nua.indexOf('MSIE')==-1){
			document.getElementById('gallery').morph({minHeight:imheight+'px'});
			document.getElementById('gallery').morph({height:imheight+'px'});
			//	
		}else{	
			new Effect.Morph('gallery',{style:'height:'+imheight+'px'}, {duration: 1});
		
		}
		
		
		//document.getElementById('gallery').morph({height:imheight+'px'});
		//document.getElementById('gallery').style.height = imheight + 'px'; 
		
	}
	
	function newsPager(startpos, sectionId)
	{
		// <![CDATA[
		var d = new Date();
		var t = d.getTime(); 
		var ajax;
	 	ajax =  new Ajax.Updater(
			 'news',        		// DIV id must be declared before the method was called
			 'ajax_news.php?start='+startpos+'&sectionId='+sectionId+'&time='+t,     // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		// ]]>
	}
	function eventsPager(startpos, sectionId, mainCat)
	{
		// <![CDATA[
		
		var ajax;
	 	ajax =  new Ajax.Updater(
			 'events',        		// DIV id must be declared before the method was called
			 'ajax_eventResults.php?start='+startpos+'&sectionId='+sectionId+'&mainCat='+mainCat,     // URL
			 {method:'get', asynchronous:'true', evalScripts: true});
		// ]]>
	}
	function fadeInDiv(divId){
		 // <![CDATA[
		Effect.Appear(divId);
		// ]]>
	}

	function toggleSellerInfo(id){
		if(document.getElementById("sellerInfo_"+id).style.display == "block"){
			document.getElementById("sellerInfo_"+id).style.display = "none";
		}else{
			document.getElementById("sellerInfo_"+id).style.display = "block";
		}

	}

	function toggleEventInfo(id){
		//alert(id);
		if(document.getElementById("eventInfo_"+id).style.display == "block"){
			document.getElementById("eventInfo_"+id).style.display = "none";
		}else{
			document.getElementById("eventInfo_"+id).style.display = "block";
		}

	}


	function toggleRadioInfo(id){
		//alert(id);
		if(document.getElementById("radioInfo_"+id).style.display == "block"){
			document.getElementById("radioInfo_"+id).style.display = "none";
		}else{
			document.getElementById("radioInfo_"+id).style.display = "block";
		}

	}


	function alphaToggle(obj){
		//alert(obj.style.color);
		if (navigator.appName == "Microsoft Internet Explorer"){
			if(obj.style.color != '#a80027'){
				obj.style.color = '#a80027';
			}else{
				obj.style.color = '#666666';
			}
		}else{
			if(obj.style.color != 'rgb(168, 0, 39)'){
				obj.style.color = '#a80027';
			}else{
				obj.style.color = '#666666';
			}
		}
	}
