<HTML><HEAD><TITLE>Case Classification</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<SCRIPT type=text/javascript> 
<!-- 


var Categories = new Array(

new Array(1, 0, 'Credit Control'),
new Array(2, 0, 'Company Secretary/Legal'),
new Array(3, 0, 'Customer Services UK'),
new Array(4, 0, 'Executive'),
new Array(5, 0, 'Financial Accounts')
);

//  param1 = unique id, param2 = parent id in Categories, param3 = Select value

var SubCategory = new Array(

new Array(1,1,'Bank Account Changes - Credit Control'),
new Array(2,1,'Contract Copies - Credit Control'),
new Array(3,1,'Cheque Refunds - Credit Control'),
new Array(4,1,'Direct Debit - Credit Control'),
new Array(5,1,'Invoice Copies - Credit Control'),
new Array(6,1,'Invoice Payment - Credit Control'),
new Array(7,1,'Liquidation - Credit Control'),
new Array(8,1,'Statement of Account - Credit Control'),
new Array(10,2,'Company Secretary/Legal'),
new Array(11,2,'Contract Admin - Company Secretary/Legal')
);

//  param1 = unique id, param2 = parent id in Subcategories, param3 = Select value

var Items = new Array(

new Array(1,1,'Collecting from Wrong Bank Account'),
new Array(2,1,'Change of Bank Details/Payment Method'),
new Array(3,2,'Contract Copies (for invoice queries only)'),
new Array(4,3,'Cheque Refunds'),
new Array(5,4,'Breakdown of Direct Debit'),
new Array(6,4,'Setting up Mandate with Bank'),
new Array(7,5,'Invoice Copies (less than 20)'),
new Array(8,5,'Invoice Copies (more than 20)'),
new Array(9,6,'Has Customer paid Invoice(s)?'),
new Array(10,7,'Liquidation and Receiverships'),
new Array(11,8,'Copy Statements (over 2 months old)'),
new Array(12,8,'Copy Statements (under 2 months old)'),
new Array(13,10,'Account in hand of solicitor'),
new Array(14,11,'Authorisation of account set up Query'),
new Array(15,11,'Customer Contract Novation Query'),
new Array(16,11,'Customer Contract Signature Query'),
new Array(17,11,'Finance Lease Contract Query')
);


function set_child_listbox(parentObject,childObject,childArray) {

	//Clear child listbox
	for(var i=childObject.length;i>0;i--) {
		childObject.options[i] = null;
	} 

	childObject.options[0] = new Option("Select Value","");
	var selIndex = parentObject.options[parentObject.selectedIndex].value;
	if (selIndex == "") {
		childObject.disabled = true;
	} else {
		childObject.disabled = false;
		var childIndex = 1;
		for (i = 0; i < childArray.length; i++) {
			if (childArray[i][1] == selIndex) {
				childObject.options[childIndex] = new Option(childArray[i][2], childArray[i][0]);
				childIndex++;
			}
		}
	}

	//Select the first option
	childObject.selectedIndex = 0;
	childObject.onchange();
}


function disable_child_listbox() {

	//Disable second listbox 
	if (document.dropdowns.categorylist.selectedIndex == "") {
		document.dropdowns.subcategorylist.disabled = true;
	} else if (document.dropdowns.subcategorylist.length == 1) { 
		document.dropdowns.categorylist.onchange();
	}

	//Disable third listbox   
	if (document.dropdowns.subcategorylist.selectedIndex == "") {
		document.dropdowns.itemlist.disabled = true;
	}	
}

function initload() {

	disable_child_listbox();
	
	document.dropdowns.categorylist.options[0] = new Option("Select Value","");
	var Index = 1;
	for (i = 0; i < Categories.length; i++) {
		document.dropdowns.categorylist.options[Index] = new Option(Categories[i][2], Categories[i][0]);
		Index++;
	}
	
	//Select the first option
	document.dropdowns.categorylist.selectedIndex = 0;
		
}


function onSubmit() {

if (UpdateSFDC() == true) { 
 
	window.parent.parent.location.href=" /{!Case_ID}";

} 
	return false;	
} 

function onCancel() {

	window.parent.parent.location.href=" /{!Case_ID}";
	return false;
} 

function UpdateSFDC(){ 

var url = "{!API_Enterprise_Server_URL_40}";
var i;

if (document.dropdowns.categorylist.value == "") {
	alert("Please select a value for the Category");
	return false;
}
if (document.dropdowns.subcategorylist.value == "") {
	alert("Please select a value for the Subcategory");
	return false;
}
if (document.dropdowns.itemlist.value == "") {
	alert("Please select a value for the Item");
	return false;
}

for (i = 0; i < Categories.length; i++) {
	if (Categories[i][0] == document.dropdowns.categorylist.value) {
		var Categorystr = Categories[i][2];
		break;
	}		
}
for (i = 0; i < SubCategory.length; i++) {
	if (SubCategory[i][0] == document.dropdowns.subcategorylist.value) {
		var Subcategorystr = SubCategory[i][2];
		break;
	}		
}
for (i = 0; i < Items.length; i++) {
	if (Items[i][0] == document.dropdowns.itemlist.value) {
		var Itemstr = Items[i][2];
		break;
	}		
}

 
//Update Case record
try{xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){return false;}

xmlhttp.Open("POST",url,false);
xmlhttp.setRequestHeader("Content-Type","text/xml");
xmlhttp.setRequestHeader("soapAction","update");

var xmlUpdateCase = "<?xml  version='1.0'  encoding='UTF-8' ?>" +
                          '<soapenv:Envelope ' +
                          'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" ' +
                          'xmlns:xsd="http://www.w3.org/2001/XMLSchema" '+
                          'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'+
                          '<soapenv:Header>'+
                          '<ns1:SessionHeader ' +
                          'soapenv:mustUnderstand="0" '+
                          'xmlns:ns1="SforceService">'+
                          '<ns2:sessionId' +
                          ' xmlns:ns2="urn:enterprise.soap.sforce.com">{!API_Session_ID}'+
                          '</ns2:sessionId>'+
                          ' </ns1:SessionHeader>'+
                          '</soapenv:Header>'+
                          '<soapenv:Body>' +
                          '<update xmlns="urn:enterprise.soap.sforce.com">'+
                          '<sObjects xsi:type="ns3:Case" '+
                          'xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">'+
                          '<ns3:Id>{!Case_ID}' +
                          '</ns3:Id>'+
                          '<ns3:Category__c>'+Categorystr+
                          '</ns3:Category__c>'+
                          '<ns3:Sub_category__c>'+Subcategorystr+
                          '</ns3:Sub_category__c>'+
                          '<ns3:Item__c>'+Itemstr+
                          '</ns3:Item__c>'+
                          '</sObjects>' +
                          '</update>' +
                          '</soapenv:Body>'+
                          '</soapenv:Envelope>';

  //alert(xmlUpdateCase); 

  xmlhttp.Send(xmlUpdateCase);
  var sq = xmlhttp.status;


  if ( sq == 200){
    return true;
  }
  else{

    return false;
  } 

} 

window.onload = initload;

--> 
</SCRIPT>

<META content="MSHTML 6.00.5730.11" name=GENERATOR></HEAD>
<BODY>
<FORM name=dropdowns>
  <table id=ep cellspacing=5 cellpadding=0 width="100%" border=0>
    <tbody>
      <tr>
        <td width="18%" align="right" nowrap class=requiredInput>Category: </td>
        <td width="82%" colspan="2" class=bodyBold><select onChange="set_child_listbox(this, document.dropdowns.subcategorylist,SubCategory);" name=categorylist>
          <option value="" selected>Select Value</option>
        </select></td>
      </tr>
      <tr>
        <td align="right" nowrap class=requiredInput>Subcategory: </td>
        <td colspan="4" class=bodyBold><select 
      onChange="set_child_listbox(this, document.dropdowns.itemlist,Items);" name=subcategorylist>
          <option value="" selected>Select Value</option>
        </select></td>
      </tr>
      <tr>
        <td align="right" nowrap class=requiredInput>Item: </td>
        <td class=bodyBold><select onChange="" name=itemlist>
          <option value="" selected>Select Value</option>
        </select></td>
    </tbody>
  </table>
</FORM>
</BODY>
</HTML>