HelpText = new Array;
HelpText['Employer_name'] = "Please enter the name of the company you work for.  This name must not be longer than 30 digits.";
HelpText['GrossNet'] = "Gross amount is before Tax is deducted from your Salary and the Net amount is after Tax has been deducted from your Salary.";
HelpText['P60Above'] = "Gross amount is before Tax is deducted from your Salary and the Net amount is after Tax has been deducted from your Salary.";
HelpText['P45Above'] = "Gross amount is before Tax is deducted from your Salary and the Net amount is after Tax has been deducted from your Salary.";
HelpText['EmpSal'] = "Your Annual Salary is the total amount you are paid for the entire year.<br><br> Enter only numbers for the Annual Salary Amount for example: 24500.";
HelpText['P60Sal'] = "Your Annual Salary is the total amount you are paid for the entire year.<br><br> Enter only numbers for the Annual Salary Amount for example: 24500.";
HelpText['P45Sal'] = "Your Annual Salary is the total amount you are paid for the entire year.<br><br> Enter only numbers for the Annual Salary Amount for example: 24500.";
HelpText['Payslip_type'] = "You can view all different types of Payslips on our front page.";
HelpText['personal_details'] = "Enter your Personal Details in the fields below.";
HelpText['payment_method'] = "Specify whether you wish to pay for your account online by credit or debit card, or whether you will settle your account offline by cheque or bank transfer. If you choose to pay by cheque or bank transfer we will email you a pro forma invoice and remittance advice with further instructions, your account will not be activated until we receive your payment.";
HelpText['cardnumber'] = "This is a long number printed on the front of the card.  <br/><br/>Please enter the card number without any spaces.";
HelpText['expiry'] = "Select the month and year that your card expires from the drop-down list.";
HelpText['cvv'] = "Security Number is found at the back side of the card on the signiture strip, Please enter last 3 digits!<br><br><div align='center'><img src='./images/securitycode.jpg'></div><br>See the illustrations above for assistance identifying your card security code.";
HelpText['begin'] = "If your card has a begin, start or valid from date, select the month and year from the drop-down list. This field is not applicable to all cards, if your card does not have a begin date, leave this field blank.";
HelpText['issue'] = "If your card has an issue number, enter it here. This field is not applicable to all cards, if your card does not have an issue number, leave this field blank.";
HelpText['card_owner'] = "If the registered name and address of the card you are using to pay (normally the name and address shown on the card statement) is not the same as those you have entered for the Account Owner above, uncheck this box and enter the card holder's contact details.";
HelpText['NI_details'] = "Your National Insurance Number, starts with two letters and six numbers and one letter at the end, for example: XX 999999 Y";
HelpText['payslipDates'] = "For example, if you require 3 monthly payslips from 28th August until 28th October.  Enter 28th August in the From box and 28th October in the Until box, then you will receive 3 payslips dated 28/08/04, 28/09/04, 28/10/04. <br><br>For Example, If you require 3 weekly payslips from 03/12/04 until 17/12/04, Enter 03/12/04 in the from box and 17/12/04 in the until box then you will recieve 3 payslips dated 03/12/04, 10/12/04, 17/12/04.  <br><br>Common monthly pay date is 28th of each month, and common weekly pay day is Friday of each week.";
HelpText['payslips_required'] = "Please select how would you like us to make your payslips Weekly, Monthly or Fortnightly.";
HelpText['OrderTypeText'] = "If you require Payslips Only, then Please select Payslips Only.<br/><br/>  If you require P60 Only, then Please select P60 Only.<br/><br/> If you require Payslips and P60 then Please select Both Payslips and P60.";
HelpText['contactdetails'] = "<br><br>If you require assistance in filling in this page, Please call us on <br>0845 22 616 77.";
HelpText['helptxt'] = "You will find this icon throught the order page, please use it to assist you.";
HelpText['helptxtcard'] = "You will find this icon throught the payment page, please use it to assist you.";
HelpText['TaxOfficeName'] = "Normally it is local tax office where the business is based.";
HelpText['TaxRefNo'] = "Normally tax office reference number starts with 3 numbers and combinations of letters and numbers, for example: 777/MK2244";
HelpText['AnnualSalaryAmount1'] = "Normally it is local tax office where the business is based.";
HelpText['TaxOfficeName2'] = "Normally it is local tax office where the business is based.";
HelpText['TaxRefNo2'] = "Normally tax office reference number starts with 3 numbers and combinations of letters and numbers, for example: 777/MK2244";
HelpText['Date1'] = "Please click on the calender button to enter required dates.";
HelpText['Date2'] = "Please click on the calender button to enter required dates.";
HelpText['Date3'] = "Please click on the calender button to enter required dates.";
HelpText['Date4'] = "Please click on the calender button to enter required dates.";


if ('undefined' == typeof $) {
    function $(id)
    {
        return document.getElementById(id);
    }
}


function PopUpHelp(field,yArg,xArg) {
  if (yArg == undefined) { yArg = 0; }
  if (xArg == undefined) { xArg = 0; }
  var img = $(field);
  img.alt = '';
  if($("helptext") !=null)
  {
      $("helptext").innerHTML = HelpText[field] + HelpText['contactdetails'];
      $("helplayer").style.left = (GetElementLeft(img) + xArg) + 'px';
      $("helplayer").style.top = (GetElementTop(img) + yArg) + 'px';
      $("helplayer").style.visibility = "visible";

      if ($('iframe')) {
          var fs = $('iframe').style;
          var hs = $("helplayer").style;
          fs.left = hs.left;
          fs.top  = hs.top;
          fs.height = $("helplayer").offsetHeight + 'px';
          fs.display = 'block';
      }
  }
}

function GetElementLeft(eElement)
{
   return eElement.offsetLeft;
}

function GetElementTop(eElement)
{
   return eElement.offsetTop;
}

function MM_findObj(n, d) { //v4.01
    if(!d) {
        d=document;
    }

    return d.getElementById(n);
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) {
    if ((obj=$(args[i]))!=null) {
        v=args[i+2];
        if (obj.style) {
            obj=obj.style;
            v=(v=='show')?'visible':(v=='hide')?'hidden':v;
        }

        obj.visibility=v;
    }
  }

  if ($('iframe')) {
      $('iframe').style.display = 'none';
  }
}

//show/hide order for Payslip/P60/both/P45
var orderType;
function OrderTypeChanged(type, ival)
{
   // alert(type);
    var rowPayslip=9;
	var rowP60=8;
	var rowEmp=9;
	var rowP45=8;
	orderType = type;
	var f = $('aspnetForm');

    if(ival != 1) {
        for (var i=0; i<28; ++i) {
            f.Payslip_style[i].checked = false;
        }

        for (i=0; i<4; ++i) {
            f.txtP60Type[i].checked = false;
        }
    }
    
        
    switch (type){
        case "":
             $("allContent").style.display="none";
             $("payButtons").style.display="none";
             break;
             
		case "Both":
			f.ctl00_ContentPlaceHolder1_txtTaxCode.value = "543L";
			f.ctl00_ContentPlaceHolder1_Date_Started_Employment.value = "06/04/2008";
			$("P60_tbl1").style.display="";
            $("P60_tbl2").style.display="";
            $("P45_tbl1").style.display="none";
            $("P45_tbl2").style.display="none";
            $("allContent").style.display="";
            $("payButtons").style.display = "";

            //Nalin--------------
            $("divExtras").style.display = "";

            //-------------------
            
            for(i =0; i<=rowPayslip; i++)
			{
				if ($("Payslips_"+ i))
				{
					$("Payslips_"+ i).style.display="";
				}
			}
			//Display all the employment details
		    for(i=1;i<=rowEmp;i++)
		    {
		        if ($("Employment_"+ i))
				{
					$("Employment_"+ i).style.display="";
				}
		    }
		    
            $("Employment_9").style.display="none";

			break;
		case "Payslips":
			f.ctl00_ContentPlaceHolder1_txtTaxCode.value = "543L";
			f.ctl00_ContentPlaceHolder1_Date_Started_Employment.value = "06/04/2008";
			$("P60_tbl1").style.display="none";
            $("P60_tbl2").style.display="none";
            $("P45_tbl1").style.display="none";
            $("P45_tbl2").style.display="none";
            $("allContent").style.display="";
           $("payButtons").style.display="";
            
			for(i =0; i<=rowPayslip; i++)
			{
				if ($("Payslips_"+ i))
				{
					$("Payslips_"+ i).style.display="";
				}
			}

            //Display Payslip related employment details
		    for(i=1;i<=rowEmp;i++)
		    {
		        if ($("Employment_"+ i))
				{
					if(i==3 || i==4)
					{
					    $("Employment_"+ i).style.display="none";
					}
					else
					{
					   $("Employment_"+ i).style.display="";
					}
				}
		    }
		    
            $("Employment_9").style.display="none";
            
			break;

		case "P60":
		    clearExtras();

			f.ctl00_ContentPlaceHolder1_txtTaxCode.value = "522L";
            f.ctl00_ContentPlaceHolder1_Date_Started_Employment.value = "06/04/2007";
            $("P60_tbl1").style.display="";
            $("P60_tbl2").style.display="";
            $("P45_tbl1").style.display="none";
            $("P45_tbl2").style.display="none";
            $("allContent").style.display="";
            $("payButtons").style.display="";
            

            
			for(i =0; i<=rowPayslip; i++)
			{
				if ($("Payslips_"+ i))
				{
					$("Payslips_"+ i).style.display="none";
				}
			}

            //Display P60 related employment details
		    for(i=1;i<=rowEmp;i++)
		    {
		        if ($("Employment_"+ i))
				{
					if(i==6 || i==7 || i==8)
					{
					    $("Employment_"+ i).style.display="none";
					}
					else
					{
					   $("Employment_"+ i).style.display="";
					}
				}
		    }
		    
            $("Employment_9").style.display="none";
			break;
			
		case "P45":
		    clearExtras();

			f.ctl00_ContentPlaceHolder1_txtTaxCode.value = "543L";
            f.ctl00_ContentPlaceHolder1_Date_Started_Employment.value = "06/04/2008";
            $("P45_tbl1").style.display="";
            $("P45_tbl2").style.display="";
            $("P60_tbl1").style.display="none";
            $("P60_tbl2").style.display="none";
            //$("divExtras").style.display="none";
            $("allContent").style.display="";
            $("payButtons").style.display = "";
            //Nalin-----------
            
            //----------------
            
            
			for(i =0; i<=rowPayslip; i++)
			{
				if ($("Payslips_"+ i))
				{
					$("Payslips_"+ i).style.display="none";
				}
			}

            //Display P45 related employment details
		    for(i=1;i<=rowEmp;i++)
		    {
		        if ($("Employment_"+ i))
				{
					if(i==6 || i==7 || i==8)
					{
					    $("Employment_"+ i).style.display="none";
					}
					else
					{
					   $("Employment_"+ i).style.display="";
					}
				}
		    }
            
            $("Employment_9").style.display="";  
			break;
	}

    calculatecost();

    if($('footer') != null)
	    $('footer').innerHTML += " ";

	return false;
}

function clearExtras()
{
    var f = $('aspnetForm');
    f.ctl00_ContentPlaceHolder1_DepartmentName.checked = false;
    f.ctl00_ContentPlaceHolder1_OtherNumberOrName.checked = false;
    f.ctl00_ContentPlaceHolder1_LoansDeduction.checked = false;
    f.ctl00_ContentPlaceHolder1_OvertimePayment.checked = false;
    f.ctl00_ContentPlaceHolder1_PensionDeduction.checked = false;
    f.ctl00_ContentPlaceHolder1_BonusPayment.checked = false;
    f.ctl00_ContentPlaceHolder1_MedInsuranceDeduction.checked = false;
    f.ctl00_ContentPlaceHolder1_CommissionPayment.checked = false;
    f.ctl00_ContentPlaceHolder1_OtherDeduction.checked = false;
    f.ctl00_ContentPlaceHolder1_OtherPayment.checked = false;
}

function calculatecost()
{
var PayslipCost = 0;
var PayslipQty = 0;
var xQty = 0;
var f = $('aspnetForm');

var obj=f.ctl00_ContentPlaceHolder1_PayslipQty;
PayslipQty = obj.options[obj.selectedIndex].value;

alert(PayslipQty);

if((PayslipQty == "0") || (PayslipQty == "")||(PayslipQty=="Select One"))
{
	PayslipCost = 0;
}
else
{
var theone;
for (i=0;i<f.Payslip_style.length;i++){
if (f.Payslip_style[i].checked==true)
	theone=i;
}

   //Calculate QTy
   if((PayslipQty - 3) > 0) { xQty=PayslipQty - 3; } else { xQty=0; }

  switch (theone)
    {
    case 27:
    { 	    //CP
		PayslipCost = 55 + (xQty * 9);
        	break;
    }
    case 26:
    { 	    //CP
		PayslipCost = 55 + (xQty * 9);
        	break;
    }
    case 25:
    { 	    //CP
		PayslipCost = 55 + (xQty * 9);
 		break;
    }
    case 24:
    { 	    //PP
		PayslipCost = 50 + (xQty * 8);
 		break;
    }
    case 23:
    { 	    //PP
		PayslipCost = 50 + (xQty * 8);
 		break;
    }
    case 22:
    { 	    //PP
		PayslipCost = 50 + (xQty * 8);
 		break;
    }
    case 21:
    { 	   //PP
		PayslipCost = 50 + (xQty * 8);
 		break;
    }
    case 20:
    { 	    //+SS DM
		PayslipCost = 45 + (xQty * 7);
 		break;
    }
    case 19:
    { 	    //+SS DM
		PayslipCost = 45 + (xQty * 7);
 		break;
    }
    case 18:
    { 	    //+SS DM
		PayslipCost = 45 + (xQty * 7);
 		break;
    }
    case 17:
    { 	    //+SS DM
		PayslipCost = 45 + (xQty * 7);
 		break;
    }
    case 16:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 15:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 14:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 13:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 12:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 11:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 10:
    { 		    //+ DM
			PayslipCost = 40 + (xQty * 6);
 			break;
    }
    case 9:
    { 		    //SStd DM
 			PayslipCost = 38 + (xQty * 5.50);
 			break;
    }
    case 8:
    { 		    //SStd DM
 			PayslipCost = 38 + (xQty * 5.50);
 			break;
    }
    case 7:
    {  		    //SStd DM
 			PayslipCost = 38 + (xQty * 5.50);
 			break;
    }
    case 6:
    { 	            //SStd DM
 			PayslipCost = 38 + (xQty * 5.50);
 			break;
    }
    case 5:
    { 		//Std DM
 			PayslipCost = 35 + (xQty * 5);
 			break;
    }
    case 4:
    { 		//Std DM
 			PayslipCost = 35 + (xQty * 5);
 			break;
    }
    case 3:
    { 		//Std DM
 			PayslipCost = 35 + (xQty * 5);
 			break;
    }
    case 2:
    { 		//Std DM
 			PayslipCost = 35 + (xQty * 5);
             		break;
    }
    case 1:
    { 		//Std DM
 			PayslipCost = 35 + (xQty * 5);
 			break;
    }
    case 0:
    { 		//Std DM
 			PayslipCost = 35 + (xQty * 5);
 			break;
    }
    default:
    { 		//Empty
   			PayslipCost =0;
 			break;
    }


  }
}
//Guaranteed Delivery
var objDeliveryOption=f.ctl00_ContentPlaceHolder1_DeliveryOption;
if (objDeliveryOption.options[objDeliveryOption.selectedIndex].value == "GuaranteedDeliveryB49")
{

 PayslipCost = PayslipCost + 13.75;
}

if (objDeliveryOption.options[objDeliveryOption.selectedIndex].value == "GuaranteedDeliveryB412")
{
 PayslipCost = PayslipCost + 8.75;
}

if (objDeliveryOption.options[objDeliveryOption.selectedIndex].value == "GuaranteedSaturdayDelivery")
{
 PayslipCost = PayslipCost + 12.75;
}

if (objDeliveryOption.options[objDeliveryOption.selectedIndex].value == "OverseasDelivery")
{
 PayslipCost = PayslipCost + 10.00;
}

if(f.ctl00_ContentPlaceHolder1_FaxService.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if(f.ctl00_ContentPlaceHolder1_EmailService.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_OtherPayment.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_CommissionPayment.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_OvertimePayment.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_BonusPayment.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_OtherDeduction.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_MedInsuranceDeduction.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_LoansDeduction.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_PensionDeduction.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_OtherNumberOrName.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_DepartmentName.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}

if (f.ctl00_ContentPlaceHolder1_SpecialEmployNumber.checked == true)
{
 PayslipCost = PayslipCost + 4.95;
}


var objOrderType=f.ctl00_ContentPlaceHolder1_txtOrderType;
if((objOrderType.options[objOrderType.selectedIndex].value == "P60") || (objOrderType.options[objOrderType.selectedIndex].value == "Both"))
{
	if((f.txtP60Type[0].checked == true) || (f.txtP60Type[3].checked == true))
	{
		//P60 Cost
		PayslipCost = PayslipCost + 35.00;
	}
	else
	{
		if((f.txtP60Type[1].checked == true) || (f.txtP60Type[2].checked == true))
		{
			//P60 Cost
			PayslipCost = PayslipCost + 38.00;
		}
	}	
}

if((objOrderType.options[objOrderType.selectedIndex].value == "P45"))
{
    if(f.txtP45Type.checked == true)
		PayslipCost = PayslipCost + 50.00;
}


f.orderamount.value = PayslipCost.toFixed(2);

if(document.all){
     $("MyID1").innerText = PayslipCost.toFixed(2);
} else{
    $("MyID1").textContent = PayslipCost.toFixed(2);
}
}
