var t;
function fixheight() { 
 var maxH = 0;
 var ids = ["content_main","content_right"];
 // find the highest column
 var firstDiv = document.getElementById(ids[0]); 
 var secondDiv = document.getElementById(ids[1]); 
  heightFirstDiv = firstDiv.offsetHeight;
  heightSecondDiv = secondDiv.offsetHeight;
  divHeight = 0;

  if(Number(heightFirstDiv) > Number(heightSecondDiv)){
	 divHeight = Number(heightFirstDiv);
	 secondDiv.style.height = Number(divHeight)+300+"px";
	// firstDiv.style.height = Number(divHeight)+"px";	
	
  }else{
	 divHeight = Number(heightSecondDiv);
	 firstDiv.style.height = Number(divHeight)+"px"; 
	 //secondDiv.style.height = Number(divHeight)+"px"; 
  }
  
 
 /*
  for (var i=0; i<ids.length; i++) {
  var d = document.getElementById(ids[i]); 
  
  d.style.height = ""; // important, set it to empty (mozilla, ie)
  if (d.offsetHeight > maxH) maxH = d.offsetHeight;
  
 }
 //alert(maxH);
 // set them all to be that height
 for (var i=0; i<ids.length; i++) {
  var d=document.getElementById(ids[i]);
  d.style.height = maxH+"px";
 }
}

 */
}

function HideContent(d) { 
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) { 
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}


function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}
//to validate an email address
function validEmail(obj)
	{
		var str=obj.value;
		var a;
		var len=str.length;
		var reg=new RegExp("@");
		var ind=str.search(reg);
		var c,d=0;
		var b=0;
		for(a=0;a<=str.length;a++)
		{
	
			if(str.charAt(a)=="@" || (str.charAt(a) == ' '))
			{
				b++;
			}
			
		}
	
		if(b>1)
			{
				alert("Email Address is not valid.");
				obj.focus();
				return false;
			}
		else
			{
				for(a=0;a<=str.length;a++)
				{
					if(str.charAt(a)==".")
					{
						d=a;
					}
				
				}
				if((ind>d)||(ind==-1)||(d==0)||(ind+1==d)||(d+1==len) )
				{
					alert ("Email Address is not valid.");
					obj.focus();
					return false;
				}
				else
				{
					return true;
				}
			}
		
						
	}//function end vaild enmail

function attendEvent(objFrm) {
	
if(trim(objFrm.fname.value) == "") {
		alert("You need to provide Name.");
		objFrm.fname.focus();
		return false;
}

if(objFrm.email.value == "" ) {
		alert("You need to provide Email Address.");
		objFrm.email.focus();
		return false;
} else if(validEmail(objFrm.email) == false) {

		return false;
}
	
/*if(trim(objFrm.address.value) == "") {
		alert("You need to provide Address.");
		objFrm.address.focus();
		return false;
}
if(trim(objFrm.city.value) == "") {
		alert("You need to provide Suburb/City.");
		objFrm.city.focus();
		return false;
}
if(trim(objFrm.postcode.value) == "") {
		alert("You need to provide Postcode.");
		objFrm.postcode.focus();
		return false;
}*/
if(trim(objFrm.no_people.value) == "") {
		alert("You need to provide No. of people attending the event.");
		objFrm.no_people.focus();
		return false;
}
}

// Forgot Password validation
function validateForgotPassword(objFrm) {

	if(objFrm.email.value == "" ) {
		alert("You need to provide Email Address.");
		objFrm.email.focus();
		return false;
	} else if(validEmail(objFrm.email) == false) {
	
			return false;
	}

}
// Contact form validations
function validateContactForm (objFrm) {
	
	if(trim(objFrm.contact_name.value) == "") {
		alert("You need to provide your Name.");
		objFrm.contact_name.focus();
		return false;
	}

	if(objFrm.email.value == "" ) {
		alert("You need to provide Email Address.");
		objFrm.email.focus();
		return false;
	} else if(validEmail(objFrm.email) == false) {
	
			return false;
	}
	
	if(trim(objFrm.contact_text.value) == "") {
		alert("You need to provide Message.");
		objFrm.contact_text.focus();
		return false;
	}
	
	if(trim(objFrm.captchacode.value) == "") {
		alert("You need to provide Security Codes.");
		objFrm.contact_text.focus();
		return false;
	}
}

// Code by Pragya Thakor
// Onload event for Modules Latest Events and Latest Jobs
function onload_func()
{
		//fixheight();
	if(	''+document.getElementById("lateseventnews_yes") != 'null' && ''+document.getElementById("lateseventnews_yes") != 'undefined') {
		rotater_news();
	}
	if(	''+document.getElementById("new_members") != 'null' && ''+document.getElementById("new_members") != 'undefined') {
		rotater();
	}
	
	if(	''+document.getElementById("latestmembernews_yes") != 'null' && ''+document.getElementById("latestmembernews_yes") != 'undefined') {
		rotater_member_news1();
	}
}

