// <body onLoad="initPage();">
function initPage() {

	// disable right click
   	setRightClick();

}

// Places Copyright note at the bottom of the page
function showCopy() {
		
document.writeln('\&copy; Alternative Practitioner Academy<br>');
document.writeln('        Elgin IL, USA.<br>');
// document.writeln('  www.APAClasses.com </p>');
}

var message ="\n      © Copyright by Alternative Practitioner Academy. All Rights Reserved.\n\nMaterial on this website is Copyrighted and may not be used without permission.       \n";
function click(e) {
  if (document.all) {
    if (event.button == 2) {
      alert(message);
      return false;
    }
  }
  if(document.layers) {
    if (e.which == 3) {
     alert(message);
     return false;
     }
    }
} 

if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
}

function setRightClick() {
document.onmousedown=click;
}

function showNavLinksBtm()

{
   // document.writeln('<a href="http://www.apaclasses.com/privacy.html" target="_blank" class="navlnk">Privacy Policy</a>  | ');
   
   document.writeln('<a href="http://www.apaclasses.com/about.html" class="navlnk">About APA</a>  | ');
 
   document.writeln('<a href="http://www.apaclasses.com/contact.html" class="navlnk">Contact Us</a>   <br>');   
     
}



// Validates email address
function checkEmail(email)
{
    var firstchunk,indx,secondchunk

    if (email == ""){
        alert("Please make sure you have entered a valid email before submitting the info.")

        return false
    }

    //get the zero-based index of the "@" character
    indx = email.indexOf("@")

    //if the string does not contain an @ then then return true
    if (indx == -1 ){

        alert("Please make sure you have entered a valid email before submitting the info.")

        return false
    }

    //if the first part of email is < 2 chars and second part < 7 chars
    //(arbitrary but workable criteria) then reject the input address

    firstchunk = email.substr(0,indx) //up to but not including the "@"

    //start at char following the "@" and include up to end of email addr
    secondchunk = email.substr(indx + 1) 

    //if the part  following the "@" does not include a period "." then
    //also return false
    if ((firstchunk.length < 2 ) || (secondchunk.length < 7) ||
    (secondchunk.indexOf(".") == -1)){ 

    alert("Please make sure you have entered a valid email before submitting the info.")

    return false
}

//the email was okay; at least it had a @, more than 1 username chars,
//more than 6 chars after the "@", and the substring after the "@"
// contained a "." char

return true

}

function setForm(frm){
	
	var canSubmit = checkEmail(frm.Email1.value);
	
	if (canSubmit){
		frm.ARThankyouURL.value = "http://www.apatraining.com/current.php";
		frm.field2.value = window.location;
		return true;	
	}
	else {return false;}
	
}

// Sets autoresponder value
function getDAR(srt){
	
	if (srt=='Hypnotherapy 101')
    	{
			return '216069';
		}
		
	else if (srt=='Hypnotherapy 102')
		{
			return'216070';
		}
	else if (srt=='Hypnotherapy 103')
		{
			return '216071';
		}
	else if (srt=='Hypnotherapy Intens.')
		{
			return '216072';
		}
	else if (srt=='Internet Marketing')
		{
			return '2160678';
		}

	else
		{
			alert('Please Select Class from the drop-down list box');
   			return '';
	 	}
}

// Sets redirect URL
function getURL(srt){
		
	if (srt=='Hypnotherapy 101')
    	{
			return 'http://www.apaclasses.com/hypnotherapy/hypnosis-certification-ngh-101.html';
		}
		
	else if (srt=='Hypnotherapy 102')
		{
			return'http://www.apaclasses.com/hypnotherapy/hypnosis-certification-ngh-102.html';
		}
	else if (srt=='Hypnotherapy 103')
		{
			return 'http://www.apaclasses.com/hypnotherapy/hypnosis-certification-ngh-103.html';
		}
	else if (srt=='Hypnotherapy Intens.')
		{
			return 'http://www.apaclasses.com/hypnotherapy/hypnosis-certification-ngh.html';
		}
	else if (srt=='Internet Marketing')
		{
			return 'http://www.apaclasses.com/marketing/index.html';
		}

	else
		{
			return window.location;
	   	}
}