/********************************************************/
//	LOTRO Raiding Readiness Calculator					//
//	Created by: A Casual Stroll to Mordor				//
//  Contact: podcast@casualstrolltomordor.com			//
//	Created on: 5/6/10									//
//	Last Modified: 5/7/10								//
/********************************************************/

		function raddread(form)
		{
		  var R = parseFloat(form.Radiance.value, 10); // Radiance entered by user
		  var D = form.Dungeon.value; // Dungeon selected by user
		  var dread; // dread total
		  var text; // text message
		  
		  var dungeonVM = new Array();  // Vile Maw 
		    dungeonVM[0]=45;
		    dungeonVM[1]=75;
		    dungeonVM[2]=140;
		  var dungeonDN = new Array(); // Dar Narbugud
		    dungeonDN[0]=65;
		    dungeonDN[1]=115;
		    dungeonDN[2]=160;
		  var dungeonBG = new Array(); // Barad Guldur
		    dungeonBG[0]=115;
		    dungeonBG[1]=175;
		    dungeonBG[2]=230;
		    
		  switch (D)
		  {
		    case "VM":
		        if (R < dungeonVM[0]) {
                    text = "You do not reach the minimum requirements for this raid, yet.";
		        } else if (R >= dungeonVM[0] && R < dungeonVM[1]) {
                    text = "You meet the minimum requirements for this raid.";		        
		        } else if (dungeonVM[1] == R) {
		            text = "You meet the ideal requirements for this raid.";
		        } else if (R > dungeonVM[1] && R <= dungeonVM[2]) {
		            text = "You meet or exceed the ideal requirements for this raid.";
		        } else if (R > dungeonVM[2]) {
		            text = "You exceed the requirements for this raid.";
		        }		        
		        dread = Math.floor((dungeonVM[2]-R)/10);
				break;
		    case "DN":
		        if (R < dungeonDN[0]) {
                    text = "You do not reach the minimum requirements for this raid, yet.";
		        } else if (R >= dungeonDN[0] && R < dungeonDN[1]) {
                    text = "You meet the minimum requirements for this raid.";		        
		        } else if (dungeonDN[1] == R) {
		            text = "You meet the ideal requirements for this raid.";
		        } else if (R > dungeonDN[1] && R <= dungeonDN[2]) {
		            text = "You meet or exceed the ideal requirements for this raid.";
		        } else if (R > dungeonDN[2]) {
		            text = "You exceed the requirements for this raid.";
		        }		    
		        dread = Math.floor((dungeonDN[2]-R)/10);		    
				break;
		    case "BG":
		        if (R < dungeonBG[0]) {
                    text = "You do not reach the minimum requirements for this raid, yet.";
		        } else if (R >= dungeonBG[0] && R < dungeonBG[1]) {
                    text = "You meet the minimum requirements for this raid.";		        
		        } else if (dungeonBG[1] == R) {
		            text = "You meet the ideal requirements for this raid.";
		        } else if (R > dungeonBG[1] && R <= dungeonBG[2]) {
		            text = "You meet or exceed the ideal requirements for this raid.";
		        } else if (R > dungeonBG[2]) {
		            text = "You exceed the requirements for this raid.";
		        }
		        dread = Math.floor((dungeonBG[2]-R)/10);
				break;
		    default:
		  }
		  
		  if (dread < 0) {
			  dread = 0; }

		  form.Dread.value = dread;
		  form.Ready.value = text;
		}
