<!--
Image1= new Image()
Image1.src = "images/nav_books_cptcodes_on.gif"
Image2= new Image()
Image2.src = "images/nav_books_cptguide_on.gif"
Image3= new Image()
Image3.src = "images/nav_books_cptindex_on.gif"
Image4= new Image()
Image4.src = "images/nav_books_hcpcscodes_on.gif"
Image5= new Image()
Image5.src = "images/nav_books_hcpcsdrugs_on.gif"
Image6= new Image()
Image6.src = "images/nav_books_icdcodes_on.gif"
Image7= new Image()
Image7.src = "images/nav_books_icddrugs_on.gif"
Image8= new Image()
Image8.src = "images/nav_books_icdindex_on.gif"
Image9= new Image()
Image9.src = "images/nav_books_icdneos_on.gif"
Image10= new Image()
Image10.src = "images/nav_books_icd_on.gif"
Image11= new Image()
Image11.src = "images/nav_books_cpt_on.gif"
Image12= new Image()
Image12.src = "images/nav_books_hcpcs_on.gif"
Image13= new Image()
Image13.src = "images/icon_roll_anes.gif"
Image14= new Image()
Image14.src = "images/icon_roll_eval.gif"
Image15= new Image()
Image15.src = "images/icon_roll_drug.gif"
Image16= new Image()
Image16.src = "images/icon_roll_path.gif"
Image17= new Image()
Image17.src = "images/icon_roll_radi.gif"
Image18= new Image()
Image18.src = "images/icon_roll_surg.gif"
Image19= new Image()
Image19.src = "images/icon_roll_2.gif"
Image20= new Image()
Image20.src = "images/icon_roll_3.gif"
Image21= new Image()
Image21.src = "images/icon_roll_rx.gif"

helpId = "GeneralHelp.tea"


function authorizationAlert() {
	alert('You are unauthorized to access this functionality')
} // end authorizationAlert

function authorizationAlertMsg(msg) {
	alert(msg);
}


function confirmClipboardDelete(area,
                                action) {
  if (confirm("This action will remove all " + area + " codes from your clipboard.  Do you want to continue?")){
			window.self.location=action;
  } // end if
} // end confirmClipboardDelete

function isAllWhitespace(str) {
  if (str.length <= 1)
  {
	  return true;
  } else {
    //var nonWhite = new RegExp("^[]*$");
    //return nonWhite.test(str);
    return false;
  }
} // end isAllWhitespace

function isNetscape() {
	var nets = new RegExp("Netscape");
	return nets.test(navigator.appName);
} // end isNetscape

function noNotes(action) {
  if (confirm("There are no notes for this code. Do you want to add a note?")){
			window.self.location=action;
  } // end if
} // end function

function openExport() {
	window.open("exp_1_0.html","Export","width=324,height=175,menubar=yes,toolbar=no,location=no,status=no,noresize,alwaysRaised=yes,scrollbars=0");
} // end openExport

function openSearch() {
	window.open("src_1_0.html","Search","width=500,height=250,menubar=yes,toolbar=no,location=no,status=no,noresize,alwaysRaised=yes,scrollbars=0");
} // end openSearch

function setHelpId(newHelpId) {
	if (top.nav.MenuForm != null) {
		top.nav.MenuForm.menu.value = newHelpId;
	} // end if
} // end setHelpId

function submitAdvancedSearchForm() {
  var valid = validateAdvancedSearchForm();
  if (valid) {
    document.advancedSearchForm.submit();
	if (!isNetscape()){
		window.close();
	} // end if
  } // end if
  else {
	  return false;
  } // end else
} // end submitAdvancedSearchForm

function validateAdvancedSearchForm() {
	//var nonWhite = new RegExp("^[space]*$");
	//if (nonWhite.test(document.simpleSearchForm.query.value)) {
  if (isAllWhitespace(document.advancedSearchForm.query.value)) {
		alert("Enter your search criteria before continuing.");
		return false;
	} // end if
	else {
		return true;
	} // end else
} // end submitSearchForm

function validateSearchForm() {
	//var nonWhite = new RegExp("^[space]*$");
	//if (nonWhite.test(document.simpleSearchForm.query.value)) {
  if (isAllWhitespace(document.simpleSearchForm.query.value)) {
		alert("Enter your search criteria before continuing.");
		return false;
	} // end if
	else {
		return true;
	} // end else
} // end submitSearchForm





function getHelpId() {
	if (top.nav.MenuForm == null) {
		helpId = "GeneralHelp.tea";   
	} // end if
	else {
		helpId = top.nav.MenuForm.menu.value;
	} // end else
	//window.open(helpId,'helpWindow','width=800,height=480,menubar=yes,toolbar=no,location=no,status=no,noresize,alwaysRaised=yes,scrollbars=0');
	window.open('http://www.icd9coding.com/help_pages/tableofcontents.html','helpWindow','width=600,height=500,scrollbars=1,resizable');
} // end getHelpId

//Function to replace onclick loads that don't work on Macintosh browsers
function loadPage(navURL ,
                  bodyURL ) {
	window.self.location = navURL;
	top.content.location = bodyURL;
}

function calculateTotals(form) {
  elementName = "";
  elementValue = "";
  quantity = 0;
  subType = "";
  for ( x = 0 ;x < form.elements.length ; x++)
  {
    elementName = form.elements[x].name;
	elementValue= form.elements[x].value;
	if (elementName == "concurrentSessions")
	{
		quantity = elementValue;
	}
	else if (elementName == "subType")
	  {
		subType = elementValue;
	  }    
  }
 
  unitprice = 0;

  if (subType == "expert")
	{
		if (quantity == 1)
		{
			unitprice = 499.95;
		}
		else if ((quantity >= 2) && (quantity <= 5))
		{
			unitprice = 299.95;
		}
		else if ((quantity >= 6) && (quantity <= 10))
		{
			unitprice = 274.95;
		}
	}

  if (subType == "basic")
	{
		if (quantity == 1)
		{
			unitprice = 249.95;
		}
		else if ((quantity >= 2) && (quantity <= 5))
		{
			unitprice = 149.95;
		}
		else if ((quantity >= 6) && (quantity <= 10))
		{
			unitprice = 134.95;
		}
	}

	window.document.change.unitprice.value = unitprice;
	window.document.change.total.value = formatCurrency(unitprice * quantity);
}


function calculateRenewalTotals(form) {

  elementName = "";
  elementValue = "";
  quantity = 0;
  subType = "";
  for ( x = 0 ;x < form.elements.length ; x++)
  {
    elementName = form.elements[x].name;
	elementValue= form.elements[x].value;
	if (elementName == "concurrentSessions")
	{
		quantity = elementValue;
	}
	else if (elementName == "subType")
	  {
		subType = elementValue;
	  }    
  }
 
  unitprice = 0;

  if (subType == "expert")
	{
		if (quantity == 1)
		{
			unitprice = 299.95;
		}
		else if ((quantity >= 2) && (quantity <= 5))
		{
			unitprice = 179.95;
		}
		else if ((quantity >= 6) && (quantity <= 10))
		{
			unitprice = 164.95;
		}
	}

  if (subType == "basic")
	{
		if (quantity == 1)
		{
			unitprice = 149.95;
		}
		else if ((quantity >= 2) && (quantity <= 5))
		{
			unitprice = 89.95;
		}
		else if ((quantity >= 6) && (quantity <= 10))
		{
			unitprice = 80.95;
		}
	}

	window.document.change.unitprice.value = unitprice;
	window.document.change.total.value = formatCurrency(unitprice * quantity);
}

function expertSelected(form)
{
  window.document.change.subType.value = "expert";
  calculateTotals(form);
}

function basicSelected(form)
{
  window.document.change.subType.value = "basic";
  calculateTotals(form);
}

function expertRenewalSelected(form)
{
  window.document.change.subType.value = "expert";
  calculateRenewalTotals(form);
}

function basicRenewalSelected(form)
{
  window.document.change.subType.value = "basic";
  calculateRenewalTotals(form);
}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	//return (((sign)?'':'-') + '$' + num + '.' + cents);
	return (((sign)?'':'-') +  num + '.' + cents);
}

// -->


		function confirmPay() {
			var answer = alert("You have selected a feature available only with the Flash Code Platinum edition.  Click the button below to resume your FREE ICD-9-CM coding session.");
			/* if(answer==true) {	window.open("http://www.flashcode.com")
			}
			else	{
				return	
			} */
		}

function openFreeIcdSearchWindow(form)   {
     var listIndex = document.forms[0].select.selectedIndex;
     var listName = document.forms[0].select.options[listIndex].value;
     var query = document.forms[0].query.value;
     window.open('openAdvancedSearch.do?query=' + query,'window2','resizable=no,width=520,height=320');
     return;
}
