function getMore(identifier)
{
	var btn = $(identifier);
	var placholder = identifier + 'Placeholder';
	//var url = 'http://harvestmanagement.com.au/includes/'+identifier + '.inc';
	
	if(btn.src.indexOf('btn_more.jpg')> 0)
	{
		btn.src = "images/btn_close.jpg";
		/*var myAjax = new Ajax.Updater(
				{success: placholder}, 
				url, 
				{
					method: 'get', 
					onFailure: reportError
				});*/
		$(placholder).style.display="block";

	} 
	else
	{
		btn.src = "images/btn_more.jpg";
		$(placholder).style.display="none";

	} 
	return false;

	
}
function getArticle(identifier)
{
	var url = 'includes/'+identifier + '.inc';
	var myAjax = new Ajax.Updater(
			{success: 'placholder'}, 
			url, 
			{
				method: 'get', 
				onFailure: reportError
			});
	return false;
}



function reportError(request)
{
	return false;
}
function validateEmail()
{
	 var msg ='The following errors occured during validation:\n';
	 var validate = true;
	 var emailPat = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
     var emailid=document.getElementById("EmailBox_EmailHtmlInputText").value;
     var matchArray = emailid.match(emailPat);

     if (document.getElementById("EmailBox_NameHtmlInputText").value=="")
      {
                 msg += '- Name is a required field.\n';
                 
                 validate = false;
                 
      }
      if(document.getElementById("EmailBox_EmailHtmlInputText").value=="")
      {
                msg += '- Email Address is a required field.\n'
                
                validate = false;
                
      }
      else if(matchArray == null)
     {
               msg += '- Email address is invalid.\n'
              
                validate = false;
               
      }
  
    if(!validate)
    {
		alert(msg);
		return false;
    }
    return true;
}
function validatePhone()
{
 	 var msg ='The following errors occured during validation:\n';
	 var validate = true;
	
     if (document.getElementById("Phone2HtmlinputText").value=="")
      {
                 msg += '- Phone is a required field.\n';
                 document.getElementById("Phone2HtmlinputText").focus();
                 validate = false;
                 
      }
     if(!validate)
		{
			alert(msg);
			return false;
		}

      return true;


}
function validateEnquiries()
{
	 var msg ='The following errors occured during validation:\n';
	 var validate = true;
	 var emailPat = /(^[a-z]([a-z_\.]*)@([a-z_\.]*)([.][a-z]{3})$)|(^[a-z]([a-z_\.]*)@([a-z_\.]*)(\.[a-z]{3})(\.[a-z]{2})*$)/i;
     var emailid=document.getElementById("EmailHtmlinputText").value;
     var matchArray = emailid.match(emailPat);

     if (document.getElementById("NameHtmlinputText").value=="")
      {
                 msg += '- Name is a required field.\n';
                
                 validate = false;
                 
      }
     if (document.getElementById("CompanyHtmlinputText").value=="")
      {
                 msg += '- Company is a required field.\n';
                
                 validate = false;
                 
      }

      if(document.getElementById("EmailHtmlinputText").value=="")
      {
                msg += '- Email Address is a required field.\n'
              
                validate = false;
                
      }
      else if(matchArray == null)
     {
               msg += '- Email address is invalid.\n'
               
                validate = false;
               
      }
      if (document.getElementById("PhoneHtmlinputText").value=="")
      {
                 msg += '- Phone is a required field.\n';
                
                 validate = false;
                 
      }
      if (document.getElementById("MessageHtmlinputText").value=="")
      {

                 msg += '- Message is a required field.\n';
                
                 validate = false;
                 
      }


     
  
    if(!validate)
    {
		alert(msg);
		return false;
    }
    return true;}
function externaliseLinks() { 
	if (!document.getElementsByTagName) {	
		return;
	}

	var anchors = document.getElementsByTagName("a"); 
	for ( var i=0; i<anchors.length; i++ ) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank"; 
		}
	} 
} 
window.onload = externaliseLinks;
