/* 
	random scripts for the actech websites
*/

/* for contact form validation */
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


/* for contact form validation */
function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

/* popup windows */
function openpopup(url,name,options,fullscreen) {
  windowobj = window.open(url,name,options);
  if (fullscreen) {
     windowobj.moveTo(0,0);
     windowobj.resizeTo(screen.availWidth,screen.availHeight);
  }
  //windowobj.focus();
  return false;
}


function acsdownload_confirm() {
	var answer = confirm("WARNING! Adobe Digital Editions must be downloaded and authorized before you proceed, which means creating an Adobe ID. If you are unsure what this means, please click \"Cancel\" and read the instructions before you download your title. If you have installed Adobe Digital Editions and it is authorized to the correct user, than proceed by clicking \"OK\".")
	if (!answer){
		return false;
	}
}

function download_confirm() {
	var answer = confirm("You are about to download your eBook to your computer. To continue, press \"OK\", otherwise press \"Cancel\".")
	if (!answer){
		return false;
	}
}

function encrypted_epub_desc() {
	var answer = alert("ePub is an ideal format for handheld devices because of its reflowable nature, which" + '\n' + "means that when you increase or decrease the text size, the text will arrange itself" + '\n' + "to fit your screen.  It works well on PCs and Macs as well and will require you to" + '\n' + "open the file in the free Adobe Digital Editions software. This ePub file is protected" + '\n' + "by Adobe DRM and is downloaded in a file format with an .acsm extension.")
	if (!answer){
		return false;
	}
}

function unencrypted_epub_desc() {
	var answer = alert("ePub is an ideal format for handheld devices because of its reflowable nature, which" + '\n' + "means that when you increase or decrease the text size, the text will arrange itself" + '\n' + "to fit your screen.  It works well on PCs and Macs as well and will require you to" + '\n' + "open the file in the free Adobe Digital Editions software.")
	if (!answer){
		return false;
	}
}

function encrypted_pdf_desc() {
	var answer = alert("PDF is a standard format for reading eBooks and can be opened in many free software" + '\n' + "platforms such as Adobe Reader and Adobe Digital Editions. PDF files do not reflow," + '\n' + "which means that the text will not arrange itself to fit your screen when you increase or" + '\n' + "decrease the text size. You do have the ability to zoom in and zoom out however. This" + '\n' + "PDF file is protected by Adobe DRM and is downloaded in a file format with an .acsm extension.")
	if (!answer){
		return false;
	}
}

function unencrypted_pdf_desc() {
	var answer = alert("PDF is a standard format for reading eBooks and can be opened in many free software" + '\n' + "platforms such as Adobe Reader and Adobe Digital Editions. PDF files do not reflow," + '\n' + "which means that the text will not arrange itself to fit your screen when you increase or" + '\n' + "decrease the text size. You do have the ability to zoom in and zoom out however.")
	if (!answer){
		return false;
	}
}


function toggleMe(a){
var e=document.getElementById(a);
if(!e)return true;
if(e.style.display=="none"){
e.style.display="block"
}
else{
e.style.display="none"
}
return true;
}

//expands and collapses text
jQuery(document).ready(function() {
  jQuery(".content").hide();
  //toggle the componenet with class msg_body
  jQuery(".heading").click(function()
  {
    jQuery(this).next(".content").slideToggle(500);
  });
});

<!-- script is for yahoo bablefish translate drop down -->
function nav(){
   var w = document.myform.mylist.selectedIndex;
   var url_add = document.myform.mylist.options[w].value;
   window.location.href = url_add;
}
