function toggle(obj){
        var togglethis = document.getElementById(obj)
        if (togglethis.style.display == 'none') {
                togglethis.style.display = 'block'
                
        } else {
                togglethis.style.display = 'none'
        }
}

function brandtoggle(obj1,obj2){
        var brandfull = document.getElementById(obj1)
		var brandpart = document.getElementById(obj2)
		if (brandfull.style.display == 'none') {
			brandfull.style.display = 'block'
			brandpart.style.display = 'none'
        } else {
			brandfull.style.display = 'none'
			brandpart.style.display = 'block'
        }
}


var addLoadEvent = function(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {
					oldonload();
				}
				func();
			};
		}
	};
var brandproductlistresize=function() {
	if (document.getElementById('brandinfo')!=null){
		var divh = document.getElementById('brandinfo').offsetHeight;
		if (divh<320) {
			divh=320;
			document.getElementById('brandinfo').style.height = divh + "px";
			}
		var target = document.getElementById('brandproductlist');
		target.style.height = divh + "px";
		};
	};
addLoadEvent(brandproductlistresize);
var contactresize=function() {
	if (document.getElementById('contactform')!=null){
		var divh = document.getElementById('contactform').offsetHeight-16;
		var target1 = document.getElementById('contactsidebar');
		var target2 = document.getElementById('contactaddresses');
		target1.style.height = divh + "px";
		target2.style.height = divh + "px";
		};
	};
	
addLoadEvent(contactresize);
function checkformpromo()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.comp.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.comp.name.value == '') {
		document.comp.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	
	if (document.comp.surname.value == '') {
		document.comp.surname.style.backgroundColor = '#B9EEC0';
		missingfields +='Surname, ';
	}
	
	if (document.comp.position.value == '') {
		document.comp.position.style.backgroundColor = '#B9EEC0';
		missingfields +='Position, ';
	}
	
	if (document.comp.establishment.value == '') {
		document.comp.establishment.style.backgroundColor = '#B9EEC0';
		missingfields +='Establishment, ';
	}
	
	if (document.comp.address1.value == '') {
		document.comp.address1.style.backgroundColor = '#B9EEC0';
		missingfields +='Address, ';
	}
	
	if (document.comp.address2.value == '') {
		document.comp.address2.style.backgroundColor = '#B9EEC0';
		missingfields +='City/Town/Suburb, ';
	}
	
	if (document.comp.state.value == '') {
		document.comp.state.style.backgroundColor = '#B9EEC0';
		missingfields +='State, ';
	}
	
		if (document.comp.postcode.value == '') {
		document.comp.postcode.style.backgroundColor = '#B9EEC0';
		missingfields +='Postcode, ';
	}
	
	if (document.comp.quercus.value == '') {
		document.comp.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if (document.comp.phone.value == '') {
		document.comp.phone.style.backgroundColor = '#B9EEC0';
		missingfields +='Phone Number, ';
	}
	
	if (document.comp.competition.value == '') {
		document.comp.competition.style.backgroundColor = '#B9EEC0';
		missingfields +='Competition Answer, ';
	}
	
	if (document.comp.terms.checked !== true) {
		missingfields +='Terms and Conditions, ';
	}
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		alert('Please fill in the missing fields : '+missingfields+'.');
		returnvalue = false;
		}
		
	return returnvalue;
}

function checkformpromoptbac()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.comp.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.comp.name.value == '') {
		document.comp.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	
	if (document.comp.surname.value == '') {
		document.comp.surname.style.backgroundColor = '#B9EEC0';
		missingfields +='Surname, ';
	}
	
	if (document.comp.address1.value == '') {
		document.comp.address1.style.backgroundColor = '#B9EEC0';
		missingfields +='Address, ';
	}
	
	if (document.comp.address2.value == '') {
		document.comp.address2.style.backgroundColor = '#B9EEC0';
		missingfields +='City/Town/Suburb, ';
	}
	
	if (document.comp.state.value == '') {
		document.comp.state.style.backgroundColor = '#B9EEC0';
		missingfields +='State, ';
	}
	
	if (document.comp.postcode.value == '') {
		document.comp.postcode.style.backgroundColor = '#B9EEC0';
		missingfields +='Postcode, ';
	}
	
	if (document.comp.quercus.value == '') {
		document.comp.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if (document.comp.phone.value == '') {
		document.comp.phone.style.backgroundColor = '#B9EEC0';
		missingfields +='Phone Number, ';
	}
	
	if (document.comp.school.value == '') {
		document.comp.school.style.backgroundColor = '#B9EEC0';
		missingfields +='School/TAFE/Institution, ';
	}

	if (document.comp.referee.value == '') {
		document.comp.referee.style.backgroundColor = '#B9EEC0';
		missingfields +='Referee, ';
	}
	
	if (document.comp.refereecontact.value == '') {
		document.comp.refereecontact.style.backgroundColor = '#B9EEC0';
		missingfields +='Referee contact number, ';
	}
	
	if (document.comp.refereecontactemail.value == '') {
		document.comp.refereecontactemail.style.backgroundColor = '#B9EEC0';
		missingfields +='Referee contact email, ';
	}
	
	if (document.comp.statement.value == '') {
		document.comp.statement.style.backgroundColor = '#B9EEC0';
		missingfields +='Statement, ';
	}
	
	if (document.comp.recipe.value == '') {
		document.comp.recipe.style.backgroundColor = '#B9EEC0';
		missingfields +='Recipe, ';
	}
	
	if (document.comp.terms.checked !== true) {
		missingfields +='Terms and Conditions, ';
	}
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		alert('Please fill in the missing fields : '+missingfields+'.');
		returnvalue = false;
		}
		
	return returnvalue;
}



function checkformcontact()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.cont.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.cont.name.value == '') {
		document.cont.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	
	if (document.cont.surname.value == '') {
		document.cont.surname.style.backgroundColor = '#B9EEC0';
		missingfields +='Surname, ';
	}

	
	if (document.cont.quercus.value == '') {
		document.cont.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if ((document.cont.phone.value == '') && (document.cont.mobile.value == '')) {
		if (document.cont.phone.value == '') {
			 document.cont.phone.style.backgroundColor = '#B9EEC0';
		}
		if (document.cont.mobile.value == '') {
			 document.cont.mobile.style.backgroundColor = '#B9EEC0';
		}
		missingfields +='Phone or Mobile Number, ';
	}
	
	if (document.cont.message.value == '') {
		document.cont.message.style.backgroundColor = '#B9EEC0';
		missingfields +='Message, ';
	}
	
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		alert('Please fill in the missing fields : '+missingfields+'.');
		returnvalue = false;
		}
		
	return returnvalue;
}


function checkformregister()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.registration.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.registration.name.value == '') {
		document.registration.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	
	if (document.registration.business.value == '') {
		document.registration.business.style.backgroundColor = '#B9EEC0';
		missingfields +='Employer/Business/Organisation, ';
	}
	
	if (document.registration.address.value == '') {
		document.registration.address.style.backgroundColor = '#B9EEC0';
		missingfields +='Address, ';
	}

	
	if (document.registration.quercus.value == '') {
		document.registration.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if ((document.registration.phone.value == '') && (document.registration.mobile.value == '')) {
		if (document.registration.phone.value == '') {
			 document.registration.phone.style.backgroundColor = '#B9EEC0';
		}
		if (document.registration.mobile.value == '') {
			 document.registration.mobile.style.backgroundColor = '#B9EEC0';
		}
		missingfields +='Business Phone or Mobile Number, ';
	}
	
	if (document.registration.occupation.value == '') {
		document.registration.occupation.style.backgroundColor = '#B9EEC0';
		missingfields +='Occupation type, ';
	}
	
	if (document.registration.workplace.value == '') {
		document.registration.workplace.style.backgroundColor = '#B9EEC0';
		missingfields +='Workplace type, ';
	}
	
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		alert('Please fill in the missing fields : '+missingfields+'.');
		returnvalue = false;
		}
		
	return returnvalue;
}


function checkformpromofridgemagnet()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.competition.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.competition.name.value == '') {
		document.competition.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	if (document.competition.position.value == '') {
		document.competition.position.style.backgroundColor = '#B9EEC0';
		missingfields +='Position, ';
	}
	if (document.competition.establishment.value == '') {
		document.competition.establishment.style.backgroundColor = '#B9EEC0';
		missingfields +='Establishment, ';
	}
	
	if (document.competition.address.value == '') {
		document.competition.address.style.backgroundColor = '#B9EEC0';
		missingfields +='Address, ';
	}

	if (document.competition.postcode.value == '') {
		document.competition.postcode.style.backgroundColor = '#B9EEC0';
		missingfields +='Post Code, ';
	}	
	if (document.competition.quercus.value == '') {
		document.competition.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if (document.competition.phone.value == '') {
		document.competition.phone.style.backgroundColor = '#B9EEC0';
		missingfields +='Phone number, ';
	}
	if (!document.competition.tandc.checked) {
		document.competition.tandc.style.backgroundColor = '#B9EEC0';
		missingfields +='Accept Terms and Conditions, ';
	}
	if (document.competition.question.value == '') {
		document.competition.question.style.backgroundColor = '#B9EEC0';
		missingfields +='Promo Question, ';
	}
	
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	message = '';
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		message = 'Please fill in the missing fields : '+missingfields+'.';
		returnvalue = false;
		}
		
	if (document.competition.question) {
		var temp=document.competition.question.value.split(" ");
		if (temp.length>25){
			document.competition.question.style.backgroundColor = '#B9EEC0';
			message += " Please restrain your promotion answer to 25 words or less.";
			returnvalue = false;
		}
	}
	
	if (message != '') {
		alert(message);
	}
	return returnvalue;
}



function checkformshredmozzsample()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.promoform.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.promoform.name.value == '') {
		document.promoform.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	if (document.promoform.position.value == '') {
		document.promoform.position.style.backgroundColor = '#B9EEC0';
		missingfields +='Position, ';
	}
	if (document.promoform.establishment.value == '') {
		document.promoform.establishment.style.backgroundColor = '#B9EEC0';
		missingfields +='Establishment, ';
	}
	
	if (document.promoform.address.value == '') {
		document.promoform.address.style.backgroundColor = '#B9EEC0';
		missingfields +='Address, ';
	}

	if (document.promoform.postcode.value == '') {
		document.promoform.postcode.style.backgroundColor = '#B9EEC0';
		missingfields +='Post Code, ';
	}	
	if (document.promoform.quercus.value == '') {
		document.promoform.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if (document.promoform.phone.value == '') {
		document.promoform.phone.style.backgroundColor = '#B9EEC0';
		missingfields +='Phone number, ';
	}
	
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	message = '';
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		message = 'Please fill in the missing fields : '+missingfields+'.';
		returnvalue = false;
		}
	
	if (message != '') {
		alert(message);
	}
	return returnvalue;
}


function checkformpyb()
{
	var returnvalue = true;
	var missingfields = '';
	
	var i=0, Q = document.promoform.elements, L=Q.length;
	for (var a = 0; a < L; a++){
		var field = Q[a];
		if(field.value!=='' && (field.type=='text' || field.type=='textarea' || field.type=='select-one')){
			field.style.backgroundColor= 'white';
			++i;
		}
	}
	if (document.promoform.name.value == '') {
		document.promoform.name.style.backgroundColor = '#B9EEC0';
		missingfields +='Name, ';
	}
	if (document.promoform.position.value == '') {
		document.promoform.position.style.backgroundColor = '#B9EEC0';
		missingfields +='Position, ';
	}
	if (document.promoform.establishment.value == '') {
		document.promoform.establishment.style.backgroundColor = '#B9EEC0';
		missingfields +='Establishment, ';
	}
	
	if (document.promoform.address.value == '') {
		document.promoform.address.style.backgroundColor = '#B9EEC0';
		missingfields +='Address, ';
	}

	if (document.promoform.postcode.value == '') {
		document.promoform.postcode.style.backgroundColor = '#B9EEC0';
		missingfields +='Post Code, ';
	}	
	if (document.promoform.quercus.value == '') {
		document.promoform.quercus.style.backgroundColor = '#B9EEC0';
		missingfields +='Email, ';
	}
	
	if (document.promoform.phone.value == '') {
		document.promoform.phone.style.backgroundColor = '#B9EEC0';
		missingfields +='Phone number, ';
	}
	
	if (document.promoform.invoice.value == '') {
		document.promoform.invoice.style.backgroundColor = '#B9EEC0';
		missingfields +='Invoice number, ';
	}
	
	if (document.promoform.competition.value == '') {
		document.promoform.competition.style.backgroundColor = '#B9EEC0';
		missingfields +='Competition entry, ';
	}
	
	
	// If the script gets this far through all of your fields
	// without problems, it's ok and you can submit the form
	
	message = '';
	if (missingfields != '') {
		missingfields = missingfields.substr(0,(0,missingfields.length-2));
		message = 'Please fill in the missing fields : '+missingfields+'.';
		returnvalue = false;
		}
	
	if (message != '') {
		alert(message);
	}
	return returnvalue;
}
