
function onlyNum()
{
 if ( !(window.event.keyCode >= 48 && window.event.keyCode <= 57) )
 {
  window.event.keyCode = 0 ;
 }
}
 Itemarray=new Array(new Array(1, 0, 0),new Array(2, 0, 1),new Array(3, 0, 1),new Array(4, 0, 1),new Array(5, 1, 1),new Array(6,1,1),
 new Array(7, 1, 2),new Array(8, 1, 2),new Array(9, 1, 2),new Array(10, 2, 3),new Array(11, 2, 3),new Array(12, 2, 3),new Array(13, 2, 4),
 new Array(14, 2, 4),new Array(15, 2, 4),new Array(16, 2, 5),new Array(17, 3, 5),new Array(18, 3, 6),new Array(19, 3, 6),new Array(20, 4, 7),
 new Array(21, 4, 7),new Array(22, 4, 8),new Array(23, 5, 9),new Array(24, 5, 9),new Array(25, 5, 10),new Array(26, 5, 10),new Array(27, 6, 11),
 new Array(28, 6, 11),new Array(29, 6, 12),new Array(30, 6, 12),new Array(31, 6, 12),new Array(32, 6, 12),new Array(33, 6, 13),new Array(34, 6, 13),
 new Array(35, 7, 13),new Array(36, 7, 13),new Array(37, 7, 14),new Array(38, 7, 14),new Array(39, 7, 14),new Array(40, 7, 15),new Array(41, 7, 15),
 new Array(42, 7, 15),new Array(43, 8, 16),new Array(44, 8, 16),new Array(45, 9, 17),new Array(46, 9, 18),new Array(47, 10, 19),new Array(48, 10, 20),
 new Array(49, 11, 21),new Array(50, 11, 22),new Array(51, 11, 23),new Array(52, 11, 24),new Array(53, 12, 26),new Array(54, 12, 26),new Array(55, 14, 28),
 new Array(56, 14, 28),new Array(57, 15, 30),new Array(58, 15, 30),new Array(59, 16, 32),new Array(60, 16, 32));
 
 function activate(form)
 {
  var beginlevel = document.thisformonly.beginlevel.value;
  var endlevel = document.thisformonly.endlevel.value;
  if ((beginlevel == "") | (endlevel == "")) {alert("please enter your start and target level");return false;}
  beginlevel = beginlevel*1;
  endlevel = endlevel*1; // convert string to number
  if (beginlevel  > endlevel){alert("Target level must be greater than start level.");return false;}
  if ( endlevel  > 60 ){alert("Your levels must be between 1 and 60.");return false;}
  var price = 0;
  var totalHours = 0;
  for (var i=0;i<Itemarray.length;i++)
  {
   if ((Itemarray[i][0]  > beginlevel  )&(Itemarray[i][0]  <= endlevel ))
   {
    
    totalHours = totalHours + Itemarray[i][1];
   }
   if (Itemarray[i][0]  > endlevel ){i=Itemarray.length;}
  }
 
 var timee = document.thisformonly.timee.value;
  var timeb = document.thisformonly.timeb.value;
  timee = timee*1;
  timeb = timeb*1;
  
  
  if ((timee>0)&(totalHours<timee)){
  if(totalHours <= 32){ price = totalHours*0.9375;}
  if((totalHours > 32)&&(totalHours <= 84)){ price = totalHours*0.8333;}
   if((totalHours > 84)&&(totalHours <= 150)){ price = totalHours*0.8000;}
   if((totalHours > 150)&&(totalHours <= 240)){ price = totalHours*0.7916;}
 if((totalHours > 240)&&(totalHours <= 376)){ price = totalHours*0.7446;}
   }
   
  
  if ((timee>0)&(totalHours>timee)&((totalHours-timee)<=384)){
	   
	   if(totalHours <= 32){ price = ((totalHours-timee)*1.5+timee)*0.9375;}
  if((totalHours > 32)&&(totalHours <= 84)){ price = ((totalHours-timee)*1.5+timee)*0.8333;}
   if((totalHours > 84)&&(totalHours <= 150)){ price = ((totalHours-timee)*1.5+timee)*0.8000;}
   if((totalHours > 150)&&(totalHours <= 240)){ price = ((totalHours-timee)*1.5+timee)*0.7916;}
 if((totalHours > 240)&&(totalHours <= 376)){ price = ((totalHours-timee)*1.5+timee)*0.7446;}
	   
   }
   
   
   if ((timee>0)&(totalHours>timee)&((totalHours-timee)>384)){
	   
	   if(totalHours <= 32){ price = (totalHours+192)*0.9375;}
  if((totalHours > 32)&&(totalHours <= 84)){ price = (totalHours+192)*0.8333;}
   if((totalHours > 84)&&(totalHours <= 150)){ price = (totalHours+192)*0.8000;}
   if((totalHours > 150)&&(totalHours <= 240)){ price = (totalHours+192)*0.7916;}
 if((totalHours > 240)&&(totalHours <= 376)){ price = (totalHours+192)*0.7446;}
	   
   }
   
      if ((timee<=0)&((384+timee)>totalHours)&(timeb>0)){
	   
	   if(totalHours <= 32){ price = totalHours*1.5*0.9375;}
  if((totalHours > 32)&&(totalHours <= 84)){ price = totalHours*1.5*0.8333;}
   if((totalHours > 84)&&(totalHours <= 150)){ price = totalHours*1.5*0.8000;}
   if((totalHours > 150)&&(totalHours <= 240)){ price = totalHours*1.5*0.7916;}
 if((totalHours > 240)&&(totalHours <= 376)){ price = totalHours*1.5*0.7446;}
	   
   }
   
   if ((timee<=0)&((384+timee)<totalHours)&(timeb>0)){
	   
	   if(totalHours <= 32){ price = ((totalHours-timeb)+timeb*1.5)*0.9375;}
  if((totalHours > 32)&&(totalHours <= 84)){ price = ((totalHours-timeb)+timeb*1.5)*0.8333;}
   if((totalHours > 84)&&(totalHours <= 150)){ price = ((totalHours-timeb)+timeb*1.5)*0.8000;}
   if((totalHours > 150)&&(totalHours <= 240)){ price = ((totalHours-timeb)+timeb*1.5)*0.7916;}
 if((totalHours > 240)&&(totalHours <= 376)){ price = ((totalHours-timeb)+timeb*1.5)*0.7446;}
	   
   }
   
      if (timeb<=0){
	   
	   if(totalHours <= 32){ price = totalHours*0.9375;}
  if((totalHours > 32)&&(totalHours <= 84)){ price = totalHours*0.8333;}
   if((totalHours > 84)&&(totalHours <= 150)){ price = totalHours*0.8000;}
   if((totalHours > 150)&&(totalHours <= 240)){ price = totalHours*0.7916;}
 if((totalHours > 240)&&(totalHours <= 376)){ price = totalHours*0.7446;}
	   
   }
   
 
  price = Math.ceil(price*0.8571)-0.01;
  
  document.thisformonly.price.value  =  price;
  /*document.thisformonly.price.value  =  Math.round(10.25698741554,2);*/

  document.thisformonly.totaltime.value = totalHours;
  
  
 }
         function FORM1_onsubmit1()
{


if (document.thisformonly.price.value=="")
	{
		alert("Do Estimate first then you can make an order!");
		document.thisformonly.price.focus();
		return false;
	}
	if (document.thisformonly.price.value=="-1")
	{
		alert("Do Estimate first then you can make an order!");
		document.thisformonly.price.focus();
		return false;
	}

}
var data= new Array();
data[0]=new Array("t1",new Array("1","12.99"),new Array("2","25.99"),new Array("3","38.99"),new Array("4","41.99"),new Array("5","64.99"),new Array("6","77.99"),new Array("7","90.99"));
data[1]=new Array("t2",new Array("1","12.99"),new Array("2","25.99"),new Array("3","38.99"),new Array("4","41.99"),new Array("5","64.99"),new Array("6","77.99"),new Array("7","90.99"));
data[2]=new Array("t3",new Array("1","12.99"),new Array("2","25.99"),new Array("3","38.99"),new Array("4","41.99"),new Array("5","64.99"),new Array("6","77.99"),new Array("7","90.99"));
data[3]=new Array("t4",new Array("1","12.99"),new Array("2","25.99"),new Array("3","38.99"),new Array("4","41.99"),new Array("5","64.99"),new Array("6","77.99"),new Array("7","90.99"));

function  change(name,value){  

	for (i=0;i<(data.length);i++ )
	{
		if (data[i][0]==name)
		{
			//alert(data[i][1][0])
			for(j=1;j<data[i].length;j++)
			{
				if (data[i][j][0]==value)
				{
					z=i+1
					document.getElementById('p'+z).value=data[i][j][1];
				}
			}
		}
	}
changet();
}
function  changet(){  
var pt=0;
var i="skills:";
tt=document.FORM1.t1.value*1+document.FORM1.t2.value*1+document.FORM1.t3.value*1+document.FORM1.t4.value*1;
pt=document.FORM1.p1.value*1+document.FORM1.p2.value*1+document.FORM1.p3.value*1+document.FORM1.p4.value*1;;
document.FORM1.totaltime.value = tt*24;
if(Number(document.FORM1.t1.value)!="0"){i=i+"20Mark/day Alterac Valley:"+document.FORM1.t1.value+"days"+"+";}else{i=i;}
if(Number(document.FORM1.t2.value)!="0"){i=i+"20Mark/day Arathi Basin:"+document.FORM1.t2.value+"days"+"+";}else{i=i;}
if(Number(document.FORM1.t3.value)!="0"){i=i+"20Mark/day Warsong Gulch:"+document.FORM1.t3.value+"days"+"+";}else{i=i;}
if(Number(document.FORM1.t4.value)!="0"){i=i+"20Mark/day Eye of the Storm:"+document.FORM1.t4.value+"days+"+"";}else{i=i;}
document.FORM1.ItemName.value=i;
document.FORM1.price.value = Math.round(pt, 4);
}
function FORM1_onsubmit()
{
if (document.FORM1.pt.value==0)
	{
		alert("PLease select skills first!");
		document.FORM1.pt.focus();
		return false;
	}
}