function getTradeFile(url){
	GB_showFullScreen('Trade Image', url);		
}

function toggleNotes(id){
	Effect.toggle($('notes_'+id), 'blind', { duration: 0.3 } );		
}

function toggleImages(id){
	Effect.toggle($(id), 'blind', { duration: 0.3 } );		
}


function normal(obj){
	obj.style.backgroundImage ='url(images/interface/tr_bg.gif)';
	obj.style.backgroundColor = '#FFFFFF';
}

function hover(obj){
	obj.style.backgroundImage = 'none';
	obj.style.backgroundColor = '#DDCDD0';
}


function showCloseUp(pic, divid, wineId){
	//new Effect.Appear('hover_'+wineId);	
	
	$('hover_'+wineId).style.display = 'block';
	//document.getElementById('hover_'+wineId).style.display = 'block';	
	document.getElementById(divid).innerHTML = "<img src='siteFiles/images/"+pic+"' />";	
}
function hideCloseUp(wineId){
	//new Effect.Fade('hover_'+wineId);
	$('hover_'+wineId).style.display = 'none';
	//document.getElementById('hover_'+wineId).style.display = 'none';	
}

function showReview()
{
	document.getElementById('reviewBlock').style.display = 'block';	
}

function homePreview(url)
{
	//gb_page_center[640, 480]('Video', url);
	GB_show(' ', url, 480,640);
}

function showCart(stage, stageHide)
{
	$(stageHide).style.display = 'none';
	$(stage).style.display = 'none';	
}


function fillShipping()
{
	if(document.product2.useprev.checked == true){
		document.product2.FIRSTNAMESHIP.value = document.product2.FIRSTNAME.value;
		document.product2.SURNAMESHIP.value = document.product2.SURNAME.value;
		document.product2.EMAILSHIP.value = document.product2.EMAIL.value;
		document.product2.STREETSHIP.value = document.product2.STREET.value;
		document.product2.SUBURBSHIP.value = document.product2.SUBURB.value;
		document.product2.STATESHIP.value = document.product2.STATE.value;
		document.product2.POSTCODESHIP.value = document.product2.POSTCODE.value;
		document.product2.COUNTRYSHIP.value = document.product2.COUNTRY.value;
		document.product2.CONTACTPHONESHIP.value = document.product2.CONTACTPHONE.value;
	}else{
		document.product2.FIRSTNAMESHIP.value = "";
		document.product2.SURNAMESHIP.value = "";
		document.product2.EMAILSHIP.value = "";
		document.product2.STREETSHIP.value = "";
		document.product2.SUBURBSHIP.value = "";
		document.product2.STATESHIP.value = "";
		document.product2.POSTCODESHIP.value = "";
		document.product2.COUNTRYSHIP.value = "";
		document.product2.CONTACTPHONESHIP.value = "";
	}
}

function checkSubscribe(theform)
{
	fields = "";
	valid = true;
	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(valid == false){
		message = "Please fill in the following fields\n";
		message += "--------------------------------------\n";
		message += fields;
		alert(message);
		return(false);
	}else{
		alert("Waiting for promotions manager");
		//return(true);
	}
	
	
}

function checkCart2(theform)
{
	fields = "";
	valid = true;
	
/*	if(theform.CARDTYPE.value == ""){
		fields += "You must select a Credit Card Type.\n";
		valid = false;
	}
	if(theform.CARDNO.value == ""){
		fields += "You must enter your Credit Card Number.\n";
		valid = false;
	}
	if(theform.MONTHEXPIRY.value == ""){
		fields += "You must enter your Credit Card Expiry Month.\n";
		valid = false;
	}
	if(theform.YEAREXPIRY.value == ""){
		fields += "You must enter your Credit Card Expiry Year.\n";
		valid = false;
	}
	if(theform.CARDHOLDER.value == ""){
		fields += "You must enter the Card Holder.\n";
		valid = false;
	}
*/	
	if(theform.FIRSTNAME.value == ""){
		fields += "You must enter your First Name.\n";
		valid = false;
	}
	if(theform.SURNAME.value == ""){
		fields += "You must enter your Surname.\n";
		valid = false;
	}
	if(theform.STREET.value == ""){
		fields += "You must enter your Street Address.\n";
		valid = false;
	}
	if(theform.SUBURB.value == ""){
		fields += "You must enter a Suburb.\n";
		valid = false;
	}
	if(theform.STATE.value == ""){
		fields += "You must enter a State.\n";
		valid = false;
	}
	if(theform.POSTCODE.value == ""){
		fields += "You must enter a Postcode.\n";
		valid = false;
	}
	if(theform.COUNTRY.value == ""){
		fields += "You must select a Country.\n";
		valid = false;
	}
	if(theform.CONTACTPHONE.value == ""){
		fields += "You must select a Contact Phone.\n";
		valid = false;
	}
	
	if(theform.EMAIL.value == ""){
		fields += "You must enter your 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.FIRSTNAMESHIP.value == ""){
		fields += "You must enter your First Name(shippping).\n";
		valid = false;
	}
	if(theform.SURNAMESHIP.value == ""){
		fields += "You must enter your Surname(shippping).\n";
		valid = false;
	}
	if(theform.STREETSHIP.value == ""){
		fields += "You must enter your Street Address(shippping).\n";
		valid = false;
	}
	if(theform.SUBURBSHIP.value == ""){
		fields += "You must enter a Suburb(shippping).\n";
		valid = false;
	}
	if(theform.STATESHIP.value == ""){
		fields += "You must enter a State(shippping).\n";
		valid = false;
	}
	if(theform.POSTCODESHIP.value == ""){
		fields += "You must enter a Postcode(shippping).\n";
		valid = false;
	}
	if(theform.COUNTRYSHIP.value == ""){
		fields += "You must select a Country(shippping).\n";
		valid = false;
	}
	if(theform.CONTACTPHONESHIP.value == ""){
		fields += "You must select a Contact Phone(shippping).\n";
		valid = false;
	}
	
	if(theform.EMAILSHIP.value == ""){
		fields += "You must enter your Email address(shippping).\n";
		valid = false;
	}
	
	if(theform.EMAILSHIP.value.indexOf("@") == -1 || theform.EMAILSHIP.value.indexOf(".") == -1){
		fields += "You must provide us with a valid Email address(shippping).\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 checkCart1(formObj)
{
	var totalProducts = $('totalProducts').value;	
	var grandTotal = 0; 	
	for(i=0;i<totalProducts;i++){
		if($('qty_'+i).value != ""){
			grandTotal += parseInt($('qty_'+i).value);	
		}
	}
	if(grandTotal % 12 == 0){
		return(true);	
	}else{
		alert("You must purchase in multiples of 12, please adjust the quantity");
		return(false);	
	}
}



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 formatNumber(myVal){
		tmpVal = Math.round((myVal - Math.floor(myVal))*100)
		if (tmpVal<10){
			tmpVal = "0" + tmpVal
		}
		return Math.floor(myVal)+"."+tmpVal
	}


function updateSubTotal(id)
{
	var totalProducts = $('totalProducts').value;	
	var grandTotal = 0;
	$('total_'+id).value = formatNumber($('qty_'+id).value * $('price_'+id).value);  	
	for(i=0;i<totalProducts;i++){
		if($('total_'+i).value != "" && $('total_'+i).value != "0.00"){
			grandTotal += parseFloat($('total_'+i).value);	
			
		}
	}
	
	
	$('Amount').value = formatNumber(grandTotal);
	$('grandTotal').value = formatNumber(grandTotal);
}


function checkReview(theform)
	{
		
		fields = "";
		valid = true;
	
		
		
		if(theform.author.value == ""){
			fields += "You must enter your name.\n";
			valid = false;
		}
		if(theform.review.value == ""){
			fields += "You must type a review.\n";
			valid = false;
		}
		if(theform.wine.value == ""){
			fields += "You must select a wine.\n";
			valid = false;
		}
		if(theform.rating.value == ""){
			fields += "You must select a rating for this wine.\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 checkNewsletter(theform)
	{
		
		fields = "";
		valid = true;
	
		
		
		if(theform.name.value == ""){
			fields += "You must enter your name.\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.street.value == ""){
			fields += "You must enter your Street Address.\n";
			valid = false;
		}
		if(theform.suburb.value == ""){
			fields += "You must enter your Suburb.\n";
			valid = false;
		}
		if(theform.state.value == ""){
			fields += "You must enter your State.\n";
			valid = false;
		}
		if(theform.postcode.value == ""){
			fields += "You must enter your Postcode.\n";
			valid = false;
		}
		if(theform.country.value == ""){
			fields += "You must enter your Country.\n";
			valid = false;
		}
		if(theform.phone.value == ""){
			fields += "You must enter your Phone.\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, 6);
		//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_quoteGallery.php',    // URL
			 {method:'get', onSuccess:fadeIn});
		
		// ]]>
		//if($('galleryInner').innerHTML == 'none' || $('galleryInner').innerHTML == ''){
			//hideGallery();	
		//}
	}

	function hideGallery()
	{
		$('outerPhotoGallery').style.display = 'none';	
	}
	function fadeIn(){
		
	
		  //<![CDATA[
	   // timerID = setTimeout("getImageHeight()",100);				 
		
		//Effect.Appear('galleryImage', { duration: 1.0 });
		
		
		Effect.Appear('galleryInner', { duration: 1.0 });
		// ]]>
	}
	
	
	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+'&section='+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';
			}
		}
	}
	
	function isNumberKey(evt)
	{
	 var charCode = (evt.which) ? evt.which : event.keyCode
	 if (charCode > 31 && (charCode < 48 || charCode > 57))
		return false;
	
	 return true;
	}

