$Country = Mage::getModel('directory/country')->load($CountryId)->getName();
 /*
 //use full region name if state is not in US
 if($Country !== "US")
 {
 	$State = $myOrder->getShippingAddress()->getRegion();
 }
 */
 // shipping method $ShippingMethod2
 //will have to check text of magento for googlecheckout [shipping_description] => Flat Rate - Fixed
 $MagentoShipCode = $myOrder->getShippingMethod();
 $MagentoShipDescription = $myOrder->getShippingDescription();
 if ($MagentoShipCode == "googlecheckout_carrier") {
     $ShippingMethod2 = getPaShipCode($MagentoShipDescription);
 } else {
     $ShippingMethod2 = getPaShipCode($MagentoShipCode);
 }
 if ($ShippingMethod2 == "") {
     //$log->lwrite("PartId=".$PartId."\n");
     $log->lwrite("PA Shipping method code not found. Order " . $thisId . " skipped.\n");
     $log->lwrite($MagentoShipCode . "\n");
     $log->lwrite($MagentoShipDescription . "\n");
     $subject = "Error in PA Gateway - order submission:shipping";
     $body = "PA Shipping method code not found. Order " . $thisId . " skipped.\n";
     mail($to, $subject, $body);
     continue;
 }
 //id is different from invoce number which is what appears in the Admin interface.
 // send invoice ID to parts authority
 //echo "ORDER NUMBER".$myOrder->getIncrementId()." thisId = ".$thisId;
 $InvoiceId = $myOrder->getIncrementId();
 $Country = Mage::getModel('directory/country')->load($CountryId)->getName();
 /*
 //use full region name if state is not in US
 if($Country !== "US")
 {
 	$State = $myOrder->getShippingAddress()->getRegion();
 }
 */
 // shipping method $ShippingMethod2
 //will have to check text of magento for googlecheckout [shipping_description] => Flat Rate - Fixed
 $MagentoShipCode = $myOrder->getShippingMethod();
 $MagentoShipDescription = $myOrder->getShippingDescription();
 if (strpos($MagentoShipCode, "fedex") || strpos($MagentoShipCode, "usps")) {
     $ShippingMethod2 = getPaShipCode($MagentoShipCode);
 } else {
     $ShippingMethod2 = getPaShipCode($MagentoShipDescription);
 }
 if ($ShippingMethod2 == "") {
     //$log->lwrite("PartId=".$PartId."\n");
     $log->lwrite("PA Shipping method code not found. Order " . $thisId . " skipped.\n");
     $log->lwrite($MagentoShipCode . "\n");
     $log->lwrite($MagentoShipDescription . "\n");
     $subject = "Error in PA Gateway - order submission:shipping";
     $body = "PA Shipping method code not found. Order " . $thisId . " skipped.\n";
     mail($to, $subject, $body);
     continue;
 }
 //id is different from invoce number which is what appears in the Admin interface.
 // send invoice ID to parts authority
 //echo "ORDER NUMBER".$myOrder->getIncrementId()." thisId = ".$thisId;
 $InvoiceId = $myOrder->getIncrementId();