function createMenu()
{
 if(window.location.search) {
    var query = window.location.search.substr(1);
    var pairs = query.split(/&|;/);
    for(var i = 0; i < pairs.length; i++) {
        var pair = pairs[i].split("=");
        var retCode = unescape(pair[1]);       
        var selectBox = document.geoaccessform1.plan;
        if(retCode == 'AE')
          selectBox.options[1].text = 'UnitedHealthcare Options PPO & EPO'; 
        else if(retCode == 'UP')
          selectBox.options[1].text = 'UnitedHealthcare Options PPO Tier 2';     
        else if(retCode == 'UPCP')
          selectBox.options[1].text = 'UnitedHealthcare Choice Plus Tier 2';     
                       
    }
 }

}


function convertName(inString) 
{

	var convArray = new Array("&", "&amp;","@", "&#64;");

	var outString = "";

	for (var i = 0; i < inString.length; i++) 
		
		{

		var gotMatch = false;

		for (var j = 0; j < convArray.length && !gotMatch; j+=2) 
			
			{

				if (inString.charAt(i)==convArray[j]) 
				{

				outString += convArray[j+1];
				gotMatch = true;
				}
			
			}

	if (!gotMatch)
	
	outString += inString.charAt(i);
	}

//alert(outString);


	return outString;

}


function callGeoAccess() {
    
var xml1 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><\!DOCTYPE UNITED SYSTEM \"https://www.geoaccess.com/uhc/po/dtd/UHC.dtd\"><UNITED><PortalRequest><Options displayLinks=\"N\" displayProviderId=\"Y\" hstLink=\"N\" medicaLogo=\"N\" northCarolinaText=\"N\" pcpText=\"N\" supressUhp=\"N\"/><LogoList><Logo>\UHC\</Logo></LogoList><StyleSheet style=\"Blue\"/>";
var xml1a = "";
var xml1b= "<InitialSearchType type=\"Generic\"/><ProductList><Product delsys=\"";
var xml2 = "\" ";
var xml3 = "name=\"";
var xml4 = "\"/></ProductList><LoggingIndicator portal=\"Custom\"/></PortalRequest></UNITED>";

 var excludeCustomList = new Array("UnitedHealthcare Options PPO",
                                     "UnitedHealthcare Select HMO", 
                                     "UnitedHealthcare Select Plus HMO", 
                                     "UnitedHealthcare Select Plus POS", 
                                     "UnitedHealthcare Select EPO", 
                                     "UnitedHealthcare Choice", 
                                     "UnitedHealthcare Choice Plus",
				     "UnitedHealthcare Choice HMO",					
				     "UnitedHealthcare Choice Plus HMO",
				     "UnitedHealthcare iPlan PPO",
				     "UnitedHealthcare iPlan Choice Plus");


 var excludeDelsysValue = new Array("01", "02", "02", "03", "46", "51", "52", "53", "53", "01", "52");



var selectBox = document.geoaccessform1.plan;

if(selectBox.selectedIndex > 1){
	xml1a = "<Locale>es</Locale>"
	}
var user_input = selectBox.options[selectBox.selectedIndex].value;

var user_plan = selectBox.options[selectBox.selectedIndex].text;

user_plan = convertName(user_plan);

for (var i = 0; i < excludeCustomList.length; i++) {
	    if ((user_plan==excludeCustomList[i]) && (user_input==excludeDelsysValue[i])) {
			user_plan = "";			
			break;
		}
	}


if(user_input == "00"){
alert("Please select a plan");
return;
}

//alert(xml1);
//alert(user_input);
//alert(xml2);
//alert(xml3);
//alert(user_plan);
//alert(xml4);


var bigxml = xml1+xml1a+xml1b+user_input+xml2+xml3+user_plan+xml4;

document.geoaccessform1.xmlblock.value = bigxml;

//alert(document.geoaccessform1.xmlblock.value);
document.geoaccessform1.submit();

} 
