var posturl="http://partner.comparelegalsolutions.com/Default.aspx";
var code="1234567892";
var CustomerType=new Array();
var GeneralSub=new Array();
var OrginasationSub=new Array();
CustomerType['Organisation']=new Array('0*Please Select From List','12*Banking', '13*Commercial Litigation', '14*Commercial Property','31*Competition Law','15*Construction',
                                        '16*Corporate','17*Corporate Debt','34*Defamation (Corporate)','18*Employment/Pensions (Employer)','19*Intellectual Property/I.T. (Corporate)',
                                        '21*Professional Negligence (Corporate)','20*Regulatory');
CustomerType['Individual']=new Array('0*Please Select From List','1*Clinical Negligence', '2*Crime','3*Debt, Bankruptcy & Repossession','4*Defamation (individual)','5*Employment & Pensions (Employee)',
                                        '6*Family Law','7*Fraud','8*Professional Negligence (Individual)','9*Residential Property','10*Tax','11*Trusts & Probate',
                                        '12*Banking','13*Commercial Litigation','14*Commercial Property','15*Construction','16*Corporate','17*Corporate Debt',
                                        '18*Employment/Pensions (Employer)','19*Intellectual Property/I.T. (Corporate)','20*Regulatory','21*Professional Negligence (Corporate)',
                                        '22*Civil Disputes','25*Buying/Selling Property','26*Intellectual Property/I.T.(Individual)','27*Personal Injury',
                                        '28*Judicial Review','29*Motoring Offences','31*Competition Law','32*Immigration Law','33*Wills','34*Defamation (Corporate)',
                                        '35*Educational Law','39*Prison Law');
GeneralSub['1']=new Array('-1');GeneralSub['2']=new Array('-2'); GeneralSub['7']=new Array('-19'); GeneralSub['10']=new Array('-26'); GeneralSub['22']=new Array('-79');GeneralSub['25']=new Array('-82');GeneralSub['27']=new Array('-93');     
GeneralSub['3']=new Array('-3');GeneralSub['4']=new Array('-4'); GeneralSub['8']=new Array('-20'); GeneralSub['13']=new Array('-34'); GeneralSub['15']=new Array('-43');GeneralSub['21']=new Array('-78');GeneralSub['28']=new Array('-94');
GeneralSub['29']=new Array('-95');GeneralSub['31']=new Array('-99');GeneralSub['32']=new Array('-101');GeneralSub['33']=new Array('-102');GeneralSub['34']=new Array('-103');GeneralSub['35']=new Array('-104');GeneralSub['39']=new Array('-105');                                                                                         
GeneralSub['5']=new Array('0*Please Select From List','5*Breach Of Contract','6*Bullying / Harassment','7*Contract Disputes','8*Discrimination','9*Redundancies','10*Dismissal – wrongful / unfair','11*Unpaid wages / holiday','96*Pensions');
GeneralSub['6']=new Array('0*Please Select From List','12*Divorce','13*Domestic Violence','14*Financial Arrangements','15*Prenuptial Arrangement','16*Restraining Orders','17*Separation','18*Children / Custody Arrangements');
GeneralSub['9']=new Array('0*Please Select From List','21*Re – Mortgaging','23*Letting Property','24*Landlord / Tenant Problems','25*Property Disputes');
GeneralSub['11']=new Array('0*Please Select From List','27*Contentious Trusts','28*Estate administration','29*Estate planning');        
GeneralSub['12']=new Array('0*Please Select From List','31*Asset Finance','32*Banking Litigation','33*Corporate Lending & Borrowing');
GeneralSub['14']=new Array('0*Please Select From List','35*Buying / Selling Property','36*Commercial Leases','37*Property Development','38*Environmental Law','39*Planning','40*Property Finance','41*Property Investment','42*Property Management');
GeneralSub['16']=new Array('0*Please Select From List','44*Buying / Selling businesses and assets','45*Joint Ventures','46*Corporate Finance','100-Starting a business');
GeneralSub['17']=new Array('0*Please Select From List','49*Debt Recovery & Debt Collection Services','50*Enforcement of court judgment','51*Insolvency Procedures in Bankruptcy / Winding Up');
GeneralSub['18']=new Array('0*Please Select From List','52*Breach of contract','53*Bullying/Harassment','54*Contract Disputes','55*Discrimination','56*Redundancies','57*Dismissal – wrongful / unfair','58*Unpaid wages / holiday','97*Pensions');
GeneralSub['19']=new Array('0*Please Select From List','59*Confidentiality','60*Copyright','61*I.P. Infringement','62*Licensing/Assignments of I.P Rights','63*Patents','64*Trademarks','65*I.T. Contractual Disputes','66*Design Rights','67*Software Agreements','68*Passing Off');
GeneralSub['20']=new Array('0*Please Select From List','69*Business, Enterprise and Employment Regulation','70*Environment','71*Fair Trading Regulation','73*Financial Service Regulation','75*Health and Safety','76*Pension Regulation','77*Utility Regulation');
GeneralSub['26']=new Array('0*Please Select From List','83*Confidentiality','84*Copyright','85*I.P. infringement','86*Licensing/Assignment of I.P. rights','87*Patents','88*Trademarks','89*I.T. contractual disputes','90*Design rights','91*Software agreements','92*Passing off');
             
function setSelection() {
  customertype = document.getElementById('customertype');
  workList = CustomerType[customertype.value]; 
  document.getElementById('typeofsubwork').style.display="none";
  document.getElementById('typeofwork').disabled=false;
  if(customertype.value=="0")
  {
    document.getElementById('typeofwork').options.length = 0;
    document.getElementById('typeofwork').options[0]=new Option('(Please choose from the List)','0');  
    document.getElementById('typeofwork').disabled=true;  
  }
  else{
  changeSelect('typeofwork', workList, workList);
  } 
}
function SetSubSelection()
{
  customertype = document.getElementById('typeofwork');
  workList = GeneralSub[customertype.value];
  var str=String(workList);  
  if(str.substring(0,1)=="-")
  {
    document.getElementById('typeofsubwork').options.length = 0;
    document.getElementById('typeofsubwork').style.display="none";
    return;
  }  
  else{
    document.getElementById('typeofsubwork').style.display="block";
    changeSelect('typeofsubwork', workList, workList);
  } 
}

function changeSelect(fieldID, newOptions, newValues) {
  selectField = document.getElementById(fieldID);  
  selectField.options.length = 0;
  for (i=0; i<newOptions.length; i++) {
    var temp=newOptions[i].split('*');    
    selectField.options[selectField.length] = new Option(temp[1], temp[0]);    
  }
  
  }
function SubmitSearch()
{ 
mycustomer=document.getElementById("customertype");
mycat1=document.getElementById("typeofwork");
mycat2=document.getElementById("typeofsubwork");
var redirecrparams;
var cat1;
for(i=0;i<mycustomer.length;i++)
  {   if(mycustomer.options[i].selected)
      {  if(mycustomer.options[i].value=="Organisation")
         redirecrparams='&Type=2';
         else if(mycustomer.options[i].value=="Individual")
         redirecrparams='&Type=1';
         else
         {
            alert('Please Select Customer Type');
            return;
         }
         
      }
    }
    var status=false;
    for(i=0;i<mycat1.length;i++)
    {
        if(mycat1.options[i].selected)
        {
        if(mycat1.options[i].value=="0")
        {
          alert("Please Select a Type Of Work");return;
        }
        redirecrparams+="&Cat1="+mycat1.options[i].value;
        cat1=mycat1.options[i].value;
        status=true;
        }
    }   
    if(!status)
    {
        alert("Please Select a Type Of Work");
        return;
    }
    status=false;
    for(i=0;i<mycat2.length;i++)
    {
        if(mycat2.options[i].selected)
        {
        if(mycat2.options[i].value=="0")
        {
          alert("Please Select from the List");return;
        }               
        redirecrparams+="&Cat2="+mycat2.options[i].value;
        status=true;       
        }
    }
    if(!status)
    {
        customertype = document.getElementById('typeofwork');
        workList = GeneralSub[customertype.value];
        var str=String(workList);  
        if(str.substring(0,1)=="-")
        {
        redirecrparams+="&Cat2="+str.substring(1);
        }  
    }
    if(document.getElementById("postcode").value.length>0)
    {
        var temp=document.getElementById("postcode").value;        
        temp=temp.replace(' ','');
        temp=temp.replace(' ','');        
        redirecrparams+="&PC="+temp;
    }
    else
    {
        alert("Please Enter a Postal Code");
        return;
    }
    
var myurl=posturl+"?Code="+code+redirecrparams;
location.href=myurl;   
 
}


