ddaccordion.init({
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal", //speed of animation: "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

/* validation functions */
function SubmitCheckBlogPost(){
  if (document.myform.bName.value==""){
    alert("Your name is required.");
    document.myform.bName.focus();
    return false;
  }
  if (document.myform.bCategory.value==999){
    alert("Please select a category");
    document.myform.bCategory.focus();
    return false;
  } 

  if (!emailValidate2('myform','bEmail'))
  {
    document.myform.bEmail.focus();
    return false;
  }

  if (document.myform.bTitle.value==""){
    alert("Please provide text for the blog title.");
    document.myform.bTitle.focus();
    return false;
  }  
  /*
  if (document.myform.bDescription.value==""){
    alert("Please provide the blog description.");
    document.myform.bDescription.focus();
    return false;
  } 
  */
}

function validateGV() {
if (document.frmcontinue.email.value!="") {
  if (!emailValidate2('frmcontinue','email'))
  {
    document.frmcontinue.email.focus();
    return false;
  }
}
}

function SubmitCheckBlogPostComment(){
  if (document.myform.bName.value==""){
    alert("Your name is required.");
    document.myform.bName.focus();
    return false;
  }
  if (!emailValidate2('myform','bEmail'))
  {
    document.myform.bEmail.focus();
    return false;
  }
  
  /*
  if (document.myform.bDescription.value==""){
    alert("Please provide the blog description.");
    document.myform.bDescription.focus();
    return false;
  } 
  */
}

function emailValidate2(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
	  alert('Please provide a valid email address');	   
      return false;
   } else {
		return true;   
   }
}

function toggleCommentsForm() {
	var a = document.getElementById('sec_comment').style.display;
	//alert(a);
	if (a == "none") {
		document.getElementById('sec_comment').style.display = 'block';
		location.href = "#comm_sec";
	} else {
		document.getElementById('sec_comment').style.display = 'none';
	}
		
}

/* gift vouchers */
function changeGVVal(GVVal) {
	if (GVVal=="-1") {
		document.getElementById('GVVal').innerHTML = "";	
	} else {
		document.getElementById('GVVal').innerHTML = GVVal;
	}
}
function changeGVName(GVName) {
	document.getElementById('GVName').innerHTML = GVName;
}

/* pickup location drop down */
function dispPickupLocations(MethodId,DIVContainerShow, DIVContainerHide) {
	//alert(MethodId);	
	if (MethodId==0) {
	document.getElementById(DIVContainerShow).style.display = 'block';
	document.getElementById(DIVContainerHide).style.display = 'none';	
	} else if (MethodId==999999) {
	document.getElementById(DIVContainerShow).style.display = 'none';
	document.getElementById(DIVContainerHide).style.display = 'none';	
		
	} else {
	document.getElementById(DIVContainerShow).style.display = 'none';
	document.getElementById(DIVContainerHide).style.display = 'block';	
	}
}



function SubmitCheckContactUs(){

  if (document.myform.tFName.value==""){
    alert("Your name is required.");
    document.myform.tFName.focus();
    return false;
  }
  if (!emailValidate2('myform','tEmail'))
  {
    document.myform.tEmail.focus();
    return false;
  }
  if (document.myform.tComment.value==""){
    alert("Your comment/inquiry is required.");
    document.myform.tComment.focus();
    return false;
  }  

}


function SubmitCheckTestimonial(){

  if (document.myform.tFName.value==""){
    alert("Your name is required.");
    document.myform.tFName.focus();
    return false;
  }
  if (!emailValidate2('myform','tEmail'))
  {
    document.myform.tEmail.focus();
    return false;
  }
  if (document.myform.tComment.value==""){
    alert("Your testimonial is required.");
    document.myform.tComment.focus();
    return false;
  }  

}