// JavaScript Document
ddaccordion.init({
	headerclass: "sendurl", //Shared CSS class name of headers group that are expandable
	contentclass: "mailform", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover
	//mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	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
	animatedefault: true, //Should contents open by default be animated into view?
	persiststate: false, //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, isclicked){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

// Send URL Validations

function val_sendurl()
{
	
if(isEmpty(document.getElementById('sender_name'),"Please enter your Name!")==false)
  {
	document.getElementById('sender_name').select();
	document.getElementById('sender_name').focus();
	return false;
  }
 
 if(isAlpha1(document.getElementById('sender_name').value)==false)
  {
   alert("Your Name must contain only alphabets!")
   document.getElementById('sender_name').select();
   document.getElementById('sender_name').value="";
   document.getElementById('sender_name').focus();
	return false;
  }		
     if(echeck(document.getElementById('sender_mail').value)==false)
 {
			document.getElementById('sender_mail').select();
			document.getElementById('sender_mail').focus();
			return false;
 }	 
     if(validateMultipleEmailsCommaSeparated(document.getElementById('friend_mail').value)==false)
  {
	document.getElementById('friend_mail').select();
	//document.getElementById('friend_mail').value="";
	document.getElementById('friend_mail').focus();
	return false;
  }
 if(isEmpty(document.getElementById('code'),"Please enter Security Code!")==false)
 {
			document.getElementById('code').select();
			document.getElementById('code').focus();
			return false;
 }	
}

function validateMultipleEmailsCommaSeparated(value) {
	if (value=='')
			{
			alert("Please enter at least one Friend's Email Address!")
			return false;
			}
var result = value.split(",");
for(var i = 0;i < result.length;i++)
if(!validateEmail(result[i])){
	alert("Please enter a valid Email Address!")
return false;
}
return true;
}

