var CallType=-1;

function changeCategory(val)
{
    var selectedType;
    //change to switch statement    
    if (val==7) 
    {
        selectedType=4;
    }
    else if (val==3)
    {
        selectedType=0;  
    }
    else if(val==4)
    {
        selectedType=3;  
    }
    else
    {
        selectedType=val; 
    }
    document.getElementById('typeValue').value=selectedType;
    CallType=val;
}


 


function submitFaultDetails(btn,method)
{
    //set hidden value to contents of method
         
   
   if (CallType!=-1)
   {
    
    var REDIRECT_1 = 'FaultMap_IE.php?callTypeID='+ CallType  + '&faultTypeID=' + document.getElementById('typeValue').value;
    var REDIRECT_2 = 'FaultMap_Alt.php?callTypeID='+ CallType  + '&faultTypeID=' + document.getElementById('typeValue').value;
    var REDIRECT_3 = 'DefectWizard.php?locationValue=1&callTypeID='+ CallType  + '&faultTypeID=' + document.getElementById('typeValue').value;    
    var REDIRECT_4 = 'FaultMap_IE_StreetLight.php?callTypeID='+ CallType  + '&faultTypeID=' + document.getElementById('typeValue').value;
    var REDIRECT_5 = 'FaultMap_Alt_StreetLight.php?callTypeID='+ CallType  + '&faultTypeID=' + document.getElementById('typeValue').value;
 
   document.getElementById('errorText').style.display="none"; 
   // document.body.style.cursor='wait'; 
     //btn.style.cursor='wait';   
    if(method==0)
    {      
      window.location = REDIRECT_3; 
    }
    else
    {
    if(navigator.appName == "Microsoft Internet Explorer")
    {   
        if (CallType==1)
        { 
            window.location = REDIRECT_4;
        }
        else
        {
          window.location = REDIRECT_1; 
        }
    }
    else
    {
        if (CallType==1)
        {
            window.location = REDIRECT_5;
        }
        else
        {
           window.location = REDIRECT_2;
        }
    }

    }
        //document.formname.action='newpage.asp';
            
    //window.location='http://www.google.co.uk';   
   }
   else
   {
        document.getElementById('errorText').style.display="";
        
   }
 }          
   
